Class PlayerPageBuilder

java.lang.Object
net.tnemc.menu.core.builder.PlayerPageBuilder

public class PlayerPageBuilder extends Object
Builder class for creating instances of the PlayerInstancePage class.
Since:
1.6.0.0
Author:
creatorfromhell
See Also:
  • Field Details

  • Constructor Details

    • PlayerPageBuilder

      public PlayerPageBuilder(int pageNumber)
  • Method Details

    • withRow

      public PlayerPageBuilder withRow(UUID player, int row, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified row for a player.
      Parameters:
      player - The UUID of the player.
      row - The row index where the icons will be set. Rows are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified row.
    • withRow

      public PlayerPageBuilder withRow(UUID player, int row, int startingColumn, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified row for a player.
      Parameters:
      player - The UUID of the player.
      row - The row index where the icons will be set. Rows are indexed starting from 1.
      startingColumn - The column to start applying the icons on, inclusive.
      iconBuilder - The IconBuilder used to construct the icons for the specified row.
    • withRow

      public PlayerPageBuilder withRow(UUID player, int row, int startingColumn, int endingColumn, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified row for a player.
      Parameters:
      player - The UUID of the player.
      row - The row index where the icons will be set. Rows are indexed starting from 1.
      startingColumn - The column to start applying the icons on, inclusive.
      endingColumn - The column to stop applying the icons on, inclusive.
      iconBuilder - The IconBuilder used to construct the icons for the specified row.
    • withColumn

      public PlayerPageBuilder withColumn(UUID player, int menuRows, int column, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified column for a player.
      Parameters:
      player - The UUID of the player.
      menuRows - The number of rows that the menu has.
      column - The column index where the icons will be set. Columns are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified column.
    • withColumn

      public PlayerPageBuilder withColumn(UUID player, int menuRows, int startingRow, int column, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified column for a player.
      Parameters:
      player - The UUID of the player.
      menuRows - The number of rows that the menu has.
      startingRow - The row that the icons should start at, inclusive.
      column - The column index where the icons will be set. Columns are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified column.
    • withColumn

      public PlayerPageBuilder withColumn(UUID player, int menuRows, int startingRow, int endingRow, int column, IconBuilder iconBuilder)
      Adds the specified IconBuilder to the specified column for a player.
      Parameters:
      player - The UUID of the player.
      menuRows - The number of rows that the menu has.
      startingRow - The row that the icons should start at, inclusive.
      endingRow - The row that the icons should end at, inclusive.
      column - The column index where the icons will be set. Columns are indexed starting from 1.
      iconBuilder - The IconBuilder used to construct the icons for the specified column.
    • withIcons

      public PlayerPageBuilder withIcons(UUID player, Icon... icons)
      Adds icons to the page for a player.
      Parameters:
      player - The UUID of the player.
      icons - The icons to be added to the page.
      Returns:
      This PlayerPageBuilder instance for method chaining.
    • withClickHandler

      public PlayerPageBuilder withClickHandler(Function<MenuClickHandler,Boolean> clickHandler)
      Sets the click handler for the page.
      Parameters:
      clickHandler - The click handler to be set for the page.
      Returns:
      This PlayerPageBuilder instance for method chaining.
    • withOpenHandler

      public PlayerPageBuilder withOpenHandler(Consumer<PageOpenCallback> open)
      Sets the open handler for the page.
      Parameters:
      open - The open handler to be set for the page.
      Returns:
      This PlayerPageBuilder instance for method chaining.
    • build

      public PlayerInstancePage build()
      Builds and returns the PlayerInstancePage instance based on the provided configuration.
      Returns:
      The constructed PlayerInstancePage instance.
    • getPlayerIcons

      private Map<Integer,Icon> getPlayerIcons(UUID player)
      Retrieves the icons for a given player.
      Parameters:
      player - The UUID of the player.
      Returns:
      A map of icon slots to Icon objects.