Package org.yuemi.libs.api.gui
Interface GuiItem.Builder
- Enclosing interface:
GuiItem
public static interface GuiItem.Builder
Builder interface for constructing GuiItems.
-
Method Summary
Modifier and TypeMethodDescription@NotNull GuiItembuild()Builds the GUI item based on the configured properties.@NotNull GuiItem.BuilderSets a condition that determines whether this item should render for a player.@NotNull GuiItem.BuilderSets a key (namespace:id) for the GUI item.@NotNull GuiItem.BuilderSets a key (namespace:id) and amount for the GUI item.@NotNull GuiItem.BuilderSets a dynamic item provider function to resolve the item stack for a player.@NotNull GuiItem.Builderitem(@NotNull org.bukkit.inventory.ItemStack itemStack) Sets a static item stack for the GUI item.@NotNull GuiItem.BuilderSets a dynamic item key provider function to resolve the item key (namespace:id) for a player.@NotNull GuiItem.BuilderSets a dynamic item key provider function and a static amount to resolve the item for a player.@NotNull GuiItem.BuilderonClick(@NotNull BiConsumer<org.bukkit.entity.Player, GuiClickContext> handler) Sets the handler to execute when the GUI item is clicked.
-
Method Details
-
item
Sets a static item stack for the GUI item.- Parameters:
itemStack- the item stack to display- Returns:
- this builder instance for chaining
-
item
@NotNull @NotNull GuiItem.Builder item(@NotNull @NotNull Function<org.bukkit.entity.Player, org.bukkit.inventory.ItemStack> itemProvider) Sets a dynamic item provider function to resolve the item stack for a player.- Parameters:
itemProvider- the function to compute the item stack based on the player- Returns:
- this builder instance for chaining
-
item
Sets a key (namespace:id) for the GUI item. The item stack will be retrieved from the Items module API.- Parameters:
key- the namespace:id item key (e.g. "minecraft:diamond_sword")- Returns:
- this builder instance for chaining
-
item
Sets a key (namespace:id) and amount for the GUI item. The item stack will be retrieved from the Items module API.- Parameters:
key- the namespace:id item key (e.g. "minecraft:diamond_sword")amount- the item quantity- Returns:
- this builder instance for chaining
-
itemKey
@NotNull @NotNull GuiItem.Builder itemKey(@NotNull @NotNull Function<org.bukkit.entity.Player, String> keyProvider) Sets a dynamic item key provider function to resolve the item key (namespace:id) for a player. The resolved key will be retrieved from the Items module API.- Parameters:
keyProvider- the function to compute the item key based on the player- Returns:
- this builder instance for chaining
-
itemKey
@NotNull @NotNull GuiItem.Builder itemKey(@NotNull @NotNull Function<org.bukkit.entity.Player, String> keyProvider, int amount) Sets a dynamic item key provider function and a static amount to resolve the item for a player. The resolved key will be retrieved from the Items module API.- Parameters:
keyProvider- the function to compute the item key based on the playeramount- the item quantity- Returns:
- this builder instance for chaining
-
condition
@NotNull @NotNull GuiItem.Builder condition(@NotNull @NotNull Predicate<org.bukkit.entity.Player> condition) Sets a condition that determines whether this item should render for a player.- Parameters:
condition- the condition predicate- Returns:
- this builder instance for chaining
-
onClick
@NotNull @NotNull GuiItem.Builder onClick(@NotNull @NotNull BiConsumer<org.bukkit.entity.Player, GuiClickContext> handler) Sets the handler to execute when the GUI item is clicked.- Parameters:
handler- the click interaction handler- Returns:
- this builder instance for chaining
-
build
Builds the GUI item based on the configured properties.- Returns:
- the constructed GuiItem
-