Class MenuButtons
java.lang.Object
me.tayebyassine.homestead.gui.helpers.MenuButtons
Provides access to menu button data and constructs
ItemStack instances from
the YAML configuration.-
Method Summary
Modifier and TypeMethodDescriptionstatic org.bukkit.inventory.ItemStackBuilds the back button from default.static org.bukkit.inventory.ItemStackBuilds anItemStackfrom a per-menu button.static org.bukkit.inventory.ItemStackgetButton(String menuKey, int buttonId, Placeholder placeholder) Builds anItemStackfrom a per-menu button with placeholders.static org.bukkit.inventory.ItemStackgetButton(String menuKey, int buttonId, Placeholder placeholder, org.bukkit.OfflinePlayer playerHead) Builds anItemStackfrom a per-menu button with placeholders and player head.static org.bukkit.inventory.ItemStackBuilds anItemStackfrom a per-menu button with a player head.static org.bukkit.inventory.ItemStackgetButton(ButtonData data) Builds anItemStackfrom raw button data.static org.bukkit.inventory.ItemStackgetButton(ButtonData data, Placeholder placeholder) Builds anItemStackfrom raw button data with placeholder substitution.static org.bukkit.inventory.ItemStackgetButton(ButtonData data, Placeholder placeholder, org.bukkit.OfflinePlayer playerHead) Builds anItemStackfrom raw button data with placeholder substitution.static ButtonDatagetButtonData(String menuKey, int buttonId) Retrieves raw button data for a per-menu button.static org.bukkit.inventory.ItemStackgetDefaultButton(String name) Builds anItemStackfrom a default button (e.g.static ButtonDatagetDefaultButtonData(String name) Retrieves raw button data for a default button (e.g.static org.bukkit.inventory.ItemStackBuilds the empty-slot filler from default.static org.bukkit.inventory.ItemStackgetFlagButton(String menuKey, int buttonId, String flag, boolean value) Builds a flag toggle button using a per-menu flag button definition.static org.bukkit.inventory.ItemStackBuilds the next-page button from default.static org.bukkit.inventory.ItemStackBuilds the previous-page button from default.static StringwrapMessage(String message) Wraps a message to a fixed line width, inserting newlines at word or color-code boundaries to avoid breaking formatting sequences.
-
Method Details
-
getButtonData
Retrieves raw button data for a per-menu button.- Parameters:
menuKey- the menu configuration keybuttonId- the button's local integer ID within that menu- Returns:
- the button data
-
getDefaultButtonData
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
Builds anItemStackfrom raw button data.- Parameters:
data- the button data- Returns:
- the constructed item stack
-
getButton
Builds anItemStackfrom raw button data with placeholder substitution.- Parameters:
data- the button dataplaceholder- 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 anItemStackfrom raw button data with placeholder substitution.- Parameters:
data- the button dataplaceholder- the placeholders to applyplayerHead- the player forPLAYERHEAD-thistype- Returns:
- the constructed item stack
-
getButton
Builds anItemStackfrom a per-menu button.- Parameters:
menuKey- the menu configuration keybuttonId- 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 anItemStackfrom a per-menu button with placeholders.- Parameters:
menuKey- the menu configuration keybuttonId- the button's local integer IDplaceholder- 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 anItemStackfrom a per-menu button with placeholders and player head.- Parameters:
menuKey- the menu configuration keybuttonId- the button's local integer IDplaceholder- the placeholders to applyplayerHead- the player forPLAYERHEAD-thistype- Returns:
- the constructed item stack
-
getButton
public static org.bukkit.inventory.ItemStack getButton(String menuKey, int buttonId, org.bukkit.OfflinePlayer playerHead) Builds anItemStackfrom a per-menu button with a player head.- Parameters:
menuKey- the menu configuration keybuttonId- the button's local integer IDplayerHead- the player forPLAYERHEAD-thistype- Returns:
- the constructed item stack
-
getDefaultButton
Builds anItemStackfrom 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 keybuttonId- the button's local integer IDflag- the flag identifiervalue- 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
-