From b0558d9dfc5e03929a60b240936cb9ea19177259 Mon Sep 17 00:00:00 2001 From: FigT Date: Thu, 27 Jun 2024 19:47:53 -0700 Subject: [PATCH] 2.1.1-SNAPSHOT fix --- adventure/build.gradle | 2 +- api/build.gradle | 2 +- .../main/java/gg/saki/zaiko/MenuListener.java | 36 +++---------------- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/adventure/build.gradle b/adventure/build.gradle index 29ccf88..5d22159 100644 --- a/adventure/build.gradle +++ b/adventure/build.gradle @@ -1,5 +1,5 @@ archivesBaseName = 'zaiko-adventure' -version = '2.1.0' // < change this version +version = '2.1.1-SNAPSHOT' // < change this version description = 'Adventure support for Zaiko titles' dependencies { diff --git a/api/build.gradle b/api/build.gradle index c7cac1a..7fe8d56 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,3 +1,3 @@ archivesBaseName = 'zaiko' -version = '2.1.0' // < change this version +version = '2.1.1-SNAPSHOT' // < change this version description = 'A modern and flexible GUI library for Spigot' \ No newline at end of file diff --git a/api/src/main/java/gg/saki/zaiko/MenuListener.java b/api/src/main/java/gg/saki/zaiko/MenuListener.java index 7aa6163..17a1ee7 100644 --- a/api/src/main/java/gg/saki/zaiko/MenuListener.java +++ b/api/src/main/java/gg/saki/zaiko/MenuListener.java @@ -33,9 +33,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; -import java.util.ArrayList; -import java.util.List; - /** * The main listener for handling interactions with {@link Menu}s. */ @@ -58,36 +55,22 @@ private void onClick(InventoryClickEvent event) { if (menu == null) return; + Inventory inventory = event.getInventory(); + Inventory clickedInventory = event.getClickedInventory(); if (clickedInventory == null) { return; } - if (menu.settings().playerInventoryInteraction() - && clickedInventory.getType() == InventoryType.PLAYER) return; - - Placeable placeable = menu.getPlaceable(event.getSlot()); + Placeable placeable = menu.getPlaceable(event.getRawSlot()); if (placeable != null) { placeable.click(event); return; } - - if (!menu.settings().transferItems()) { - if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY && clickedInventory.getType() == InventoryType.PLAYER) { - event.setCancelled(true); - event.setCursor(null); - return; - } - - if (clickedInventory.getType() != InventoryType.PLAYER) { - event.setCancelled(true); - player.getInventory().addItem(event.getCursor()); - event.setCursor(null); - } - } + event.setCancelled(true); } @@ -101,17 +84,6 @@ private void onDrag(InventoryDragEvent event) { if (menu == null) return; - Inventory inventory = event.getInventory(); - - - List slots = new ArrayList<>(event.getInventorySlots()); - if (!menu.settings().transferItems() && inventory.getType() != InventoryType.PLAYER && inventory.getItem(slots.get(0)) == null) { - event.setCancelled(true); - player.getInventory().addItem(event.getOldCursor()); - event.setCursor(null); - return; - } - ItemStack cursor = event.getOldCursor(); for (Placeable placeable : menu.getPlaceableArray()) {