Fix closeInventory shenanigans (#6292)

This commit is contained in:
Nassim Jahnke 2021-07-30 11:37:11 +02:00 committed by GitHub
parent e4ecf6ce87
commit 7a5025d461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -154,7 +154,7 @@ index 3db5b3adb9fe4a1682b0a4e75ae3e1f6febb7822..5dc5c12f341282f296082ce9c972808b
this.containerMenu = this.inventoryMenu;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index f1b1d1881d0598503a7ec1022ef5e00f848fb247..a9f8ffa1772de39c74394f8cf324ab77ff4e0450 100644
index f1b1d1881d0598503a7ec1022ef5e00f848fb247..460828d29583ee21a7c5b716f9687a8243911a7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -373,7 +373,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -166,15 +166,13 @@ index f1b1d1881d0598503a7ec1022ef5e00f848fb247..a9f8ffa1772de39c74394f8cf324ab77
}
ServerPlayer player = (ServerPlayer) this.getHandle();
AbstractContainerMenu container;
@@ -443,8 +443,16 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@@ -443,8 +443,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@Override
public void closeInventory() {
- this.getHandle().closeContainer();
+ this.getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLUGIN);
+ getHandle().closeContainer();
+ // Paper start
+ getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLUGIN);
+ this.getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLUGIN);
}
+ @Override
+ public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
@ -185,7 +183,7 @@ index f1b1d1881d0598503a7ec1022ef5e00f848fb247..a9f8ffa1772de39c74394f8cf324ab77
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0ce5e35d1ca59587301edba56ddcf2a4e7fbe247..9c1a2ac04facba52af09ee87a96e8911d41a3f32 100644
index 90dae9fc9f048802f79153d90ef4de9b1670ae7a..cf5dabd0e3993c388f157f28f07fc8fa796d653f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -922,7 +922,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -198,7 +196,7 @@ index 0ce5e35d1ca59587301edba56ddcf2a4e7fbe247..9c1a2ac04facba52af09ee87a96e8911
// Check if the fromWorld and toWorld are the same.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 1ecd631c169e137669a154eecd0a1f4cd1230240..7fab5ae695763350669fb20e3c765c947098d74e 100644
index f1f0237e503fd24dfa8fedc48fea2f591fae607f..9eae5bc0f1248f05381f24abdb5ef250fab2fd55 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1185,7 +1185,7 @@ public class CraftEventFactory {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add additional open container api to HumanEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 1dec5e2d11888a8684a198d9951d7e9bdd729898..13b3ac88e6ef436edf55e752fe2ded7844967c36 100644
index 2be54303ad01fd2b464a8962ec1afe81d045b098..01c235d48d9b5276c5b754b25c5585654591ec1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -458,6 +458,70 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
@ -78,4 +78,4 @@ index 1dec5e2d11888a8684a198d9951d7e9bdd729898..13b3ac88e6ef436edf55e752fe2ded78
+
@Override
public void closeInventory() {
this.getHandle().closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLUGIN);
// Paper start