Class InventoryClickListener

java.lang.Object
tk.airshipcraft.commonlib.gui.events.InventoryClickListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class InventoryClickListener extends Object implements org.bukkit.event.Listener
Listener class for inventory click events in Bukkit. This class detects clicks in custom UIs and triggers appropriate custom GUI click events. It acts as a mediator between Bukkit's inventory system and the custom UI framework, allowing for integrated event handling.
Since:
2023-04-11
Version:
1.0.0
Author:
Locutusque, notzune
  • Constructor Details

    • InventoryClickListener

      public InventoryClickListener()
  • Method Details

    • onInventoryClick

      public void onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)
      Processes InventoryClickEvents, checking if they occur within a custom UI. If the event occurs in a custom UI, a GuiClickEvent is fired, and associated actions are performed. This method is crucial for integrating Bukkit's inventory interactions with the custom UI system.
      Parameters:
      event - The InventoryClickEvent triggered by a player's interaction with an inventory.
    • handleInventoryClick

      public boolean handleInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event)
      A utility method to handle the casting and processing of InventoryClickEvents. This method encapsulates the logic for checking if an event is associated with a custom UI and handling it accordingly. It returns a boolean indicating whether the event was processed as part of a custom UI interaction.
      Parameters:
      event - The InventoryClickEvent to be processed.
      Returns:
      True if the event corresponds to a custom UI interaction and was handled, false otherwise.