java.lang.Object
tk.airshipcraft.commonlib.gui.objects.Gui

public abstract class Gui extends Object
Abstract base class for creating custom Graphical User Interfaces (GUIs) in Minecraft. This class provides a foundational framework for GUI creation, including inventory initialization, event handling, and interaction management. It is designed to be extended by subclasses to create specific types of GUIs with custom behavior and event handling tailored to the needs of different plugins or functionalities.
Since:
2023-11-20
Version:
1.0.0
Author:
notzune
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.bukkit.inventory.Inventory
    The Inventory object associated with this GUI, representing the interface layout and contents.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Gui(org.bukkit.inventory.Inventory inventory)
    Constructs a new Gui instance with the provided inventory.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.inventory.Inventory
    Retrieves the Inventory object associated with this GUI.
    void
    handleClick(org.bukkit.event.inventory.InventoryClickEvent event, org.bukkit.entity.Player player)
    Handles a click event within the GUI.
    abstract void
    Abstract method for handling custom GuiClickEvent.
    void
    open(org.bukkit.entity.Player player)
    Opens the GUI for a specified player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • inventory

      protected org.bukkit.inventory.Inventory inventory
      The Inventory object associated with this GUI, representing the interface layout and contents.
  • Constructor Details

    • Gui

      public Gui(org.bukkit.inventory.Inventory inventory)
      Constructs a new Gui instance with the provided inventory.
      Parameters:
      inventory - The Inventory object associated with this GUI, representing the interface layout and contents.
  • Method Details

    • handleClick

      public void handleClick(org.bukkit.event.inventory.InventoryClickEvent event, org.bukkit.entity.Player player)
      Handles a click event within the GUI. This method is responsible for creating and dispatching a custom GuiClickEvent upon player interaction with the GUI. It also provides a point of extension for handling the event after its creation and dispatch.
      Parameters:
      event - The InventoryClickEvent triggered when a player clicks an item within the inventory.
      player - The player who clicked in the GUI.
    • handleCustomClick

      public abstract void handleCustomClick(GuiClickEvent event)
      Abstract method for handling custom GuiClickEvent. Subclasses should override this method to define specific behaviors for GUI interactions.
      Parameters:
      event - The custom GuiClickEvent to be handled.
    • open

      public void open(org.bukkit.entity.Player player)
      Opens the GUI for a specified player. This method should be invoked to display the GUI, making it visible and interactive for the player.
      Parameters:
      player - The player for whom the GUI should be opened.
    • getInventory

      public org.bukkit.inventory.Inventory getInventory()
      Retrieves the Inventory object associated with this GUI. This inventory represents the layout and content of the GUI.
      Returns:
      The Inventory object representing this GUI.