Interface InventoryGUI

All Known Subinterfaces:
SharedInventoryGUI
All Known Implementing Classes:
GUI, SharedGUI

public interface InventoryGUI
Represents an InvenntoryGUI that players can view and interact with that's GUIState (Contents, etc...) is unique to each viewer
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.event.inventory.InventoryType
    Get the inventory type used by this GUI to display items to viewers
    int
    Get the maximum size that this GUI can be before extra elements will flow onto new pages.
    void
    handleBedrockResponse(GUISession session, org.bukkit.entity.Player player, int clickedButtonId)
    Handle a Bedrock form response
    void
    handleBukkitEvent(org.bukkit.event.Event event, GUISession session)
    Handle the given Bukkit event, for example a ClickEvent
    boolean
    Whether or not this GUI should re-scale it's size to wrap it's current contents or if it should always be the maximum size
    void
    open(org.bukkit.entity.Player player)
    Shows the player provided the GUI, will show page 1.
    void
    open(org.bukkit.entity.Player player, int page)
    Shows the player provided the GUI, and starts with the player viewing the given page
    void
    updateContentsAndView(org.bukkit.entity.Player player)
    Recalculates the GUIElements to show the player (and what their display itemstacks are) and will update what the player sees - if they are viewing this GUI.
    void
    updateView(org.bukkit.entity.Player player)
    Will update what the viewer(s) see to match the GUI's state - if they are viewing this GUI.
  • Method Details

    • open

      void open(org.bukkit.entity.Player player, int page)
      Shows the player provided the GUI, and starts with the player viewing the given page
      Parameters:
      player - The player who should be shown the GUI
      page - The page to open the GUI on
    • open

      void open(org.bukkit.entity.Player player)
      Shows the player provided the GUI, will show page 1. This method is the same as calling open(Player, 1)
      Parameters:
      player - The player who should be shown the GUI
    • updateContentsAndView

      void updateContentsAndView(org.bukkit.entity.Player player)
      Recalculates the GUIElements to show the player (and what their display itemstacks are) and will update what the player sees - if they are viewing this GUI. If the given player is not viewing this GUI then this method will silently fail
      Parameters:
      player - The player to use to recalculate the GUIElements being displayed
    • updateView

      void updateView(org.bukkit.entity.Player player)
      Will update what the viewer(s) see to match the GUI's state - if they are viewing this GUI. If the given player is not viewing this GUI then this method will silently fail
      Parameters:
      player - Viewer
    • handleBukkitEvent

      void handleBukkitEvent(org.bukkit.event.Event event, GUISession session)
      Handle the given Bukkit event, for example a ClickEvent
      Parameters:
      event - The event to handle
      session - The GUI Session that should respond to the event
    • handleBedrockResponse

      void handleBedrockResponse(GUISession session, org.bukkit.entity.Player player, int clickedButtonId)
      Handle a Bedrock form response
      Parameters:
      session - The GUI Session that should respond to the event
      player - Player that opened the dialog
      clickedButtonId - ID of clicked button, -1 if no button was clicked
    • getInventoryType

      org.bukkit.event.inventory.InventoryType getInventoryType()
      Get the inventory type used by this GUI to display items to viewers
      Returns:
      The InventoryType
    • getMaximumGUISize

      int getMaximumGUISize()
      Get the maximum size that this GUI can be before extra elements will flow onto new pages. Note, this size has to be compatible with the possible sizes of the InventoryType specified. Eg. for chests it has to be a multiple of 9.
      Returns:
      The maximum size that this GUI can be.
    • isGUISizeDynamic

      boolean isGUISizeDynamic()
      Whether or not this GUI should re-scale it's size to wrap it's current contents or if it should always be the maximum size
      Returns:
      True if the GUI should re-scale to wrap it's current contents, False otherwise