From d8399558081a4a64d9d8d92880c275aeaeb340ec Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 11 May 2023 17:22:59 +0200 Subject: [PATCH] Fixes a bug in inventory clicking Fixes a bug where players clicking items in their own inventory while a custom inventory is open triggers items in the custom inventory. --- src/main/java/net/knarcraft/knargui/GUIListener.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/knargui/GUIListener.java b/src/main/java/net/knarcraft/knargui/GUIListener.java index 8e60a16..1856f65 100644 --- a/src/main/java/net/knarcraft/knargui/GUIListener.java +++ b/src/main/java/net/knarcraft/knargui/GUIListener.java @@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerQuitEvent; /** @@ -36,7 +37,8 @@ public class GUIListener implements Listener { AbstractGUI gui = GUIRegistry.getOpenGUI(player); //Not our GUI - if (gui == null) { + if (gui == null || event.getClickedInventory() == null || + event.getClickedInventory().getType() == InventoryType.PLAYER) { return; }