Class LimitedGUIPopulator

java.lang.Object
me.eddie.inventoryguiapi.gui.contents.LimitedGUIPopulator
All Implemented Interfaces:
GUIPopulator

public class LimitedGUIPopulator extends Object implements GUIPopulator
Responsible for Calculating the positions that GUIElements need to go into in the displayed, size-limited GUI, adding page changing buttons if necessary and then updating the current inventory state.
  • Constructor Details

    • LimitedGUIPopulator

      public LimitedGUIPopulator()
  • Method Details

    • populateGUI

      public void populateGUI(GUISession session, org.bukkit.entity.Player viewer, Callback<Void> callback)
      Gets, via GUI's contents provider, the items a player should be viewing; figures out what slots they should be displayed in within the inventory; updates the current InventoryState with this and then calls back to the callback.
      Specified by:
      populateGUI in interface GUIPopulator
      Parameters:
      session - The GUISession of the GUI being populated
      viewer - The viewer of the GUISession
      callback - Callback to be called back to on completion
    • genPrevPageButton

      public ActionItem genPrevPageButton(InventoryGUI gui, GUISession session)
      Generate a new previous page button
      Parameters:
      gui - The GUI to generate it for
      session - The Session to generate it for
      Returns:
      An ActionItem, without desired position, that when clicked will go back a page in the GUI
    • genNextPageButton

      public ActionItem genNextPageButton(InventoryGUI gui, GUISession session)
      Generate a new next page button
      Parameters:
      gui - The GUI to generate it for
      session - The Session to generate it for
      Returns:
      An ActionItem, without desired position, that when clicked will go forward a page in the GUI