From 9bf675b0b63ce441b953043cfab255818c1d1a48 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 2 Aug 2014 16:03:50 -0500 Subject: [PATCH] Fix removal of items from Item Frames. Fixes BUKKIT-5736 By: feildmaster --- .../org/bukkit/craftbukkit/event/CraftEventFactory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 2c0065df40..c6c7f23b2c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -564,8 +564,12 @@ public class CraftEventFactory { return handleEntityDamageEvent(damagee, source, modifiers, modifierFunctions); } - // Non-Living Entities such as EntityEnderCrystal, EntityItemFrame, and EntityFireball need to call this + // Non-Living Entities such as EntityEnderCrystal and EntityFireball need to call this public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage) { + return handleNonLivingEntityDamageEvent(entity, source, damage, true); + } + + public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage, boolean cancelOnZeroDamage) { if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) { return false; } @@ -580,7 +584,7 @@ public class CraftEventFactory { if (event == null) { return false; } - return event.isCancelled() || event.getDamage() == 0; + return event.isCancelled() || (cancelOnZeroDamage && event.getDamage() == 0); } public static PlayerLevelChangeEvent callPlayerLevelChangeEvent(Player player, int oldLevel, int newLevel) {