Class GUIHolder

java.lang.Object
me.hsgamer.hscore.ui.BaseHolder<GUIDisplay>
me.hsgamer.hscore.bukkit.gui.GUIHolder
All Implemented Interfaces:
Holder<GUIDisplay>, Initializable, Updatable

public class GUIHolder extends BaseHolder<GUIDisplay>
The base Holder for UI in Bukkit
  • Constructor Details

    • GUIHolder

      public GUIHolder(org.bukkit.plugin.Plugin plugin)
      Create a new holder
      Parameters:
      plugin - the plugin
  • Method Details

    • getPlugin

      public org.bukkit.plugin.Plugin getPlugin()
      Get the plugin
      Returns:
      the plugin
    • isRemoveDisplayOnClose

      public boolean isRemoveDisplayOnClose()
      Check if the holder should remove the display on its close
      Returns:
      true if it should
    • setRemoveDisplayOnClose

      public void setRemoveDisplayOnClose(boolean removeDisplayOnClose)
      Set that the display should be removed on close event
      Parameters:
      removeDisplayOnClose - whether the display should be removed on close event
    • getInventoryType

      public org.bukkit.event.inventory.InventoryType getInventoryType()
      Get the inventory type
      Returns:
      the inventory type
    • setInventoryType

      public void setInventoryType(org.bukkit.event.inventory.InventoryType inventoryType)
      Set the inventory type
      Parameters:
      inventoryType - the inventory type
    • getTitleFunction

      public Function<UUID,String> getTitleFunction()
      Get the title function
      Returns:
      the title function
    • setTitleFunction

      public void setTitleFunction(Function<UUID,String> titleFunction)
      Set the title function
      Parameters:
      titleFunction - the title function
    • getTitle

      public String getTitle(UUID uuid)
      Get the title for the unique id
      Parameters:
      uuid - the unique id
      Returns:
      the title
      See Also:
    • setTitle

      public void setTitle(String title)
      Set the title
      Parameters:
      title - the title
      See Also:
    • getSizeFunction

      public ToIntFunction<UUID> getSizeFunction()
      Get the size function
      Returns:
      the size function
    • setSizeFunction

      public void setSizeFunction(ToIntFunction<UUID> sizeFunction)
      Set the size function
      Parameters:
      sizeFunction - the size function
    • getSize

      public int getSize(UUID uuid)
      Get the size of the inventory for the unique id
      Parameters:
      uuid - the unique id
      Returns:
      the size
      See Also:
    • setSize

      public void setSize(int size)
      Set the size
      Parameters:
      size - the size
      See Also:
    • getCloseFilter

      public Predicate<UUID> getCloseFilter()
      Get the close filter
      Returns:
      the close filter
    • setCloseFilter

      public void setCloseFilter(Predicate<UUID> closeFilter)
      Set the close filter
      Parameters:
      closeFilter - the close filter
    • getButtonMap

      public ButtonMap getButtonMap()
      Get the button map
      Returns:
      the button map
    • setButtonMap

      public void setButtonMap(ButtonMap buttonMap)
      Set the button map
      Parameters:
      buttonMap - the button map
    • newDisplay

      protected GUIDisplay newDisplay(UUID uuid)
      Specified by:
      newDisplay in class BaseHolder<GUIDisplay>
    • init

      public void init()
    • stop

      public void stop()
      Specified by:
      stop in interface Initializable
      Overrides:
      stop in class BaseHolder<GUIDisplay>
    • onOpen

      protected void onOpen(org.bukkit.event.inventory.InventoryOpenEvent event)
      Handle open event
      Parameters:
      event - the event
    • onClick

      protected void onClick(org.bukkit.event.inventory.InventoryClickEvent event)
      Handle click event
      Parameters:
      event - the event
    • onClose

      protected void onClose(org.bukkit.event.inventory.InventoryCloseEvent event)
      Handle close event
      Parameters:
      event - the event
    • onDrag

      protected void onDrag(org.bukkit.event.inventory.InventoryDragEvent event)
      Handle drag event
      Parameters:
      event - the event