Interface CustomAdvancement.Builder
- Enclosing interface:
CustomAdvancement
CustomAdvancement.-
Method Summary
Modifier and TypeMethodDescriptionbuildAndBindTo(CustomAdvancement parent) Builds this advancement and binds it to a specifiedCustomAdvancementparent.default CustomAdvancementBuilds this advancement and binds it to the root custom advancement in a specified tab.default CustomAdvancementbuildAndBindToBukkit(String key, org.bukkit.plugin.Plugin plugin) Builds this advancement and binds it to a BukkitAdvancementusing aStringkey.default CustomAdvancementbuildAndBindToBukkit(org.bukkit.advancement.Advancement advancement, org.bukkit.plugin.Plugin plugin) Builds this advancement and binds it to a BukkitAdvancementinstance.buildAndBindToBukkit(org.bukkit.NamespacedKey key, org.bukkit.plugin.Plugin plugin) Builds this advancement and binds it to a BukkitAdvancementusing aNamespacedKey.Sets the criteria for this advancement.display(CustomAdvancementDisplay display) Sets the display properties of the advancement.default CustomAdvancement.Builderdisplay(CustomAdvancementDisplay.Builder builder) Builds the display properties for the advancement before setting them.default <T extends org.bukkit.event.Event>
CustomAdvancement.Builderon(Class<T> eventClass, BiConsumer<T, CustomAdvancement> handler) Adds an event handler for this advancement with default normal priority (EventPriority.NORMAL).<T extends org.bukkit.event.Event>
CustomAdvancement.Builderon(Class<T> eventClass, org.bukkit.event.EventPriority priority, BiConsumer<T, CustomAdvancement> handler) Adds an event handler for this advancement.requirements(Set<Set<String>> requirements) Sets the requirements for this advancement by grouping criteria.rewards(CustomAdvancementRewards rewards) Sets the rewards for the advancement.default CustomAdvancement.Builderrewards(CustomAdvancementRewards.Builder builder) Builds the rewards for the advancement before setting them.
-
Method Details
-
display
Sets the display properties of the advancement.Default:
CustomAdvancementDisplay.empty()- Parameters:
display- the display properties for the advancement- Returns:
- this builder instance for chaining
- See Also:
-
display
Builds the display properties for the advancement before setting them.Default:
CustomAdvancementDisplay.empty()- Parameters:
builder- a builder for the display settings- Returns:
- this builder instance for chaining
-
rewards
Sets the rewards for the advancement.Default:
CustomAdvancementRewards.empty()- Parameters:
rewards- the rewards for completing the advancement- Returns:
- this builder instance for chaining
- See Also:
-
rewards
Builds the rewards for the advancement before setting them.Default:
CustomAdvancementRewards.empty()- Parameters:
builder- a builder for the rewards settings- Returns:
- this builder instance for chaining
-
criteria
Sets the criteria for this advancement.This method automatically updates the requirements so that each criterion forms its own group. If this behavior is not desired, a subsequent call to
requirements(Set)should be made to override the default grouping.Default:
Set.of("dummy")- Parameters:
criteria- aSetof criteria names- Returns:
- this builder instance for chaining
-
requirements
Sets the requirements for this advancement by grouping criteria.The format and behavior of requirements are explained in detail in
CustomAdvancement.requirements(). Each inner set represents a requirement group, where completing any criterion within a group satisfies that group. The advancement is completed when all groups are satisfied.A call to this method must be made after
criteria(Set), as callingcriteria(Set)afterward will overwrite the requirements.Default:
Set.of(Set.of("dummy"))- Parameters:
requirements- a set of grouped criteria requirements- Returns:
- this builder instance for chaining
- See Also:
-
on
<T extends org.bukkit.event.Event> CustomAdvancement.Builder on(Class<T> eventClass, org.bukkit.event.EventPriority priority, BiConsumer<T, CustomAdvancement> handler) Adds an event handler for this advancement.- Type Parameters:
T- the type of the event- Parameters:
eventClass- the event class to listen topriority- the priority of the event handlerhandler- the handler executed when the event occurs- Returns:
- this builder instance for chaining
-
on
default <T extends org.bukkit.event.Event> CustomAdvancement.Builder on(Class<T> eventClass, BiConsumer<T, CustomAdvancement> handler) Adds an event handler for this advancement with default normal priority (EventPriority.NORMAL).- Type Parameters:
T- the type of the event- Parameters:
eventClass- the event class to listen tohandler- the handler executed when the event occurs- Returns:
- this builder instance for chaining
-
buildAndBindTo
Builds this advancement and binds it to a specifiedCustomAdvancementparent.- Parameters:
parent- the parent custom advancement- Returns:
- the built custom advancement
-
buildAndBindTo
Builds this advancement and binds it to the root custom advancement in a specified tab.- Parameters:
tab- theCustomAdvancementTabwhere the advancement belongs- Returns:
- the built custom advancement
-
buildAndBindToBukkit
default CustomAdvancement buildAndBindToBukkit(org.bukkit.advancement.Advancement advancement, org.bukkit.plugin.Plugin plugin) Builds this advancement and binds it to a BukkitAdvancementinstance.- Parameters:
advancement- the parent Bukkit advancementplugin- the plugin associated with the advancement- Returns:
- the built custom advancement
-
buildAndBindToBukkit
default CustomAdvancement buildAndBindToBukkit(@KeyPattern String key, org.bukkit.plugin.Plugin plugin) Builds this advancement and binds it to a BukkitAdvancementusing aStringkey.- Parameters:
key- the string key of the parent advancementplugin- the plugin associated with the advancement- Returns:
- the configured custom advancement
- Throws:
NullPointerException- if the key pattern is invalid- See Also:
-
buildAndBindToBukkit
CustomAdvancement buildAndBindToBukkit(org.bukkit.NamespacedKey key, org.bukkit.plugin.Plugin plugin) Builds this advancement and binds it to a BukkitAdvancementusing aNamespacedKey.- Parameters:
key- the key of the parent advancementplugin- the plugin associated with the advancement- Returns:
- the built custom advancement
-