Class SharedGUI

java.lang.Object
me.eddie.inventoryguiapi.gui.guis.GUI
me.eddie.inventoryguiapi.gui.guis.SharedGUI
All Implemented Interfaces:
InventoryGUI, SharedInventoryGUI

public class SharedGUI extends GUI implements 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
  • 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 GUI
      size - 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 contents
      contentsProvider - The contents provider that dictates what this GUI should be showing to viewers of it
      guiPopulator - The GUIPopulator to use to position the GUIElements within the inventory to display
      guiPresenter - The GUIPresenter to use to present the computed inventory to the player
      guiActionListeners - 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

      protected GUISession createNewSession(org.bukkit.entity.Player player, int page)
      Overrides:
      createNewSession in class GUI
    • getGUIState

      public GUIState getGUIState()
      Description copied from interface: SharedInventoryGUI
      Get the shared GUIState that is shared by all viewers of this GUI
      Specified by:
      getGUIState in interface SharedInventoryGUI
      Returns:
      The shared GUIState
    • updateContentsAndView

      protected void updateContentsAndView(org.bukkit.entity.Player player, GUISession session)
      Overrides:
      updateContentsAndView in class GUI
    • updateView

      protected void updateView(org.bukkit.entity.Player player, GUISession session)
      Overrides:
      updateView in class GUI
    • updateContentsAndView

      public void updateContentsAndView()
      Description copied from interface: SharedInventoryGUI
      Recalculates 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:
      updateContentsAndView in interface SharedInventoryGUI
    • updateView

      public void updateView()
      Description copied from interface: SharedInventoryGUI
      Will update what the viewers of the GUI see to match the GUI's state
      Specified by:
      updateView in interface SharedInventoryGUI