Apply poison mechanics to all mobs as well.

dev
sigonasr2 9 years ago
parent 1b217b968d
commit f2e426f69b
  1. BIN
      TwosideKeeper.jar
  2. 18
      src/sig/plugin/TwosideKeeper/TwosideKeeper.java

Binary file not shown.

@ -2724,15 +2724,14 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
if (e instanceof Player) { if (e instanceof LivingEntity) {
log("Damage reason is "+ev.getCause().toString(),4); LivingEntity l = (LivingEntity)e;
final Player p = (Player)e;
int poisonlv = 0; int poisonlv = 0;
if (p.hasPotionEffect(PotionEffectType.POISON)) { if (l.hasPotionEffect(PotionEffectType.POISON)) {
for (int j=0;j<p.getActivePotionEffects().size();j++) { for (int j=0;j<l.getActivePotionEffects().size();j++) {
if (Iterables.get(p.getActivePotionEffects(), j).getType().equals(PotionEffectType.POISON)) { if (Iterables.get(l.getActivePotionEffects(), j).getType().equals(PotionEffectType.POISON)) {
poisonlv = Iterables.get(p.getActivePotionEffects(), j).getAmplifier()+1; poisonlv = Iterables.get(l.getActivePotionEffects(), j).getAmplifier()+1;
break; break;
} }
} }
@ -2741,6 +2740,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,3); log("New damage set to "+ev.getDamage()+" from Poison "+poisonlv,3);
} }
} }
}
if (e instanceof Player) {
log("Damage reason is "+ev.getCause().toString(),4);
final Player p = (Player)e;
if (ev.getCause()==DamageCause.ENTITY_EXPLOSION || if (ev.getCause()==DamageCause.ENTITY_EXPLOSION ||
ev.getCause()==DamageCause.BLOCK_EXPLOSION) { ev.getCause()==DamageCause.BLOCK_EXPLOSION) {

Loading…
Cancel
Save