mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
SPIGOT-4491: Fix InventoryMoveItemEvent causing repeated events
This commit is contained in:
parent
1cac9d4fc1
commit
e4183e7069
1 changed files with 7 additions and 23 deletions
|
@ -56,7 +56,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Y_() {
|
public void Y_() {
|
||||||
@@ -165,10 +199,35 @@
|
@@ -165,7 +199,28 @@
|
||||||
for (int i = 0; i < this.getSize(); ++i) {
|
for (int i = 0; i < this.getSize(); ++i) {
|
||||||
if (!this.getItem(i).isEmpty()) {
|
if (!this.getItem(i).isEmpty()) {
|
||||||
ItemStack itemstack = this.getItem(i).cloneItemStack();
|
ItemStack itemstack = this.getItem(i).cloneItemStack();
|
||||||
|
@ -82,19 +82,11 @@
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ ItemStack itemstack1 = addItem(this, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
+ ItemStack itemstack1 = addItem(this, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
||||||
|
+ // CraftBukkit end
|
||||||
|
|
||||||
if (itemstack1.isEmpty()) {
|
if (itemstack1.isEmpty()) {
|
||||||
- iinventory.update();
|
iinventory.update();
|
||||||
+ if (event.getItem().equals(oitemstack)) {
|
@@ -290,7 +345,34 @@
|
||||||
+ iinventory.update();
|
|
||||||
+ } else {
|
|
||||||
+ this.setItem(i, itemstack);
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -290,10 +349,41 @@
|
|
||||||
|
|
||||||
if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) {
|
if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) {
|
||||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||||
|
@ -126,19 +118,11 @@
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+ ItemStack itemstack2 = addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
+ ItemStack itemstack2 = addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
||||||
|
+ // CraftBukkit end
|
||||||
|
|
||||||
if (itemstack2.isEmpty()) {
|
if (itemstack2.isEmpty()) {
|
||||||
- iinventory.update();
|
iinventory.update();
|
||||||
+ if (event.getItem().equals(oitemstack)) {
|
@@ -305,6 +387,13 @@
|
||||||
+ iinventory.update();
|
|
||||||
+ } else {
|
|
||||||
+ iinventory.setItem(i, itemstack1);
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -305,6 +395,13 @@
|
|
||||||
|
|
||||||
public static boolean a(IInventory iinventory, EntityItem entityitem) {
|
public static boolean a(IInventory iinventory, EntityItem entityitem) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
Loading…
Reference in a new issue