Interface CustomAdvancementRewards.Builder

Enclosing interface:
CustomAdvancementRewards

public static interface CustomAdvancementRewards.Builder
Builder for constructing instances of CustomAdvancementRewards.
  • Method Details

    • experience

      CustomAdvancementRewards.Builder experience(int experience)
      Sets the amount of experience granted upon completion of the advancement.
      Parameters:
      experience - the amount of experience points
      Returns:
      this builder instance for chaining
    • addRecipe

      CustomAdvancementRewards.Builder addRecipe(org.bukkit.NamespacedKey key)
      Adds a recipe reward to the advancement.
      Parameters:
      key - the NamespacedKey of the recipe
      Returns:
      this builder instance for chaining
    • addRecipe

      default <R extends org.bukkit.inventory.Recipe & org.bukkit.Keyed> CustomAdvancementRewards.Builder addRecipe(@NotNull R recipe)
      Adds a recipe reward to the advancement using a Recipe object.
      Type Parameters:
      R - the type of the recipe, which implements Recipe and Keyed
      Parameters:
      recipe - the recipe to add as a reward
      Returns:
      this builder instance for chaining
    • addRecipe

      default CustomAdvancementRewards.Builder addRecipe(@KeyPattern String key)
      Adds a recipe reward using a String key.

      The string is converted into a NamespacedKey. If the key is invalid, an exception is thrown.

      Parameters:
      key - the string representation of the recipe key
      Returns:
      this builder instance for chaining
      Throws:
      NullPointerException - if the key is invalid
    • addLootTable

      CustomAdvancementRewards.Builder addLootTable(org.bukkit.NamespacedKey key)
      Adds a loot table reward to the advancement.
      Parameters:
      key - the NamespacedKey of the loot table
      Returns:
      this builder instance for chaining
    • addLootTable

      default CustomAdvancementRewards.Builder addLootTable(org.bukkit.loot.LootTable lootTable)
      Adds a loot table reward using a LootTable object.
      Parameters:
      lootTable - the loot table to add as a reward
      Returns:
      this builder instance for chaining
    • addLootTable

      default CustomAdvancementRewards.Builder addLootTable(@KeyPattern String key)
      Adds a loot table reward using a String key.

      The string is converted into a NamespacedKey. If the key is invalid, an exception is thrown.

      Parameters:
      key - the string representation of the loot table key
      Returns:
      this builder instance for chaining
      Throws:
      NullPointerException - if the key is invalid
    • addLoot

      CustomAdvancementRewards.Builder addLoot(org.bukkit.inventory.ItemStack item)
      Adds an ItemStack to the list of loot rewards for this advancement.

      The provided ItemStack is added as a reward when this advancement is granted.

      Parameters:
      item - the ItemStack to add as loot
      Returns:
      this builder instance for chaining
    • addLoot

      default CustomAdvancementRewards.Builder addLoot(org.bukkit.Material material)
      Adds an ItemStack of the specified Material to the loot rewards.

      This is a convenience method that creates an ItemStack from the given Material and adds it as a reward.

      Parameters:
      material - the Material to create an ItemStack from
      Returns:
      this builder instance for chaining
    • addLoot

      default CustomAdvancementRewards.Builder addLoot(org.bukkit.inventory.ItemStack item, Consumer<org.bukkit.inventory.ItemStack> consumer)
      Adds an ItemStack to the loot rewards after applying modifications via a consumer.

      This method allows modifications to be applied to the ItemStack before it is added. The provided consumer can modify the item, for example, by setting enchantments, custom names, or other metadata.

      Parameters:
      item - the ItemStack to add as loot
      consumer - a Consumer that modifies the ItemStack before it is added
      Returns:
      this builder instance for chaining
    • build

      Builds and returns the configured CustomAdvancementRewards.
      Returns:
      the built rewards object