Class Advancement
java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.Advancement
Represents a custom advancement within the AbyssalLib framework.
This class handles the serialization, NMS conversion, and evaluation logic
for player-driven progress and achievements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creating Advancement instances. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<Advancement> The codec responsible for serializing and deserializing advancements. -
Constructor Summary
ConstructorsConstructorDescriptionAdvancement(net.kyori.adventure.key.Key id, net.kyori.adventure.key.Key parent, AdvancementDisplay display, Map<String, AdvancementCriterion> criteria, List<AdvancementReward> rewards) Constructs a new Advancement. -
Method Summary
Modifier and TypeMethodDescriptionstatic Advancement.Builderbuilder(net.kyori.adventure.key.Key id) Creates a new builder for an Advancement.voidevaluate(org.bukkit.entity.Player player) Evaluates all criteria for a player without a specific event.voidevaluate(org.bukkit.entity.Player player, org.bukkit.event.Event event) Evaluates criteria for a player, optionally filtered by a triggering event.net.kyori.adventure.key.KeygetId()net.kyori.adventure.key.KeygetProgress(org.bukkit.entity.Player player) Retrieves the progress of a specific player toward this advancement.static Advancementresolve(org.bukkit.advancement.Advancement bukkitAdvancement) Resolves a Bukkit advancement to its custom counterpart.net.minecraft.advancements.AdvancementtoNMS()Converts this instance to a Minecraft NMS Advancement.net.minecraft.advancements.AdvancementHolderWraps the NMS advancement into a Holder.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing advancements. Supports nested criteria, rewards, and display information.
-
-
Constructor Details
-
Advancement
public Advancement(net.kyori.adventure.key.Key id, net.kyori.adventure.key.Key parent, AdvancementDisplay display, Map<String, AdvancementCriterion> criteria, List<AdvancementReward> rewards) Constructs a new Advancement.- Parameters:
id- The unique identifier.parent- The parent identifier (nullable).display- The display info (nullable).criteria- The criteria map.rewards- The rewards list.
-
-
Method Details
-
resolve
Resolves a Bukkit advancement to its custom counterpart.- Parameters:
bukkitAdvancement- The Bukkit advancement to resolve.- Returns:
- The custom Advancement, or null if not registered.
-
getProgress
Retrieves the progress of a specific player toward this advancement.- Parameters:
player- The player to check.- Returns:
- The progress wrapper, or null if the advancement is not loaded.
-
getId
public net.kyori.adventure.key.Key getId()- Returns:
- The unique identifier Key.
-
getParent
public net.kyori.adventure.key.Key getParent()- Returns:
- The parent identifier Key.
-
getDisplay
- Returns:
- The display configuration.
-
getCriteria
- Returns:
- The map of criteria.
-
getRewards
- Returns:
- The list of rewards.
-
evaluate
public void evaluate(org.bukkit.entity.Player player) Evaluates all criteria for a player without a specific event.- Parameters:
player- The player to evaluate.
-
evaluate
public void evaluate(org.bukkit.entity.Player player, org.bukkit.event.Event event) Evaluates criteria for a player, optionally filtered by a triggering event.- Parameters:
player- The player to evaluate.event- The triggering event, or null for general evaluation.
-
toNMS
public net.minecraft.advancements.Advancement toNMS()Converts this instance to a Minecraft NMS Advancement.- Returns:
- The NMS Advancement instance.
-
toNMSHolder
public net.minecraft.advancements.AdvancementHolder toNMSHolder()Wraps the NMS advancement into a Holder.- Returns:
- The AdvancementHolder instance.
-
builder
Creates a new builder for an Advancement.- Parameters:
id- The identifier for the advancement.- Returns:
- A new Builder instance.
-