Package de.clickism.clickgui.menu
Class Button
java.lang.Object
de.clickism.clickgui.menu.Button
Represents a button in a menu.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an enchantment glint to this button's icon.addLoreLine(String line) Adds a line to the lore of this button's icon.applyToMeta(Consumer<org.bukkit.inventory.meta.ItemMeta> consumer) Applies the consumer to the meta of this button's icon.static Buttonempty()Creates a button with an empty icon.getIcon()Gets the icon of this button.protected voidhandleClick(org.bukkit.event.inventory.InventoryClickEvent event, MenuView view) Handles the click event for this button.Hides all attributes of this button's icon.Hides the attributes of this button's icon.Hides the potion effects of this button's icon.Runs the consumer on this button if the condition is true.Sets the lore of this button's icon.Sets the lore of this button's icon.setMaterial(org.bukkit.Material material) Sets the material of this button's icon.Marks this button as movable, allowing it to be moved and removed from the inventory.Sets the name of this button's icon.setOnClick(ClickAction action) Sets the action to perform when this button is clicked.setOnClick(Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer) Sets the action to perform when this button is clicked.static ButtonCreates a button with the specified icon.static ButtonCreates a button with the specified icon supplier.static ButtonwithIcon(org.bukkit.inventory.ItemStack item) Creates a button with the specified item stack as the icon.static ButtonwithIcon(org.bukkit.Material material) Creates a button with the specified material as the icon.
-
Field Details
-
icon
The icon of this button. -
immovable
protected boolean immovableWhether this button is immovable. -
onClick
The action to perform when this button is clicked.
-
-
Constructor Details
-
Method Details
-
getIcon
Gets the icon of this button.- Returns:
- the icon
-
setName
Sets the name of this button's icon. SeeIcon.setName(String).- Parameters:
name- the name- Returns:
- this button
-
setMaterial
Sets the material of this button's icon. SeeIcon.setMaterial(Material).- Parameters:
material- the material- Returns:
- this button
-
hideAttributes
Hides the attributes of this button's icon. SeeIcon.hideAttributes().- Returns:
- this button
-
hidePotionEffects
Hides the potion effects of this button's icon. SeeIcon.hidePotionEffects().- Returns:
- this button
-
hideAllAttributes
Hides all attributes of this button's icon. SeeIcon.hideAllAttributes().- Returns:
- this button
-
addEnchantmentGlint
Adds an enchantment glint to this button's icon. SeeIcon.addEnchantmentGlint().- Returns:
- this button
-
setLore
Sets the lore of this button's icon. SeeIcon.setLore(List).- Parameters:
lore- the lore- Returns:
- this button
-
setLore
Sets the lore of this button's icon. SeeIcon.setLore(List).- Parameters:
lore- the lore- Returns:
- this button
-
addLoreLine
Adds a line to the lore of this button's icon. SeeIcon.addLoreLine(String).- Parameters:
line- the line- Returns:
- this button
-
runIf
Runs the consumer on this button if the condition is true.- Parameters:
condition- the conditionconsumer- the consumer- Returns:
- this button
-
setOnClick
Sets the action to perform when this button is clicked.- Parameters:
eventConsumer- the action- Returns:
- this button
-
setMovable
Marks this button as movable, allowing it to be moved and removed from the inventory.- Returns:
- this button
-
applyToMeta
Applies the consumer to the meta of this button's icon. SeeIcon.applyToMeta(Consumer).- Parameters:
consumer- the consumer- Returns:
- this button
-
empty
Creates a button with an empty icon.- Returns:
- the button
-
withIcon
Creates a button with the specified item stack as the icon.- Parameters:
item- the item stack- Returns:
- the button
-
withIcon
Creates a button with the specified material as the icon.- Parameters:
material- the material- Returns:
- the button
-
withIcon
Creates a button with the specified icon supplier.- Parameters:
iconSupplier- the icon supplier- Returns:
- the button