Skip to content

Unredeemed Advancements

fren_gor edited this page Nov 22, 2021 · 10 revisions

What is an unredeemed advancement?

When an advancement is granted to a team while no one of that team is online, it becomes unreedemed.

This situation can happen, for example, if an advancement requires to make a tree grows. Since the tree can grow when everyone is offline, in this case it would become unredeemed.

A bit of background

Usually, when an advancement is granted the method Advancement#onGrant(Player player, boolean giveRewards) gets called. That will handle the granting, so it will print the announce message to everybody, send the toast notification and call Advancement#giveReward(Player player).
However, calling onGrant(...) is not possible if the player completing the advancement is offline, because the Player object is not available.
Here, unredeemed advancements comes into play.

How unredeemed advancement works

If no team members are online, when a granting occours the onGrant(...) method is not called. Instead, the advancement is set unredeemed.
This way, the advancement for that team will result granted (the current progression is equal to the maximum progression), but the onGrant(...) method has not been called yet. It will be called when a player of that team joins the server.

Note that an unredeemed advancement is automatically unset unredeemed when a player of the team joins.

Unredeemed advancements API

Clone this wiki locally