Class MenuButtons

java.lang.Object
me.tayebyassine.homestead.gui.helpers.MenuButtons

public final class MenuButtons extends Object
Provides access to menu button data and constructs ItemStack instances from the YAML configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.ItemStack
    Builds the back button from default.
    static org.bukkit.inventory.ItemStack
    getButton(String menuKey, int buttonId)
    Builds an ItemStack from a per-menu button.
    static org.bukkit.inventory.ItemStack
    getButton(String menuKey, int buttonId, Placeholder placeholder)
    Builds an ItemStack from a per-menu button with placeholders.
    static org.bukkit.inventory.ItemStack
    getButton(String menuKey, int buttonId, Placeholder placeholder, org.bukkit.OfflinePlayer playerHead)
    Builds an ItemStack from a per-menu button with placeholders and player head.
    static org.bukkit.inventory.ItemStack
    getButton(String menuKey, int buttonId, org.bukkit.OfflinePlayer playerHead)
    Builds an ItemStack from a per-menu button with a player head.
    static org.bukkit.inventory.ItemStack
    Builds an ItemStack from raw button data.
    static org.bukkit.inventory.ItemStack
    getButton(ButtonData data, Placeholder placeholder)
    Builds an ItemStack from raw button data with placeholder substitution.
    static org.bukkit.inventory.ItemStack
    getButton(ButtonData data, Placeholder placeholder, org.bukkit.OfflinePlayer playerHead)
    Builds an ItemStack from raw button data with placeholder substitution.
    static ButtonData
    getButtonData(String menuKey, int buttonId)
    Retrieves raw button data for a per-menu button.
    static org.bukkit.inventory.ItemStack
    Builds an ItemStack from a default button (e.g.
    static ButtonData
    Retrieves raw button data for a default button (e.g.
    static org.bukkit.inventory.ItemStack
    Builds the empty-slot filler from default.
    static org.bukkit.inventory.ItemStack
    getFlagButton(String menuKey, int buttonId, String flag, boolean value)
    Builds a flag toggle button using a per-menu flag button definition.
    static org.bukkit.inventory.ItemStack
    Builds the next-page button from default.
    static org.bukkit.inventory.ItemStack
    Builds the previous-page button from default.
    static String
    Wraps a message to a fixed line width, inserting newlines at word or color-code boundaries to avoid breaking formatting sequences.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getButtonData

      public static ButtonData getButtonData(String menuKey, int buttonId)
      Retrieves raw button data for a per-menu button.
      Parameters:
      menuKey - the menu configuration key
      buttonId - the button's local integer ID within that menu
      Returns:
      the button data
    • getDefaultButtonData

      public static ButtonData getDefaultButtonData(String name)
      Retrieves raw button data for a default button (e.g. "back", "prev-page").
      Parameters:
      name - the default button key (e.g. "back")
      Returns:
      the button data
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(ButtonData data)
      Builds an ItemStack from raw button data.
      Parameters:
      data - the button data
      Returns:
      the constructed item stack
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(ButtonData data, Placeholder placeholder)
      Builds an ItemStack from raw button data with placeholder substitution.
      Parameters:
      data - the button data
      placeholder - the placeholders to apply
      Returns:
      the constructed item stack
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(ButtonData data, Placeholder placeholder, org.bukkit.OfflinePlayer playerHead)
      Builds an ItemStack from raw button data with placeholder substitution.
      Parameters:
      data - the button data
      placeholder - the placeholders to apply
      playerHead - the player for PLAYERHEAD-this type
      Returns:
      the constructed item stack
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(String menuKey, int buttonId)
      Builds an ItemStack from a per-menu button.
      Parameters:
      menuKey - the menu configuration key
      buttonId - the button's local integer ID
      Returns:
      the constructed item stack
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(String menuKey, int buttonId, Placeholder placeholder)
      Builds an ItemStack from a per-menu button with placeholders.
      Parameters:
      menuKey - the menu configuration key
      buttonId - the button's local integer ID
      placeholder - the placeholders to apply
      Returns:
      the constructed item stack
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(String menuKey, int buttonId, Placeholder placeholder, org.bukkit.OfflinePlayer playerHead)
      Builds an ItemStack from a per-menu button with placeholders and player head.
      Parameters:
      menuKey - the menu configuration key
      buttonId - the button's local integer ID
      placeholder - the placeholders to apply
      playerHead - the player for PLAYERHEAD-this type
      Returns:
      the constructed item stack
    • getButton

      public static org.bukkit.inventory.ItemStack getButton(String menuKey, int buttonId, org.bukkit.OfflinePlayer playerHead)
      Builds an ItemStack from a per-menu button with a player head.
      Parameters:
      menuKey - the menu configuration key
      buttonId - the button's local integer ID
      playerHead - the player for PLAYERHEAD-this type
      Returns:
      the constructed item stack
    • getDefaultButton

      public static org.bukkit.inventory.ItemStack getDefaultButton(String name)
      Builds an ItemStack from a default button (e.g. "back", "prev-page").
      Parameters:
      name - the button key
      Returns:
      the constructed item stack
    • getFlagButton

      public static org.bukkit.inventory.ItemStack getFlagButton(String menuKey, int buttonId, String flag, boolean value)
      Builds a flag toggle button using a per-menu flag button definition.
      Parameters:
      menuKey - the menu configuration key
      buttonId - the button's local integer ID
      flag - the flag identifier
      value - the current flag value
      Returns:
      the constructed item stack
    • getBackButton

      public static org.bukkit.inventory.ItemStack getBackButton()
      Builds the back button from default.
      Returns:
      the back button item stack
    • getPreviousPageButton

      public static org.bukkit.inventory.ItemStack getPreviousPageButton()
      Builds the previous-page button from default.
      Returns:
      the previous-page button item stack
    • getNextPageButton

      public static org.bukkit.inventory.ItemStack getNextPageButton()
      Builds the next-page button from default.
      Returns:
      the next-page button item stack
    • getEmptySlot

      public static org.bukkit.inventory.ItemStack getEmptySlot()
      Builds the empty-slot filler from default.
      Returns:
      the empty-slot item stack
    • wrapMessage

      public static String wrapMessage(String message)
      Wraps a message to a fixed line width, inserting newlines at word or color-code boundaries to avoid breaking formatting sequences.
      Parameters:
      message - the raw message string
      Returns:
      the wrapped message