Add damage check to the Enchantment Handler...

...to avoid performing calculations where it is not necessary
This commit is contained in:
Alex-The-Coder 2016-07-08 07:42:00 -04:00 committed by GitHub
parent 443576ba1a
commit e8a1c9bcba

View File

@ -378,6 +378,10 @@ public class DamageManager extends MiniPlugin
Player damagee = event.GetDamageePlayer();
if (damagee != null)
{
if (event.GetDamage() <= 0)
{
return;
}
if (getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()) > 0)
{
event.AddMult("Ench Prot", damagee.getName(), getTotalEnchantReduction(damagee.getInventory().getArmorContents(), event.GetCause()), false);