Package fr.maxlego08.menu.api.button
Interface Button
- All Superinterfaces:
PerformButton,PermissibleButton,PlaceholderButton,SlotButton
- All Known Subinterfaces:
BackButton,HomeButton,InventoryButton,NextButton,NoneButton,PaginateButton,PreviousButton
The Button interface defines methods for creating customizable buttons in zMenu. Buttons are a key feature of zMenu, providing a unified way for plugins to create inventory buttons with shared configurations across the server.
For detailed information on creating a button, refer to the zMenu documentation.
-
Method Summary
Modifier and TypeMethodDescriptionbuildDisplayName(org.bukkit.entity.Player player) Builds the display name for auto-update.buildLore(org.bukkit.entity.Player player) Builds the lore for auto-update.booleanChecks if the inventory should be closed when clicking.List<fr.maxlego08.menu.api.requirement.Action>Returns the list of actions performed on clickList<fr.maxlego08.menu.api.requirement.Requirement>Gets the list of requirements made when clicking.org.bukkit.inventory.ItemStackgetCustomItemStack(org.bukkit.entity.Player player) Returns the ItemStack that will be used in the inventory with a player in parameter.List<fr.maxlego08.menu.api.requirement.data.ActionPlayerData>getData()Gets the action player data.fr.maxlego08.menu.MenuItemStackReturns the ItemStack that will be displayed.Gets the messages that the player will receive by clicking.getName()Returns the name of the button.Allows to open a link in a message.Gets the player name.intgetRealSlot(int inventorySize, int page) Allows to get the real slot of the button.intgetSlot()Returns the slot used by the button.getSound()Gets the sound that will be played when the player clicks.fr.maxlego08.menu.api.requirement.RequirementGets the requirement that will be used to display the button.booleanbooleanChecks if the button has special rendering requirements.booleanChecks if the button can be clicked.booleanChecks if the button is permanent.booleanChecks if the button should be refreshed on click.booleanChecks if the button needs to be updated.booleanvoidonBackClick(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryClickEvent event, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory, List<Inventory> oldInventories, Inventory toInventory, int slot) Performs an action when a back button is clicked.voidonClick(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryClickEvent event, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory, int slot, Placeholders placeholders) Called when the player makes a click.voidonDrag(org.bukkit.event.inventory.InventoryDragEvent event, org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault) Called when the player drags items within the inventory or from their player inventory into the zMenu inventory.voidonInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event, org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault) Called when the player clicks an item within the zMenu inventory.voidonInventoryClose(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory) Called when the player closes the inventory.voidonInventoryOpen(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory) Called when the player opens the inventory.voidonLeftClick(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryClickEvent event, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory, int slot) Called when the player makes a left click.voidonMiddleClick(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryClickEvent event, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory, int slot) Called when the player makes a middle click or a drop key click.voidonRender(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory) Allows buttons that are going to be rendered in multiple slots to be rendered correctly.voidonRightClick(org.bukkit.entity.Player player, org.bukkit.event.inventory.InventoryClickEvent event, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventory, int slot) Called when the player makes a right click.booleanChecks if the button should be updated when someone clicks on the inventory.Methods inherited from interface fr.maxlego08.menu.api.button.PerformButton
execute, getCommands, getConsoleCommands, getConsoleLeftCommands, getConsolePermission, getConsolePermissionCommands, getConsoleRightCommandsMethods inherited from interface fr.maxlego08.menu.api.button.PermissibleButton
checkPermission, getElseButton, getMasterParentButton, getOrPermission, getParentButton, getPermissions, hasElseButton, hasPermissionMethods inherited from interface fr.maxlego08.menu.api.button.PlaceholderButton
getPlaceholders, hasPlaceHolderMethods inherited from interface fr.maxlego08.menu.api.button.SlotButton
getSlots
-
Method Details
-
getName
String getName()Returns the name of the button.- Returns:
- The name of the button.
-
getItemStack
fr.maxlego08.menu.MenuItemStack getItemStack()Returns the ItemStack that will be displayed.- Returns:
- The
MenuItemStack.
-
getCustomItemStack
org.bukkit.inventory.ItemStack getCustomItemStack(org.bukkit.entity.Player player) Returns the ItemStack that will be used in the inventory with a player in parameter.- Parameters:
player- The player who opens the inventory.- Returns:
- The
ItemStack.
-
getSlot
int getSlot()Returns the slot used by the button.- Returns:
- The slot.
-
isClickable
boolean isClickable()Checks if the button can be clicked.- Returns:
- True if the button is clickable, false otherwise.
-
isPermanent
boolean isPermanent()Checks if the button is permanent. A permanent button will always be present in the inventory, regardless of the page.- Returns:
- True if the button is permanent, false otherwise.
-
hasSpecialRender
boolean hasSpecialRender()Checks if the button has special rendering requirements.- Returns:
- True if the button has special rendering, false otherwise.
-
getRealSlot
int getRealSlot(int inventorySize, int page) Allows to get the real slot of the button.- Parameters:
inventorySize- The size of the inventory.page- The current page.- Returns:
- The real slot.
-
closeInventory
boolean closeInventory()Checks if the inventory should be closed when clicking.- Returns:
- True if the inventory should be closed, false otherwise.
-
getMessages
Gets the messages that the player will receive by clicking.- Returns:
- The list of messages.
-
getSound
SoundOption getSound()Gets the sound that will be played when the player clicks.- Returns:
- The
SoundOption.
-
getPlayerHead
String getPlayerHead()Gets the player name.- Returns:
- The player name.
-
getOpenLink
OpenLink getOpenLink()Allows to open a link in a message.- Returns:
- The
OpenLink.
-
isUpdated
boolean isUpdated()Checks if the button needs to be updated.- Returns:
- True if the button needs to be updated, false otherwise.
-
isRefreshOnClick
boolean isRefreshOnClick()Checks if the button should be refreshed on click.- Returns:
- True if the button should be refreshed on click, false otherwise.
-
getData
List<fr.maxlego08.menu.api.requirement.data.ActionPlayerData> getData()Gets the action player data.- Returns:
- The list of
ActionPlayerData.
-
updateOnClick
boolean updateOnClick()Checks if the button should be updated when someone clicks on the inventory.- Returns:
- True if the button should be updated, false otherwise.
-
buildDisplayName
Builds the display name for auto-update.- Parameters:
player- The player.- Returns:
- The display name.
-
buildLore
Builds the lore for auto-update.- Parameters:
player- The player.- Returns:
- The lore.
-
getClickRequirements
List<fr.maxlego08.menu.api.requirement.Requirement> getClickRequirements()Gets the list of requirements made when clicking.- Returns:
- The list of
Requirement.
-
getViewRequirement
fr.maxlego08.menu.api.requirement.Requirement getViewRequirement()Gets the requirement that will be used to display the button.- Returns:
- The
Requirement.
-
getActions
List<fr.maxlego08.menu.api.requirement.Action> getActions()Returns the list of actions performed on click- Returns:
- actions
-
isUseCache
boolean isUseCache() -
getOptions
List<ButtonOption> getOptions() -
hasCustomRender
boolean hasCustomRender()
-