From fcdc18e556642eb2a7401b4b72d213df1cb0e02e Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 Jul 2018 12:33:38 -0400 Subject: [PATCH] support plugins calling OBC directly for inventory close event --- .../0325-InventoryCloseEvent-Reason-API.patch | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch b/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch index 02e3fce3a..c1bd29021 100644 --- a/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch +++ b/Spigot-Server-Patches/0325-InventoryCloseEvent-Reason-API.patch @@ -1,4 +1,4 @@ -From c01c4b4de68c5d265fbd209c218fd9c49d361108 Mon Sep 17 00:00:00 2001 +From 97fe14fc8b4203d2ab460461e091251a1c8ac39b Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 3 Jul 2018 21:56:23 -0400 Subject: [PATCH] InventoryCloseEvent Reason API @@ -168,16 +168,24 @@ index fd47065c6..53f973615 100644 // 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 248873fb4..c6f447205 100644 +index 248873fb4..cce4acc0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -927,8 +927,10 @@ public class CraftEventFactory { +@@ -927,8 +927,19 @@ public class CraftEventFactory { return event; } -- public static void handleInventoryCloseEvent(EntityHuman human) { -- InventoryCloseEvent event = new InventoryCloseEvent(human.activeContainer.getBukkitView()); + // 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