Class Menu
java.lang.Object
dev.demeng.pluginbase.menu.layout.Menu
- All Implemented Interfaces:
IMenu
A GUI menu (custom inventory) that will be displayed to a player.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddButton(int slot, @NotNull org.bukkit.inventory.ItemStack stack, @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> actions) Creates and adds a new button to the menu.voidaddButton(@NotNull org.bukkit.inventory.ItemStack stack, @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> actions) Creates and adds a new button to the menu.voidaddButton(@Nullable MenuButton button) Adds a new button to the menu.voidapplyFillersFromConfig(@NotNull org.bukkit.configuration.ConfigurationSection section) Applies all menu fillers that are declared in a configuration section.voidapplyFillersFromConfig(@NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable UnaryOperator<String> translator) Applies all menu fillers that are declared in a configuration section.voidopen(org.bukkit.entity.Player... players) Opens the menu for the provided player(s).voidsetBackground(@Nullable org.bukkit.inventory.ItemStack stack) Applies a background filler, which sets all empty slots in the menu with the dummy button.voidsetBorder(@Nullable org.bukkit.inventory.ItemStack stack) Applies a border filler, which sets all empty slots on the edges of the menu with a dummy button.voidsetColumn(int column, @Nullable org.bukkit.inventory.ItemStack stack) Applies a column filler, which sets all empty slots in a column with the dummy button.voidsetRow(int row, @Nullable org.bukkit.inventory.ItemStack stack) Applies a row filler, which sets all empty slots in a row with the dummy button.
-
Constructor Details
-
Menu
Creates a new menu with the specified size and inventory title.- Parameters:
size- The size of the menu, in slots; must be greater than or equal to 9 and less than or equal to 54, and a multiple of 9title- The menu title, colorized internally
-
-
Method Details
-
getActions
-
addButton
public void addButton(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack stack, @Nullable @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> actions) Creates and adds a new button to the menu.- Parameters:
slot- The slot of the buttonstack- The stack of the buttonactions- The actions of the button
-
addButton
public void addButton(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @Nullable @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> actions) Creates and adds a new button to the menu. The first empty slot will be used.- Parameters:
stack- The stack of the buttonactions- The actions of the button
-
setBackground
public void setBackground(@Nullable @Nullable org.bukkit.inventory.ItemStack stack) Applies a background filler, which sets all empty slots in the menu with the dummy button.- Parameters:
stack- The background material
-
setRow
public void setRow(int row, @Nullable @Nullable org.bukkit.inventory.ItemStack stack) Applies a row filler, which sets all empty slots in a row with the dummy button.- Parameters:
row- The row to fill (top to bottom)stack- The fill material
-
setColumn
public void setColumn(int column, @Nullable @Nullable org.bukkit.inventory.ItemStack stack) Applies a column filler, which sets all empty slots in a column with the dummy button.- Parameters:
column- The column to fill (left to right)stack- The fill material
-
setBorder
public void setBorder(@Nullable @Nullable org.bukkit.inventory.ItemStack stack) Applies a border filler, which sets all empty slots on the edges of the menu with a dummy button.- Parameters:
stack- The fill material
-
applyFillersFromConfig
public void applyFillersFromConfig(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section) Applies all menu fillers that are declared in a configuration section.- Parameters:
section- The configuration containing the fillers to set
-
applyFillersFromConfig
public void applyFillersFromConfig(@NotNull @NotNull org.bukkit.configuration.ConfigurationSection section, @Nullable @Nullable UnaryOperator<String> translator) Applies all menu fillers that are declared in a configuration section.- Parameters:
section- The configuration containing the fillers to settranslator- The translator for strings in the item
-
open
public void open(org.bukkit.entity.Player... players) Description copied from interface:IMenuOpens the menu for the provided player(s).
-