Make protection enchantments actually protect wearer from damage (Fixes PC-311)
This commit is contained in:
parent
36bb0b9ae8
commit
9c4b787436
@ -282,25 +282,25 @@ public class DamageManager extends MiniPlugin
|
|||||||
for (Enchantment e : enchants.keySet())
|
for (Enchantment e : enchants.keySet())
|
||||||
{
|
{
|
||||||
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL))
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
else if (e.equals(Enchantment.PROTECTION_FIRE) &&
|
||||||
event.GetCause() == DamageCause.FIRE &&
|
event.GetCause() == DamageCause.FIRE &&
|
||||||
event.GetCause() == DamageCause.FIRE_TICK &&
|
event.GetCause() == DamageCause.FIRE_TICK &&
|
||||||
event.GetCause() == DamageCause.LAVA)
|
event.GetCause() == DamageCause.LAVA)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
else if (e.equals(Enchantment.PROTECTION_FALL) &&
|
||||||
event.GetCause() == DamageCause.FALL)
|
event.GetCause() == DamageCause.FALL)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS) &&
|
||||||
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
event.GetCause() == DamageCause.ENTITY_EXPLOSION)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false);
|
||||||
|
|
||||||
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
else if (e.equals(Enchantment.PROTECTION_PROJECTILE) &&
|
||||||
event.GetCause() == DamageCause.PROJECTILE)
|
event.GetCause() == DamageCause.PROJECTILE)
|
||||||
event.AddMod("Ench Prot", damagee.getName(), 0.5 * (double)enchants.get(e), false);
|
event.AddMod("Ench Prot", damagee.getName(), -0.5 * (double)enchants.get(e), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user