Call EntityDamageEvent on ItemFrame item removal. Fixes BUKKIT-5020

Calling this event allows plugins to react to the situation by simply
handling a normal damage event, possibly using existing code to
handle other entity damage.

Pulled from PR #1279
This commit is contained in:
Starbuck Johnson 2013-12-05 10:33:22 -06:00 committed by feildmaster
parent 3cf569a33f
commit 36ef37b982

View file

@ -23,6 +23,11 @@ public class EntityItemFrame extends EntityHanging {
return false;
} else if (this.getItem() != null) {
if (!this.world.isStatic) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleEntityDamageEvent(this, damagesource, f).isCancelled() || this.dead) {
return false;
}
// CraftBukkit end
this.b(damagesource.getEntity(), false);
this.setItem((ItemStack) null);
}