summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-12-18 09:26:36 +1100
committermd_5 <git@md-5.net>2016-12-18 09:26:36 +1100
commit4602331b1dfe3699e054bcde8b8bd5670eb1046b (patch)
tree362cf100cd88152b9c9281537296a8f43e1a5840
parent7f313269d751d25336a1575c4848d83c150f9517 (diff)
downloadcraftbukkit-4602331b1dfe3699e054bcde8b8bd5670eb1046b.tar
craftbukkit-4602331b1dfe3699e054bcde8b8bd5670eb1046b.tar.gz
craftbukkit-4602331b1dfe3699e054bcde8b8bd5670eb1046b.tar.lz
craftbukkit-4602331b1dfe3699e054bcde8b8bd5670eb1046b.tar.xz
craftbukkit-4602331b1dfe3699e054bcde8b8bd5670eb1046b.zip
SPIGOT-2930: Shift calling of PlayerItemBreakEvent to before break.
-rw-r--r--nms-patches/ItemStack.patch16
1 files changed, 8 insertions, 8 deletions
diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch
index 10ffe646..6e539e71 100644
--- a/nms-patches/ItemStack.patch
+++ b/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);
}