Fixed goldPouch GUI bug

This commit is contained in:
Ka0rX 2022-08-27 16:20:29 +02:00
parent dfcb97d3c8
commit 40ae82cae9
2 changed files with 10 additions and 2 deletions

View File

@ -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);
}

View File

@ -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