Class MenuManager

java.lang.Object
de.clickism.clickgui.menu.MenuManager
All Implemented Interfaces:
org.bukkit.event.Listener

public class MenuManager extends Object implements org.bukkit.event.Listener
Listens for menu clicks and passes them to their active menus.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static MenuManager
    The instance of the menu manager.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MenuManager(org.bukkit.plugin.java.JavaPlugin plugin)
    Creates a new menu manager and registers it as a listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes all active menus.
    Gets the instance of the menu manager, or null if no instance was set.
    void
    onClick(org.bukkit.event.inventory.InventoryClickEvent event)
    Passes the click event to the active menu.
    void
    onClose(org.bukkit.event.inventory.InventoryCloseEvent event)
    Closes the active menu when the inventory is closed.
    void
    onDisable(org.bukkit.event.server.PluginDisableEvent event)
    Closes all active menus when the plugin is disabled.
    void
    onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
    Passes the drag event to the active menu.
    openMenu(Menu menu)
    Opens a menu.
    Registers a menu view.
    static void
    Sets the instance of the menu manager to be used by the shorthand method Menu.open().

    Methods inherited from class java.lang.Object

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

    • instance

      protected static MenuManager instance
      The instance of the menu manager.
  • Constructor Details

    • MenuManager

      public MenuManager(org.bukkit.plugin.java.JavaPlugin plugin)
      Creates a new menu manager and registers it as a listener.
      Parameters:
      plugin - the plugin to register the listener with
  • Method Details

    • openMenu

      public MenuView openMenu(Menu menu)
      Opens a menu.
      Parameters:
      menu - the menu to open
      Returns:
      the menu view
    • registerActiveView

      public MenuView registerActiveView(MenuView view)
      Registers a menu view.
      Parameters:
      view - the view to register
      Returns:
      the view
    • closeActiveMenus

      public void closeActiveMenus()
      Closes all active menus.
    • onDisable

      public void onDisable(org.bukkit.event.server.PluginDisableEvent event)
      Closes all active menus when the plugin is disabled.
      Parameters:
      event - the event
    • onClick

      public void onClick(org.bukkit.event.inventory.InventoryClickEvent event)
      Passes the click event to the active menu.
      Parameters:
      event - the event
    • onDrag

      public void onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
      Passes the drag event to the active menu.
      Parameters:
      event - the event
    • onClose

      public void onClose(org.bukkit.event.inventory.InventoryCloseEvent event)
      Closes the active menu when the inventory is closed.
      Parameters:
      event - the event
    • getInstance

      @Nullable public static MenuManager getInstance()
      Gets the instance of the menu manager, or null if no instance was set.
      Returns:
      the instance
    • setInstance

      public static void setInstance(MenuManager instance)
      Sets the instance of the menu manager to be used by the shorthand method Menu.open().
      Parameters:
      instance - the instance