Class PlatformDifferentiatedGUIContentsProvider

java.lang.Object
me.eddie.inventoryguiapi.gui.contents.PlatformDifferentiatedGUIContentsProvider
All Implemented Interfaces:
GUIContentsProvider

public class PlatformDifferentiatedGUIContentsProvider extends Object implements GUIContentsProvider
Determines what contents to show viewers on each page. This class assign each platform its own GUI provider (and by extension, GUI populator). This allows for example to have a paginated view for Java player and an un-paginated view for Bedrock players, as native Bedrock forms have no size limitation.
  • Constructor Details

    • PlatformDifferentiatedGUIContentsProvider

      public PlatformDifferentiatedGUIContentsProvider()
  • Method Details

    • setJavaProvider

      public void setJavaProvider(GUIContentsProvider javaProvider)
    • setBedrockProvider

      public void setBedrockProvider(GUIContentsProvider bedrockProvider)
    • hasJavaProvider

      public boolean hasJavaProvider()
    • hasBedrockProvider

      public boolean hasBedrockProvider()
    • genContents

      public void genContents(org.bukkit.entity.Player viewer, int page, GUISession session, Callback<GUIContentsProvider.GUIContentsResponse> callback)
      Description copied from interface: GUIContentsProvider
      Calculate the GUIElements to display on this page and if another exists. Once calculated the result (a GUIContentsResponse) should be passed to the provided callback. If the callback isn't called then the GUI will not work properly.
      Specified by:
      genContents in interface GUIContentsProvider
      Parameters:
      viewer - The viewer of this inventory. In the case of a GUI with multiple viewers (SharedInventoryGUI) this will be whatever viewer caused this method to be called
      page - The page to retrieve the contents for. Page 1 is the first page.
      session - The GUISession being viewed
      callback - The callback to pass the response to. If the callback isn't called then the GUI will not work properly. Use the Callback.call(Object) method of the callback.
    • genTitle

      public void genTitle(org.bukkit.entity.Player viewer, int page, GUISession session, Callback<String> callback)
      Description copied from interface: GUIContentsProvider
      Calculate the title to display for a given page. Once calculated the result (a String) should be passed to the provided callback. If the callback isn't called then the GUI will not work properly.
      Specified by:
      genTitle in interface GUIContentsProvider
      Parameters:
      viewer - The viewer of this inventory. In the case of a GUI with multiple viewers (SharedInventoryGUI) this will be whatever viewer caused this method to be called
      page - The page to retrieve the contents for. Page 1 is the first page.
      session - The GUISession being viewed
      callback - The callback to pass the response to. If the callback isn't called then the GUI will not work properly. Use the Callback.call(Object) method of the callback.