Prevent removal of global attack cooldown.

This commit is contained in:
sigonasr2 2016-08-14 17:38:39 -05:00
parent e7c69e2757
commit 22e1dc51bc
2 changed files with 6 additions and 2 deletions

Binary file not shown.

View File

@ -631,17 +631,21 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3); removechance+=ItemSet.TotalBaseAmountBasedOnSetBonusCount(p, ItemSet.DAWNTRACKER, 3, 3);
log("Remove chance is "+removechance,5); log("Remove chance is "+removechance,5);
int longestdur=0; int longestdur=0;
int level=0;
PotionEffectType type=null; PotionEffectType type=null;
for (int i1=0;i1<p.getActivePotionEffects().size();i1++) { for (int i1=0;i1<p.getActivePotionEffects().size();i1++) {
if (GenericFunctions.isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType()) && Iterables.get(p.getActivePotionEffects(), i1).getDuration()>longestdur) { if (GenericFunctions.isBadEffect(Iterables.get(p.getActivePotionEffects(), i1).getType()) && Iterables.get(p.getActivePotionEffects(), i1).getDuration()>longestdur) {
longestdur=Iterables.get(p.getActivePotionEffects(), i1).getDuration(); longestdur=Iterables.get(p.getActivePotionEffects(), i1).getDuration();
type=Iterables.get(p.getActivePotionEffects(), i1).getType(); type=Iterables.get(p.getActivePotionEffects(), i1).getType();
level=Iterables.get(p.getActivePotionEffects(), i1).getAmplifier();
} }
} }
if (Math.random()<=removechance/100) { if (Math.random()<=removechance/100) {
if (!type.equals(PotionEffectType.WEAKNESS) || level<9) {
p.removePotionEffect(type); p.removePotionEffect(type);
p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(type.getName().replace("_", " "))); p.sendMessage(ChatColor.DARK_GRAY+"You successfully resisted the application of "+ChatColor.WHITE+GenericFunctions.CapitalizeFirstLetters(type.getName().replace("_", " ")));
} }
}
} }
pd.debuffcount=GenericFunctions.CountDebuffs(p); pd.debuffcount=GenericFunctions.CountDebuffs(p);