Class InventoryButton
java.lang.Object
io.github.lucfr1746.llibrary.inventory.InventoryButton
- All Implemented Interfaces:
Cloneable
Represents a button in a custom inventory system.
This button can have a dynamic icon, handle click events, and have visibility requirements.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Sets the consumer that handles inventory click events.Sets the function that generates the button's icon.Consumer
<org.bukkit.event.inventory.InventoryClickEvent> Gets the consumer that handles inventory click events.Function
<org.bukkit.entity.Player, org.bukkit.inventory.ItemStack> Gets the function that generates the button's icon.getId()
Gets the identifier of the button.int
Gets the priority of the button.Gets the list of requirements that determine whether the button is visible.Sets the identifier for the button.priority
(int priority) Sets the priority of the button, which may be used for sorting.viewRequirements
(List<Requirement> requirements) Sets the list of requirements that determine whether the button is visible.
-
Constructor Details
-
InventoryButton
public InventoryButton()
-
-
Method Details
-
creator
public InventoryButton creator(Function<org.bukkit.entity.Player, org.bukkit.inventory.ItemStack> iconCreator) Sets the function that generates the button's icon.- Parameters:
iconCreator
- A function that takes a Player and returns an ItemStack.- Returns:
- The current InventoryButton instance.
-
consumer
public InventoryButton consumer(Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer) Sets the consumer that handles inventory click events.- Parameters:
eventConsumer
- A consumer that processes InventoryClickEvent.- Returns:
- The current InventoryButton instance.
-
id
Sets the identifier for the button.- Parameters:
id
- A unique string identifier.- Returns:
- The current InventoryButton instance.
-
priority
Sets the priority of the button, which may be used for sorting.- Parameters:
priority
- An integer representing the button's priority.- Returns:
- The current InventoryButton instance.
-
viewRequirements
Sets the list of requirements that determine whether the button is visible.- Parameters:
requirements
- A list of Requirement objects.- Returns:
- The current InventoryButton instance.
-
getIconCreator
Gets the function that generates the button's icon.- Returns:
- A function that takes a Player and returns an ItemStack.
-
getEventConsumer
Gets the consumer that handles inventory click events.- Returns:
- A consumer that processes InventoryClickEvent.
-
getId
Gets the identifier of the button.- Returns:
- A unique string identifier.
-
getPriority
public int getPriority()Gets the priority of the button.- Returns:
- An integer representing the button's priority.
-
clone
-
getViewRequirements
Gets the list of requirements that determine whether the button is visible.- Returns:
- A list of Requirement objects.
-