Interface GuiItem.Builder

Enclosing interface:
GuiItem

public static interface GuiItem.Builder
Builder interface for constructing GuiItems.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull GuiItem
    Builds the GUI item based on the configured properties.
    condition(@NotNull Predicate<org.bukkit.entity.Player> condition)
    Sets a condition that determines whether this item should render for a player.
    item(@NotNull String key)
    Sets a key (namespace:id) for the GUI item.
    item(@NotNull String key, int amount)
    Sets a key (namespace:id) and amount for the GUI item.
    item(@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.
    item(@NotNull org.bukkit.inventory.ItemStack itemStack)
    Sets a static item stack for the GUI item.
    itemKey(@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.
    itemKey(@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.
    onClick(@NotNull BiConsumer<org.bukkit.entity.Player,GuiClickContext> handler)
    Sets the handler to execute when the GUI item is clicked.
  • Method Details

    • item

      @NotNull @NotNull GuiItem.Builder item(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      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

      @NotNull @NotNull GuiItem.Builder item(@NotNull @NotNull String key)
      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

      @NotNull @NotNull GuiItem.Builder item(@NotNull @NotNull String key, int amount)
      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 player
      amount - 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

      @NotNull @NotNull GuiItem build()
      Builds the GUI item based on the configured properties.
      Returns:
      the constructed GuiItem