mirror of
https://github.com/PaperMC/Paper.git
synced 2025-09-01 04:43:50 -07:00
Handle null damage events for item frames. Fixes BUKKIT-5114
Some types of damage are handled specially so do not end up returning an event in handleEntityDamageEvent. To ensure we don't have problems with these we need to check for them and simply ignore them, as they've been handled already.
This commit is contained in:
@@ -24,10 +24,12 @@ public class EntityItemFrame extends EntityHanging {
|
||||
} 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;
|
||||
org.bukkit.event.entity.EntityDamageEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.handleEntityDamageEvent(this, damagesource, f);
|
||||
if ((event != null && event.isCancelled()) || this.dead) {
|
||||
return true;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.b(damagesource.getEntity(), false);
|
||||
this.setItem((ItemStack) null);
|
||||
}
|
||||
|
Reference in New Issue
Block a user