Commands/experience

From Minecraft Wiki
< Commands(Redirected from Commands/xp)
Jump to: navigation, search
experience
Aliases
Restrictions

Operator

First introduced

Java Edition 1.3.1 (Java Edition 12w16a)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Adds experience to a player.

Syntax[edit]

  • Java Edition
experience add <players> <amount> [points|levels]
experience set <players> <amount> [points|levels]
experience query <player> <points|levels>
  • Bedrock Edition
xp <amount: int> [player: target]
xp <amount: int>L [player: target]

Arguments[edit]

amount (BE: amount: int)
Specifies the amount of experience to give to the player. This amount may represent either an amount of points or an amount of levels.
If an L is added to the end, adds levels instead‌[Bedrock Edition only].
If the amount is expressed in points, it must be between 0 and 2,147,483,647 (inclusive, without the commas).
If the amount is expressed in levels, it must be between -2,147,483,648 and 2,147,483,647 (inclusive, without the commas).
Negative values remove experience instead of adding them.
player (BE: player: target) (optional)
Specifies the target of the command. If not specified, defaults to the command's executor. Not optional in command blocks.

Result[edit]

Fails if arguments are not specified correctly, or if player fails to resolve to one or more online players.
On success, adds experience or adds/removes levels. Total experience and levels will not be reduced below 0.

Examples[edit]

To display Steve's current level: experience query Steve levels
To give 7 experience to yourself: xp 7 or experience add @s 7
To give 3 levels to Alice: xp 3L Alice or xp add Alice 3 levels
To remove all levels from all players: xp -2147483648L @a or xp set @a 0 + xp set @a 0 levels

History[edit]

Java Edition
1.3.112w16aAdded /xp.
Pocket Edition Alpha
0.16.0build 1Added /xp.