Package net.staticstudios.menus.button
Class MutableButton
java.lang.Object
net.staticstudios.menus.button.MutableButton
- All Implemented Interfaces:
Button
Represents a button which can be modified after its creation
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.staticstudios.menus.button.Button
Button.Action, Button.Placeholder -
Field Summary
Fields inherited from interface net.staticstudios.menus.button.Button
BACK, EMPTY, NEXT_PAGE, PREVIOUS_PAGE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMutableButton(org.bukkit.inventory.ItemStack source, Map<Button.Action, List<ButtonAction>> actions) Create a new mutable button -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(Button.Action action, ButtonAction buttonAction) Add an action to the buttonvoidClear all actions of the buttonvoidclearActions(Button.Action action) Clear all actions of the button for a specific action (type)voideditDescription(@NotNull Function<List<net.kyori.adventure.text.Component>, List<net.kyori.adventure.text.Component>> descriptionEditor) Edit the description of the buttonvoidEdit the description of the button.voideditName(@NotNull Function<net.kyori.adventure.text.Component, net.kyori.adventure.text.Component> nameEditor) Edit the name of the buttonvoideditNameAsString(@NotNull Function<String, String> nameEditor) Edit the name of the button.@Nullable org.bukkit.inventory.ItemStackgetItemRepresentation(MenuViewer viewer, Menu menu) Get the item representation of the button.voidinvokeActions(@NotNull Button.Action action, @NotNull Menu menu, @NotNull MenuViewer viewer) Invoke the actions of the buttonvoidsetActions(Button.Action action, List<ButtonAction> buttonActions) Set the actions of the buttonvoidsetCount(int count) Set the count of the buttonvoidsetDescription(String... description) Set the description of the buttonvoidsetDescription(List<String> description) Set the description of the buttonvoidsetDescription(net.kyori.adventure.text.Component... description) Set the description of the buttonvoidSet the name of the buttonvoidsetName(net.kyori.adventure.text.Component name) Set the name of the button
-
Constructor Details
-
MutableButton
protected MutableButton(org.bukkit.inventory.ItemStack source, Map<Button.Action, List<ButtonAction>> actions) Create a new mutable button- Parameters:
source- the source item stackactions- the actions
-
-
Method Details
-
setName
Set the name of the button- Parameters:
name- the name
-
setName
public void setName(net.kyori.adventure.text.Component name) Set the name of the button- Parameters:
name- the name
-
editName
public void editName(@NotNull @NotNull Function<net.kyori.adventure.text.Component, net.kyori.adventure.text.Component> nameEditor) Edit the name of the button- Parameters:
nameEditor- the name editor
-
editNameAsString
Edit the name of the button. Note that this method will serialize the name to a string and then deserialize it back to a component- Parameters:
nameEditor- the name editor
-
setDescription
Set the description of the button- Parameters:
description- the description
-
setDescription
Set the description of the button- Parameters:
description- the description
-
setDescription
public void setDescription(net.kyori.adventure.text.Component... description) Set the description of the button- Parameters:
description- the description
-
editDescription
public void editDescription(@NotNull @NotNull Function<List<net.kyori.adventure.text.Component>, List<net.kyori.adventure.text.Component>> descriptionEditor) Edit the description of the button- Parameters:
descriptionEditor- the description editor
-
editDescriptionAsStrings
public void editDescriptionAsStrings(@NotNull @NotNull Function<List<String>, List<String>> descriptionEditor) Edit the description of the button. Note that this method will serialize the lore to strings and then deserialize them back to components- Parameters:
descriptionEditor- the description editor
-
setCount
public void setCount(int count) Set the count of the button- Parameters:
count- the count
-
clearActions
public void clearActions()Clear all actions of the button
-