From 40ae82cae94ac40f4380b8d50cc01b77d34e9073 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sat, 27 Aug 2022 16:20:29 +0200 Subject: [PATCH] Fixed goldPouch GUI bug --- .../Indyuce/mmocore/gui/api/InventoryClickContext.java | 9 ++++++++- .../net/Indyuce/mmocore/listener/PlayerListener.java | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/InventoryClickContext.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/InventoryClickContext.java index bbd059e3..4a371dfb 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/InventoryClickContext.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/api/InventoryClickContext.java @@ -12,7 +12,6 @@ public class InventoryClickContext { private final ClickType clickType; private final Cancellable event; - private Inventory inv; public InventoryClickContext(int slot, ItemStack itemStack, ClickType clickType, Cancellable event) { @@ -22,6 +21,14 @@ public class InventoryClickContext { this.event = event; } + public InventoryClickContext(int slot, ItemStack itemStack, ClickType clickType, Cancellable event, Inventory inv) { + this.slot = slot; + this.itemStack = itemStack; + this.clickType = clickType; + this.event = event; + this.inv = inv; + } + public void setCancelled(boolean val) { event.setCancelled(val); } diff --git a/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java b/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java index ca314a03..fc433272 100644 --- a/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java +++ b/MMOCore-Dist/src/main/java/net/Indyuce/mmocore/listener/PlayerListener.java @@ -39,7 +39,8 @@ public class PlayerListener implements Listener { @EventHandler public void b(InventoryClickEvent event) { if (event.getInventory().getHolder() instanceof PluginInventory && event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null) - ((PluginInventory) event.getInventory().getHolder()).whenClicked(new InventoryClickContext(event.getRawSlot(), event.getCurrentItem(), event.getClick(), event)); + ((PluginInventory) event.getInventory().getHolder()) + .whenClicked(new InventoryClickContext(event.getRawSlot(), event.getCurrentItem(), event.getClick(), event,event.getInventory())); } // Register custom inventory close effect