Package cz.jeme.advancium
Interface CustomAdvancementRewards.Builder
- Enclosing interface:
CustomAdvancementRewards
public static interface CustomAdvancementRewards.Builder
Builder for constructing instances of
CustomAdvancementRewards.-
Method Summary
Modifier and TypeMethodDescriptionaddLoot(org.bukkit.inventory.ItemStack item) Adds anItemStackto the list of loot rewards for this advancement.default CustomAdvancementRewards.BuilderAdds anItemStackto the loot rewards after applying modifications via a consumer.default CustomAdvancementRewards.BuilderaddLoot(org.bukkit.Material material) Adds anItemStackof the specifiedMaterialto the loot rewards.default CustomAdvancementRewards.BuilderaddLootTable(String key) Adds a loot table reward using aStringkey.default CustomAdvancementRewards.BuilderaddLootTable(org.bukkit.loot.LootTable lootTable) Adds a loot table reward using aLootTableobject.addLootTable(org.bukkit.NamespacedKey key) Adds a loot table reward to the advancement.default CustomAdvancementRewards.BuilderAdds a recipe reward using aStringkey.addRecipe(org.bukkit.NamespacedKey key) Adds a recipe reward to the advancement.default <R extends org.bukkit.inventory.Recipe & org.bukkit.Keyed>
CustomAdvancementRewards.BuilderaddRecipe(R recipe) Adds a recipe reward to the advancement using aRecipeobject.build()Builds and returns the configuredCustomAdvancementRewards.experience(int experience) Sets the amount of experience granted upon completion of the advancement.
-
Method Details
-
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
Adds a recipe reward to the advancement.- Parameters:
key- theNamespacedKeyof 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 aRecipeobject.- Type Parameters:
R- the type of the recipe, which implementsRecipeandKeyed- Parameters:
recipe- the recipe to add as a reward- Returns:
- this builder instance for chaining
-
addRecipe
Adds a recipe reward using aStringkey.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
Adds a loot table reward to the advancement.- Parameters:
key- theNamespacedKeyof the loot table- Returns:
- this builder instance for chaining
-
addLootTable
Adds a loot table reward using aLootTableobject.- Parameters:
lootTable- the loot table to add as a reward- Returns:
- this builder instance for chaining
-
addLootTable
Adds a loot table reward using aStringkey.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
Adds anItemStackto the list of loot rewards for this advancement.The provided
ItemStackis added as a reward when this advancement is granted.- Parameters:
item- theItemStackto add as loot- Returns:
- this builder instance for chaining
-
addLoot
Adds anItemStackof the specifiedMaterialto the loot rewards.This is a convenience method that creates an
ItemStackfrom the givenMaterialand adds it as a reward.- Parameters:
material- theMaterialto create anItemStackfrom- Returns:
- this builder instance for chaining
-
addLoot
default CustomAdvancementRewards.Builder addLoot(org.bukkit.inventory.ItemStack item, Consumer<org.bukkit.inventory.ItemStack> consumer) Adds anItemStackto the loot rewards after applying modifications via a consumer.This method allows modifications to be applied to the
ItemStackbefore it is added. The providedconsumercan modify the item, for example, by setting enchantments, custom names, or other metadata.- Parameters:
item- theItemStackto add as lootconsumer- aConsumerthat modifies theItemStackbefore it is added- Returns:
- this builder instance for chaining
-
build
CustomAdvancementRewards build()Builds and returns the configuredCustomAdvancementRewards.- Returns:
- the built rewards object
-