Package cz.jeme.advancium
Interface CustomAdvancement
- All Superinterfaces:
Keyed,net.kyori.adventure.key.Keyed
Represents a custom advancement.
A custom advancement defines a unique milestone or task for players to achieve.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for creating and configuring instances ofCustomAdvancement. -
Method Summary
Modifier and TypeMethodDescriptionstatic CustomAdvancement.Builderadvancement(org.bukkit.NamespacedKey key) Creates a new builder for aCustomAdvancementusing the givenNamespacedKey.org.bukkit.advancement.AdvancementasBukkit()Converts this custom advancement into a BukkitAdvancementinstance.criteria()Gets theSetof criteria.display()Gets the display properties of the custom advancement.booleanChecks whether this custom advancement has aCustomAdvancementparent.booleanChecks whether this custom advancement belongs to aCustomAdvancementTab.booleanisRoot()Checks whether this custom advancement is a root advancement.parent()Gets the parentCustomAdvancement.org.bukkit.NamespacedKeyGets theNamespacedKeyof the parent advancement.org.bukkit.plugin.Pluginplugin()Gets the plugin associated with this custom advancement.org.bukkit.advancement.AdvancementProgressprogress(org.bukkit.entity.Player player) Gets theAdvancementProgressassociated with the given player.Gets theSetof criteria groups that define the requirements for advancement completion.rewards()Gets the rewards granted upon completing the advancement.tab()Gets theCustomAdvancementTabwhere this advancement is displayed.
-
Method Details
-
advancement
Creates a new builder for aCustomAdvancementusing the givenNamespacedKey.- Parameters:
key- the namespaced key of the advancement- Returns:
- the builder to configure and build the advancement
- See Also:
-
display
CustomAdvancementDisplay display()Gets the display properties of the custom advancement.- Returns:
- the advancement's display settings
- See Also:
-
rewards
CustomAdvancementRewards rewards()Gets the rewards granted upon completing the advancement.- Returns:
- the advancement's rewards
- See Also:
-
criteria
Gets theSetof criteria.Which criteria must be met to complete this advancement is defined in the
requirements().- Returns:
- an unmodifiable
Setof criteria - See Also:
-
requirements
Gets theSetof criteria groups that define the requirements for advancement completion.Some advancements require players to fulfill multiple groups of criteria, where completing any criterion within a group satisfies that group. The advancement is completed when all groups have been satisfied.
Example:
This means the advancement consists of two groups. To complete the first group, the player must obtain either theSet.of( Set.of("diamond_axe", "diamond_sword"), Set.of("iron_shovel", "iron_hoe") )"diamond_axe"or the"diamond_sword"criterion. To complete the second group, they must obtain either the"iron_shovel"or the"iron_hoe"criterion. -
progress
org.bukkit.advancement.AdvancementProgress progress(org.bukkit.entity.Player player) Gets theAdvancementProgressassociated with the given player.- Parameters:
player- the player for whom the progress is fetched- Returns:
- the player's advancement progress
- See Also:
-
tab
CustomAdvancementTab tab()Gets theCustomAdvancementTabwhere this advancement is displayed.- Returns:
- the custom advancement tab this advancement belongs to
- Throws:
UnsupportedOperationException- if this advancement does not belong to a custom tab (if this advancement was created usingCustomAdvancement.Builder.buildAndBindToBukkit(org.bukkit.advancement.Advancement, org.bukkit.plugin.Plugin))- See Also:
-
parent
CustomAdvancement parent()Gets the parentCustomAdvancement.- Returns:
- the parent advancement
- Throws:
UnsupportedOperationException- if this advancement is a root advancement or it does not have aCustomAdvancementparent- See Also:
-
parentKey
org.bukkit.NamespacedKey parentKey()Gets theNamespacedKeyof the parent advancement.- Returns:
- The parent advancement's namespaced key.
- Throws:
UnsupportedOperationException- if this advancement is a root advancement- See Also:
-
asBukkit
org.bukkit.advancement.Advancement asBukkit()Converts this custom advancement into a BukkitAdvancementinstance.- Returns:
- the corresponding Bukkit advancement
-
isRoot
boolean isRoot()Checks whether this custom advancement is a root advancement.- Returns:
trueif this advancement is a root advancement, otherwisefalse.
-
hasCustomParent
boolean hasCustomParent()Checks whether this custom advancement has aCustomAdvancementparent.- Returns:
trueif this advancement has a parent and it is aCustomAdvancement, otherwisefalse
-
hasCustomTab
boolean hasCustomTab()Checks whether this custom advancement belongs to aCustomAdvancementTab.- Returns:
- true if this advancement has a custom advancement tab, otherwise
false
-
plugin
org.bukkit.plugin.Plugin plugin()Gets the plugin associated with this custom advancement.- Returns:
- the plugin that this advancement belongs to
-