diff --git a/build.gradle.kts b/build.gradle.kts index 3b521b1..fcc9c5a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ val nexusUser = providers.gradleProperty("alttdSnapshotUsername").orNull ?: Syst val nexusPass = providers.gradleProperty("alttdSnapshotPassword").orNull ?: System.getenv("NEXUS_PASSWORD") group = "com.alttd.inventory_gui" -version = "1.1.3-SNAPSHOT" +version = "1.1.4-SNAPSHOT" repositories { mavenCentral() diff --git a/src/main/java/com/alttd/inventory_gui/gui/GuiListener.java b/src/main/java/com/alttd/inventory_gui/gui/GuiListener.java index d38dc65..b384637 100644 --- a/src/main/java/com/alttd/inventory_gui/gui/GuiListener.java +++ b/src/main/java/com/alttd/inventory_gui/gui/GuiListener.java @@ -20,7 +20,6 @@ import java.util.Optional; * The {@code GuiListener} is associated with a specific plugin by its name to ensure * that event handling is scoped to the appropriate plugin's GUI instances. */ -@SuppressWarnings("ClassCanBeRecord") public final class GuiListener implements Listener { /** @@ -29,6 +28,30 @@ public final class GuiListener implements Listener { public GuiListener() { } + /** + * Handles inventory click interactions in the context of GUI sessions. This method ensures + * that the event is processed consistently with other inventory interactions by delegating + * the handling to the {@code onInventoryInteract} method. + * + * @param event the {@code InventoryClickEvent} triggered when a player clicks within an inventory + */ + @EventHandler + public void onInventoryClick(InventoryClickEvent event) { + onInventoryInteract(event); + } + + /** + * Handles inventory drag interactions in the context of GUI sessions. This method delegates + * the handling of the event to the {@code onInventoryInteract} method to ensure consistent + * processing of inventory interactions. + * + * @param event the {@code InventoryDragEvent} triggered when a player drags items within an inventory + */ + @EventHandler + public void onInventoryDrag(InventoryDragEvent event) { + onInventoryInteract(event); + } + /** * Handles interactions with inventories in the context of GUI sessions. This method ensures * that the interaction is processed only if the player is part of an active GUI session. @@ -37,7 +60,6 @@ public final class GuiListener implements Listener { * * @param event the {@code InventoryInteractEvent} triggered when a player interacts with an inventory */ - @EventHandler public void onInventoryInteract(InventoryInteractEvent event) { if (!(event.getWhoClicked() instanceof Player player)) { return; diff --git a/src/main/java/com/alttd/inventory_gui/gui/InventoryGui.java b/src/main/java/com/alttd/inventory_gui/gui/InventoryGui.java index ee7198c..180a7dc 100644 --- a/src/main/java/com/alttd/inventory_gui/gui/InventoryGui.java +++ b/src/main/java/com/alttd/inventory_gui/gui/InventoryGui.java @@ -121,7 +121,6 @@ public class InventoryGui { } if (!item.isClickable()) { - event.setCancelled(true); return; } item.handle(event);