Interface GuiEvents

All Known Subinterfaces:
GuiComponent, GuiInterpreter
All Known Implementing Classes:
AbstractGuiComponent, DefaultInterpreter, EmbeddedGuiComponent, GuiContext, PagedComponent, SimpleItemComponent, ToggleItemComponent

public interface GuiEvents
Represents a set of defaulted GUI-related events. These events can be overridden in classes that implement this interface to handle specific GUI interactions. Events can be triggered when a player clicks on a component, drags an item in the GUI, or closes the GUI.

This class is licensed under the GNU General Public License. Created: 04/02/2023 Author: Tobias Madlberger (Tobias)

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    clickedComponent(@NotNull org.bukkit.event.inventory.InventoryClickEvent event)
    Called when a player clicks on a component in the GUI.
    default void
    closedComponent(@NotNull org.bukkit.event.inventory.InventoryCloseEvent event)
    Called when a player closes the GUI.
    default void
    draggedComponent(@NotNull org.bukkit.event.inventory.InventoryDragEvent event)
    Called when a player drags an item in the GUI.
    default void
    onViewInit(@NotNull Map<String,String> placeholders)
    Called when the GUI is initialized and the viewer (player) opens it.
  • Method Details

    • clickedComponent

      default void clickedComponent(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event)
      Called when a player clicks on a component in the GUI. The default behavior is to cancel the event and deny its result. If the action does not involve dropping an item, the event handling is skipped.
      Parameters:
      event - The `InventoryClickEvent` representing the click event.
    • draggedComponent

      default void draggedComponent(@NotNull @NotNull org.bukkit.event.inventory.InventoryDragEvent event)
      Called when a player drags an item in the GUI. The default behavior is to cancel the event.
      Parameters:
      event - The `InventoryDragEvent` representing the drag event.
    • closedComponent

      default void closedComponent(@NotNull @NotNull org.bukkit.event.inventory.InventoryCloseEvent event)
      Called when a player closes the GUI. The default behavior is to do nothing.
      Parameters:
      event - The `InventoryCloseEvent` representing the close event.
    • onViewInit

      default void onViewInit(@NotNull @NotNull Map<String,String> placeholders)
      Called when the GUI is initialized and the viewer (player) opens it. This method is intended to handle any necessary initialization tasks before the GUI is shown to the player. The `placeholders` parameter can be used to store additional information specific to the GUI. The default behavior is to do nothing.
      Parameters:
      placeholders - A map containing placeholder data for the GUI.