From 595c69ab7b841131f9b738bc431980c227b8c452 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 18 Dec 2016 09:26:36 +1100 Subject: [PATCH] SPIGOT-2930: Shift calling of PlayerItemBreakEvent to before break. By: md_5 --- paper-server/nms-patches/ItemStack.patch | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/paper-server/nms-patches/ItemStack.patch b/paper-server/nms-patches/ItemStack.patch index 10ffe6462..6e539e716 100644 --- a/paper-server/nms-patches/ItemStack.patch +++ b/paper-server/nms-patches/ItemStack.patch @@ -264,18 +264,18 @@ } public int k() { -@@ -205,6 +392,11 @@ - entityhuman.b(StatisticList.c(this.item)); - } - +@@ -198,6 +385,11 @@ + if (this.f()) { + if (this.isDamaged(i, entityliving.getRandom())) { + entityliving.b(this); + // CraftBukkit start - Check for item breaking -+ if (this.count == 0 && entityliving instanceof EntityHuman) { ++ if (this.count == 1 && entityliving instanceof EntityHuman) { + org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) entityliving, this); + } + // CraftBukkit end - this.damage = 0; - } - + this.subtract(1); + if (entityliving instanceof EntityHuman) { + EntityHuman entityhuman = (EntityHuman) entityliving; @@ -509,6 +701,12 @@ nbttaglist.add(nbttagcompound); }