diff options
Diffstat (limited to 'Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch')
-rw-r--r-- | Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch b/Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch index f411be9c55..7a662125a1 100644 --- a/Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch +++ b/Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch @@ -88,7 +88,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7 this.m(); } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ab9ab7a88dde29ac141753e1f1e9c0ff87d199cd..eb53d8bb5c36482c39afeb6c324a620d2c7b21fb 100644 +index a357b6167405be4034cf3dad4124827e04278366..0c9e46a8973436a4438730a49986c88f12829be1 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2040,7 +2040,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -101,15 +101,15 @@ index ab9ab7a88dde29ac141753e1f1e9c0ff87d199cd..eb53d8bb5c36482c39afeb6c324a620d this.player.m(); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 1800a6c86b2150b8183acdce3a7f6daa1c9a350b..b69cff40922ba2d1a44c11bcae86f9439130ad96 100644 +index 46ea6d8e487d0c051780b0bdb06622e515cd987f..950afb131bbea53e46393fa19b0bfbb9d5c647f5 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -390,7 +390,7 @@ public abstract class PlayerList { entityplayer.a(StatisticList.LEAVE_GAME); // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it -- org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer, org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper +- entityplayer.closeInventory(); ++ entityplayer.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game"); cserver.getPluginManager().callEvent(playerQuitEvent); @@ -168,27 +168,30 @@ index f5c722644a1955c9bc68c89fdbb84526f9bbb7a0..368f786300573ff24a8dc46d96a6fb6b // 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 3a897cf5903539e1099f1a9ec98f1e157437fee0..6ca6ba46d0dd511072f518baa3aae6dc8281ef66 100644 +index b9e011256f0c8f67808ebebb5e9dc63d3358849f..4a76402c01dfe6525bae8728da2dde6e5d673765 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1301,8 +1301,19 @@ public class CraftEventFactory { +@@ -1301,12 +1301,22 @@ public class CraftEventFactory { return event; } + // Paper start -+ + /** + * Incase plugins hooked into this or Spigot adds a new inventory close event. Prefer to pass a reason + * @param human + */ + @Deprecated public static void handleInventoryCloseEvent(EntityHuman human) { -- InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); + handleInventoryCloseEvent(human, org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNKNOWN); + } + public static void handleInventoryCloseEvent(EntityHuman human, org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { -+ InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView(), reason); + // Paper end + // SPIGOT-5799 - no need to fire for when no inventory open + if (human.activeContainer == human.defaultContainer) { + return; + } +- InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); ++ InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView(), reason); // Paper human.world.getServer().getPluginManager().callEvent(event); human.activeContainer.transferTo(human.defaultContainer, human.getBukkitEntity()); } |