Class GUIClickEvent

java.lang.Object
org.bukkit.event.Event
com.coderyo.coderyogui.api.GUIClickEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public class GUIClickEvent extends org.bukkit.event.Event implements org.bukkit.event.Cancellable
An event fired when a player clicks a slot in a CoderyoGUI custom GUI. This event can be cancelled to prevent the execution of associated GUIActions.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    GUIClickEvent(org.bukkit.entity.Player player, CustomGUI gui, int pageId, int slot, GUIItem item)
    Constructs a new GUIClickEvent.
    GUIClickEvent(org.bukkit.entity.Player player, CustomGUI gui, int pageId, int slot, GUIItem item, boolean isBackButton)
    Constructs a new GUIClickEvent with back button indicator.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the CustomGUI that was clicked.
    static org.bukkit.event.HandlerList
    Gets the static HandlerList for this event type.
    org.bukkit.event.HandlerList
    Gets the list of event handlers.
    Gets the GUIItem in the clicked slot, if any.
    int
    Gets the ID of the page clicked.
    org.bukkit.entity.Player
    Gets the player who clicked the GUI.
    int
    Gets the slot index clicked.
    boolean
    Checks if the clicked slot is the back button (slot 0).
    boolean
    Checks if the event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets whether the event is cancelled.

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

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

    • GUIClickEvent

      public GUIClickEvent(org.bukkit.entity.Player player, CustomGUI gui, int pageId, int slot, GUIItem item)
      Constructs a new GUIClickEvent.
      Parameters:
      player - The player who clicked the GUI.
      gui - The CustomGUI that was clicked.
      pageId - The ID of the page clicked.
      slot - The slot index clicked.
      item - The GUIItem in the slot, or null if the slot is empty.
    • GUIClickEvent

      public GUIClickEvent(org.bukkit.entity.Player player, CustomGUI gui, int pageId, int slot, GUIItem item, boolean isBackButton)
      Constructs a new GUIClickEvent with back button indicator.
      Parameters:
      player - The player who clicked the GUI.
      gui - The CustomGUI that was clicked.
      pageId - The ID of the page clicked.
      slot - The slot index clicked.
      item - The GUIItem in the slot, or null if the slot is empty.
      isBackButton - True if the clicked slot is the back button (slot 0).
  • Method Details

    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets the player who clicked the GUI.
      Returns:
      The player.
    • getGui

      public CustomGUI getGui()
      Gets the CustomGUI that was clicked.
      Returns:
      The CustomGUI instance.
    • getPageId

      public int getPageId()
      Gets the ID of the page clicked.
      Returns:
      The page ID.
    • getSlot

      public int getSlot()
      Gets the slot index clicked.
      Returns:
      The slot index.
    • getItem

      public GUIItem getItem()
      Gets the GUIItem in the clicked slot, if any.
      Returns:
      The GUIItem, or null if the slot is empty.
    • isBackButton

      public boolean isBackButton()
      Checks if the clicked slot is the back button (slot 0).
      Returns:
      True if the slot is the back button, false otherwise.
    • isCancelled

      public boolean isCancelled()
      Checks if the event has been cancelled.
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
      Returns:
      true if the event is cancelled, false otherwise.
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets whether the event is cancelled. If cancelled, associated GUIAction executions will be prevented.
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
      Parameters:
      cancelled - true to cancel the event, false to allow it.
    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Gets the list of event handlers.
      Specified by:
      getHandlers in class org.bukkit.event.Event
      Returns:
      The HandlerList for this event.
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
      Gets the static HandlerList for this event type.
      Returns:
      The static HandlerList.