Add InventoryClick and InventoryDrag event handlers. bump version to 1.1.4-SNAPSHOT
This commit is contained in:
parent
d0398b1486
commit
02f78d0a23
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ public class InventoryGui {
|
|||
}
|
||||
|
||||
if (!item.isClickable()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
item.handle(event);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user