diff options
author | md_5 <git@md-5.net> | 2018-11-19 20:59:37 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-11-19 20:59:37 +1100 |
commit | e4183e7069107a8e2bdb9b1d3f30a663e27614d3 (patch) | |
tree | 1a112ffbb2bdc20ef542bb186c34199bbdd0df15 /nms-patches | |
parent | 1cac9d4fc1263efb19140b808ec8671d3e3bfc5e (diff) | |
download | craftbukkit-e4183e7069107a8e2bdb9b1d3f30a663e27614d3.tar craftbukkit-e4183e7069107a8e2bdb9b1d3f30a663e27614d3.tar.gz craftbukkit-e4183e7069107a8e2bdb9b1d3f30a663e27614d3.tar.lz craftbukkit-e4183e7069107a8e2bdb9b1d3f30a663e27614d3.tar.xz craftbukkit-e4183e7069107a8e2bdb9b1d3f30a663e27614d3.zip |
SPIGOT-4491: Fix InventoryMoveItemEvent causing repeated events
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/TileEntityHopper.patch | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch index 0dc8df6e..41cba66f 100644 --- a/nms-patches/TileEntityHopper.patch +++ b/nms-patches/TileEntityHopper.patch @@ -56,7 +56,7 @@ } public void Y_() { -@@ -165,10 +199,35 @@ +@@ -165,7 +199,28 @@ for (int i = 0; i < this.getSize(); ++i) { if (!this.getItem(i).isEmpty()) { ItemStack itemstack = this.getItem(i).cloneItemStack(); @@ -82,19 +82,11 @@ + return false; + } + ItemStack itemstack1 = addItem(this, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection); ++ // CraftBukkit end if (itemstack1.isEmpty()) { -- iinventory.update(); -+ if (event.getItem().equals(oitemstack)) { -+ iinventory.update(); -+ } else { -+ this.setItem(i, itemstack); -+ } -+ // CraftBukkit end - return true; - } - -@@ -290,10 +349,41 @@ + iinventory.update(); +@@ -290,7 +345,34 @@ if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) { ItemStack itemstack1 = itemstack.cloneItemStack(); @@ -126,19 +118,11 @@ + return false; + } + ItemStack itemstack2 = addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null); ++ // CraftBukkit end if (itemstack2.isEmpty()) { -- iinventory.update(); -+ if (event.getItem().equals(oitemstack)) { -+ iinventory.update(); -+ } else { -+ iinventory.setItem(i, itemstack1); -+ } -+ // CraftBukkit end - return true; - } - -@@ -305,6 +395,13 @@ + iinventory.update(); +@@ -305,6 +387,13 @@ public static boolean a(IInventory iinventory, EntityItem entityitem) { boolean flag = false; |