Interface ShopLayoutHandler.OpenEvent

Enclosing interface:
ShopLayoutHandler

public static interface ShopLayoutHandler.OpenEvent
Used to pass information to ShopLayoutHandler.build(OpenEvent)
  • Method Summary

    Modifier and Type
    Method
    Description
    Builds a GUIItem that can be used to set the item inside the GUI
    default GUIItem
    Builds a GUIItem that can be used to set the page inside the GUI.
    Also resets the current data back to null once pressed
    build(ShopPage page, Object data)
    Builds a GUIItem that can be used to set the page inside the GUI
    Builds a GUIItem that will flush any info about the info on click.
    This behavior is similar to as if the player is closing and reopening the shop
    Builds a GUIItem that can be used to set the page inside the villager GUI
    @Nullable Arena
    Returns the arena the player is a part of.
    The default value is null
    <T> T
    getData(T def)
    Returns data that can be used during the session
    Deprecated.
    Use getSituationalGUITitle() instead to respect the user's configurations
    Returns the layout that has been opened
    @Nullable ShopPage
    The currently open page
    Can be null when there's no page open
    List<? extends ShopItem>
    All items that should be displayed to the player
    The available pages with which the handler has to work with
    The collections and EVERYTHING in the collection has been cloned,
    meaning the handler can do anything with it that he wants
    Returns the player that opened it
    Returns the already loaded and ready to use player properties instance of the player
    Returns what shall be shown in this given sitation.
    boolean
    Returns whether the title of the GUI should be the same as the shop page.
    void
    Will reopen the current GUI
    void
    setOpenPage(@Nullable ShopPage page)
    Sets the new open page.
    Won't reopen the GUI when set
  • Method Details

    • getLayout

      ShopLayout getLayout()
      Returns the layout that has been opened
      Returns:
      The layout
    • getPlayer

      Player getPlayer()
      Returns the player that opened it
      Returns:
      The player
    • getArena

      @Nullable @Nullable Arena getArena()
      Returns the arena the player is a part of.
      Returns:
      The arena of the player. May be null of he's in none
    • getPlayerProperties

      PlayerProperties getPlayerProperties()
      Returns the already loaded and ready to use player properties instance of the player
      Returns:
      The PlayerProperties instance of the given player
    • getDefaultGUITitle

      @Deprecated String getDefaultGUITitle()
      Deprecated.
      Use getSituationalGUITitle() instead to respect the user's configurations
      Returns the default title that shall be used in the GUI
      Returns:
      The title that shall be used in the GUI
    • getSituationalGUITitle

      String getSituationalGUITitle()
      Returns what shall be shown in this given sitation.

      The exact value depends on the plugin configuration.
      Factors include e.g.: Whether isGUITitleAsShopPage() should be conisdered and what messages have been configured.

      The plugin does not automatically apply it. Make sure to apply it after setting the shop page.

      Returns:
      The title that shall be used in the GUI
    • isGUITitleAsShopPage

      boolean isGUITitleAsShopPage()
      Returns whether the title of the GUI should be the same as the shop page.

      Whether this feature is active depends on the plugin configuration.
      The plugin will handle this automatically. One edge case is when you have custom pages (e.g. quick buy): In this case you should check if this feature is enabled and set it yourself.

      Returns:
      Whether the title of the GUI should be the same as the shop page
    • getPages

      List<ShopPage> getPages()
      The available pages with which the handler has to work with
      The collections and EVERYTHING in the collection has been cloned,
      meaning the handler can do anything with it that he wants
      Returns:
      The available pages
    • getOpenPage

      @Nullable @Nullable ShopPage getOpenPage()
      The currently open page
      Can be null when there's no page open
      Returns:
      The currently open page
    • setOpenPage

      void setOpenPage(@Nullable @Nullable ShopPage page)
      Sets the new open page.
      Won't reopen the GUI when set
      Parameters:
      page - The new open page, can be null
    • getPageItems

      List<? extends ShopItem> getPageItems()
      All items that should be displayed to the player
      Returns:
      all items that will be displayed
    • getData

      Object getData()
      The default value is null
      Returns:
      Data that can be passed around
    • getData

      <T> T getData(T def)
      Returns data that can be used during the session
      Type Parameters:
      T - (Unsafe operation:) Automatically casts the intern data object to the given generic
      Parameters:
      def - The default value which will be taken if none is set
      Returns:
      Data that can be passed around
    • refresh

      void refresh()
      Will reopen the current GUI
    • build

      GUIItem build(ShopItem item)
      Builds a GUIItem that can be used to set the item inside the GUI
      Parameters:
      item - The item that shall be displayed
      Returns:
      The item that shall be placed inside the GUI
    • build

      default GUIItem build(ShopPage page)
      Builds a GUIItem that can be used to set the page inside the GUI.
      Also resets the current data back to null once pressed
      Parameters:
      page - The page that shall be displayed
      Returns:
      The item that shall be placed inside the GUI
    • build

      GUIItem build(ShopPage page, Object data)
      Builds a GUIItem that can be used to set the page inside the GUI
      Parameters:
      page - The page that shall be displayed
      data - The new data that will be taken after pressing on the page
      Returns:
      The item that shall be placed inside the GUI
    • buildOffer

      VillagerOffer buildOffer(ShopItem item)
      Builds a GUIItem that can be used to set the page inside the villager GUI
      Parameters:
      item - The item that shall be displayed
      Returns:
      The item that shall be placed inside the GUI
    • buildHome

      GUIItem buildHome(ItemStack is)
      Builds a GUIItem that will flush any info about the info on click.
      This behavior is similar to as if the player is closing and reopening the shop
      Parameters:
      is - The item that shall be presented as the button
      Returns:
      The item that shall be placed inside the GUI