Class SharedGUI
java.lang.Object
me.eddie.inventoryguiapi.gui.guis.GUI
me.eddie.inventoryguiapi.gui.guis.SharedGUI
- All Implemented Interfaces:
InventoryGUI,SharedInventoryGUI
Default implementation of a GUI designed to be shared between multiple viewers, with a persistent GUIState
The state of the GUI (GUIState) is local to the SharedGUI object, all viewers of this GUI will be viewing the
same persistent GUIState
-
Field Summary
Fields inherited from class me.eddie.inventoryguiapi.gui.guis.GUI
actionListeners, AUTO_SET_SIZE, contentsProvider, guiPopulator, guiPresenter, inventoryType, isDynamicSize, maxSize -
Constructor Summary
ConstructorsConstructorDescriptionSharedGUI(org.bukkit.event.inventory.InventoryType inventoryType, int size, boolean isDynamicSize, GUIContentsProvider contentsProvider, GUIPopulator guiPopulator, GUIPresenter guiPresenter, GUIActionListener... guiActionListeners) Create a new SharedGUI - One where all viewers see the same inventory state (So input slots, etc...SharedGUI(org.bukkit.event.inventory.InventoryType inventoryType, int size, boolean isDynamicSize, GUIContentsProvider contentsProvider, GUIActionListener... guiActionListeners) -
Method Summary
Modifier and TypeMethodDescriptionprotected GUISessioncreateNewSession(org.bukkit.entity.Player player, int page) Get the shared GUIState that is shared by all viewers of this GUIvoidRecalculates the GUIElements to show the viewers (and what their display itemstacks are) and will update what the viewers see - if anybody is viewing this GUI.protected voidupdateContentsAndView(org.bukkit.entity.Player player, GUISession session) voidWill update what the viewers of the GUI see to match the GUI's stateprotected voidupdateView(org.bukkit.entity.Player player, GUISession session) Methods inherited from class me.eddie.inventoryguiapi.gui.guis.GUI
fireEvent, fireEventThroughActionListeners, getContentsProvider, getGuiPopulator, getGuiPresenter, getInventoryType, getMaximumGUISize, handleAutoInsertAsIndividualActions, handleBedrockResponse, handleBukkitEvent, isGUISizeDynamic, open, open, updateContentsAndView, updateViewMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.eddie.inventoryguiapi.gui.guis.InventoryGUI
getInventoryType, getMaximumGUISize, handleBedrockResponse, handleBukkitEvent, isGUISizeDynamic, open, open, updateContentsAndView, updateView
-
Constructor Details
-
SharedGUI
public SharedGUI(org.bukkit.event.inventory.InventoryType inventoryType, int size, boolean isDynamicSize, GUIContentsProvider contentsProvider, GUIPopulator guiPopulator, GUIPresenter guiPresenter, GUIActionListener... guiActionListeners) Create a new SharedGUI - One where all viewers see the same inventory state (So input slots, etc... are shared)- Parameters:
inventoryType- The type of inventory to use in the created GUIsize- The size (maximum if dynamic) to make the created GUI. Non-default sizes only supported with CHEST inventory type (Minecraft limitation)isDynamicSize- True if inventory should resize to wrap it's contentscontentsProvider- The contents provider that dictates what this GUI should be showing to viewers of itguiPopulator- The GUIPopulator to use to position the GUIElements within the inventory to displayguiPresenter- The GUIPresenter to use to present the computed inventory to the playerguiActionListeners- Any ActionListeners that you want to specify. These receive GUIEvents before GUIElements do so that you can further customise the GUI's behaviour
-
SharedGUI
public SharedGUI(org.bukkit.event.inventory.InventoryType inventoryType, int size, boolean isDynamicSize, GUIContentsProvider contentsProvider, GUIActionListener... guiActionListeners)
-
-
Method Details
-
createNewSession
- Overrides:
createNewSessionin classGUI
-
getGUIState
Description copied from interface:SharedInventoryGUIGet the shared GUIState that is shared by all viewers of this GUI- Specified by:
getGUIStatein interfaceSharedInventoryGUI- Returns:
- The shared GUIState
-
updateContentsAndView
- Overrides:
updateContentsAndViewin classGUI
-
updateView
- Overrides:
updateViewin classGUI
-
updateContentsAndView
public void updateContentsAndView()Description copied from interface:SharedInventoryGUIRecalculates the GUIElements to show the viewers (and what their display itemstacks are) and will update what the viewers see - if anybody is viewing this GUI. If no players are viewing this GUI then this method will silently fail- Specified by:
updateContentsAndViewin interfaceSharedInventoryGUI
-
updateView
public void updateView()Description copied from interface:SharedInventoryGUIWill update what the viewers of the GUI see to match the GUI's state- Specified by:
updateViewin interfaceSharedInventoryGUI
-