Interface InventoryGUI
- All Known Subinterfaces:
SharedInventoryGUI
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 TypeMethodDescriptionorg.bukkit.event.inventory.InventoryTypeGet the inventory type used by this GUI to display items to viewersintGet the maximum size that this GUI can be before extra elements will flow onto new pages.voidhandleBedrockResponse(GUISession session, org.bukkit.entity.Player player, int clickedButtonId) Handle a Bedrock form responsevoidhandleBukkitEvent(org.bukkit.event.Event event, GUISession session) Handle the given Bukkit event, for example a ClickEventbooleanWhether or not this GUI should re-scale it's size to wrap it's current contents or if it should always be the maximum sizevoidopen(org.bukkit.entity.Player player) Shows the player provided the GUI, will show page 1.voidopen(org.bukkit.entity.Player player, int page) Shows the player provided the GUI, and starts with the player viewing the given pagevoidupdateContentsAndView(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.voidupdateView(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 GUIpage- 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
Handle the given Bukkit event, for example a ClickEvent- Parameters:
event- The event to handlesession- 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 eventplayer- Player that opened the dialogclickedButtonId- 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
-