From Minecraft Wiki
Gives or takes an advancement from a player, or tests whether a player has an advancement.
advancement <grant|revoke> <player> only <advancement> [criterion]
advancement <grant|revoke> <player> <until|from|through> <advancement>
advancement <grant|revoke> <player> everything
advancement test <player> <advancement> [criterion][until 1.13]
- Must be a player name or a target selector.
- Grants/revokes only the specified advancement from the player.
- Grants/revokes the specified advancement, its parent advancement, its parent's parent advancement, etc. from the player. From the start until the specified advancement. The exact order of granting/revoking is "parent" > "parent's parent" > ... > "start" > "specified advancement".
- Grants/revokes the specified advancement, its children advancements, its children's children advancements, etc. from the player. All the way forward from the specified advancement. The exact order of granting/revoking is "specified advancement" > "child" > "child's child", when a branch is found it will iterate through the top branch entirely before going through the other branches.
- Acts as
fromcombined; all advancements through the specified advancement, going both backwards and forwards. The exact order of granting/revoking is the same as for
untilbeing done before
- Acts as
- Grants/revokes every loaded advancement from the player.
- Specifies which advancement to grant, revoke or test. Must be a valid advancement identifier.
- criterion (optional)
- Specifies which criterion of the advancement to grant, revoke or test. Must be a valid advancement criteria identifier.
- If specified, the command will refer to merely the criterion, and not the entire advancement.
- If absent, the command will refer to the entire advancement.
- Fails if the arguments aren't specified correctly, or if player fails to resolve to one or more online players.
- On success, grants or removes the specified advancement(s) to the player(s).
- To test yourself for the "iron leggings" criterion of the "Obtain armor" advancement:
advancement test @p minecraft:story/obtain_armor iron_leggings
- To grant the "Shiny gear" advancement to yourself:
advancement grant @p only minecraft:story/shiny_gear