mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 11:24:11 +01:00
Fire PlayerItemBreakEvent. Addresses BUKKIT-1600
This commit is contained in:
parent
8bc42ba8c9
commit
9f37f70527
2 changed files with 12 additions and 0 deletions
|
@ -179,6 +179,12 @@ public final class ItemStack {
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start - Check for item breaking
|
||||||
|
if (this.count == 0 && entityliving instanceof EntityHuman) {
|
||||||
|
org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) entityliving, this);
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
this.damage = 0;
|
this.damage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,4 +526,10 @@ public class CraftEventFactory {
|
||||||
world.getServer().getPluginManager().callEvent(event);
|
world.getServer().getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void callPlayerItemBreakEvent(EntityHuman human, ItemStack brokenItem) {
|
||||||
|
CraftItemStack item = new CraftItemStack(brokenItem);
|
||||||
|
PlayerItemBreakEvent event = new PlayerItemBreakEvent((Player) human.getBukkitEntity(), item);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue