SPIGOT-7904: Fix NPE for PlayerItemBreakEvent

This commit is contained in:
Doc 2024-09-19 06:45:18 +10:00 committed by md_5
parent f35bae9ec8
commit 98c57cbbee
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -307,7 +307,7 @@
if (j >= this.getMaxDamage()) { if (j >= this.getMaxDamage()) {
Item item = this.getItem(); Item item = this.getItem();
+ // CraftBukkit start - Check for item breaking + // CraftBukkit start - Check for item breaking
+ if (this.count == 1) { + if (this.count == 1 && entityplayer != null) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(entityplayer, this); + org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent(entityplayer, this);
+ } + }
+ // CraftBukkit end + // CraftBukkit end