From fc2073e34d536014f05201cbba184d55ea8ff2f5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 12 Mar 2014 23:10:04 -0400 Subject: [PATCH] EMC LivingEntityArmorProtectEvent To control if armor should protect entity, how much if so, and how much item damage to give. --- src/main/java/net/minecraft/server/EntityLiving.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index f35daa374..11be0931c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -39,6 +39,7 @@ import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end import co.aikar.timings.MinecraftTimings; // Paper +import com.empireminecraft.customevents.LivingEntityArmorProtectEvent; // EMC public abstract class EntityLiving extends Entity { @@ -1576,7 +1577,12 @@ public abstract class EntityLiving extends Entity { public int getArmorStrength() { AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.ARMOR); - return MathHelper.floor(attributeinstance.getValue()); + // EMC start + final double value = attributeinstance.getValue(); + LivingEntityArmorProtectEvent event = new LivingEntityArmorProtectEvent(this.getBukkitLivingEntity(), value); + event.callEvent(); + return MathHelper.floor(event.getArmorValue()); + // EMC end } protected void damageArmor(float f) {} -- 2.25.1.windows.1