/xp

/xp
Aliases
  • /experience
Permission level
required
  • 2 ‌
  • 1 ‌
Restrictions

Cheat only‌

Adds, removes or queries player experience.

Syntax

  • Java Edition
experience add <targets> <amount> [levels|points]
xp add <targets> <amount> [levels|points]
  • Increases or decreases experience amount or experience level.
    • If experience amount, it is counted into the player's Score.
    • If experience level, it is not counted into the player's score. The amount of experience points in the current experience bar is scaled proportionally, keeping the progress of experience bar unchanged.
experience set <targets> <amount> [levels|points]
xp set <targets> <amount> [levels|points]
  • Setting experience amount or experience level. Does not change the player's score.
    • If setting experience amount, the experience level is not changed. If the specified amount is greater than or equal to the remaining capacity of a player's current experience bar, the setting does not work for the player.
    • If setting experience level, the amount of experience points in the current experience bar is scaled proportionally, keeping the progress of experience bar unchanged.
experience query <targets> (levels|points)
xp query <targets> (levels|points)
  • Queries experience level or the experience amount in the current experience bar.
  • Bedrock Edition
xp <amount: int> [player: target]
  • Increases experience amount.
xp <amount: int>L [player: target]
  • Increases or decreases experience level. The amount of experience points in the current experience bar is scaled proportionally, keeping the progress of experience bar unchanged.

Arguments

JE: <amount>: integer (in add mode)

Specifies the amount of experience points or levels to give to the player. Negative values remove experience instead of adding them.
Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ).

JE: <amount>: integer (in set mode)

Specifies the amount of experience points or levels to be set to the player.
Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). And it must be between 0 and 2147483647 (inclusive).

BE: amount: int: int

Specifies the amount of experience points or levels to be added 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. Negative values remove experience instead of adding them.
Must be a [Int]32-bit integer number (from -2147483648 (-231) to 2147483647 (231-1) ). If the amount is expressed in points, it must be not lower than 0.

JE: <targets>: entity (in add and set mode)
BE: player: target: CommandSelector<Player>

Specifies the target of the command. In Bedrock Edition, if not specified, defaults to the command's executor.
Must be a player name, a target selector or a UUID‌. And the target selector must‌/should‌ be of player type. In Bedrock Edition, the target selector should be of player type.

JE: <targets>: entity (in query mode)

Specifies the target of the command.
Must be a player name, a target selector or a UUID. And the target selector must be of single-player type.

Result

CommandTriggerJava EditionBedrock Edition
AnyThe command is incomplete, or any argument is not specified correctly. Unparseable Unparseable
/... add ...
/... set ...
<targets> fails to resolve to one or more online players. Failed N/A
/... query ...<targets> fails to resolve to one or more online players.
/... set ...<amount> is greater than the current capacity of xp bars of all the targeted players.
Anyplayer: target is a target selector that is not in player type. N/A Failed
player: target fails to resolve to one or more online players.
player: target is not specified when the command's executor is not a player.
The amount is expressed in points, and amount: int is lower than 0.
AnyOtherwiseSuccessful

Output

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
AnyJava EditionOn fail000
/... query ...On success11The number of experience points or levels the player has
/... add ...
/... set ...
On success11The number of targeted players
AnyBedrock EditionOn fail0N/AN/A
On successThe number of players who are given or taken experienceN/AN/A

Examples

  • 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‌ or xp set @a 0 levels

History

Java Edition
1.0.0Beta 1.9 Prerelease 5Added /xp. The command took a player name and then a number of xp orbs to award.
1.3.112w16a/xp is now usable in singleplayer.
Syntax changed to have the number of orbs first, and then the player, and the player is now optional.
1.4.212w39aAdded L notation for levels. Levels can be subtracted, but points cannot, failing with the message "Cannot give player negative experience points".
The limit for /xp is now 2,147,483,647 (231−1) instead of 5,000.
1.1317w45aAdded /experience and made /xp alias it.
Restructured syntax into /experience add, /experience set, and /experience query sub-commands.
Negative points are now supported.
Pocket Edition Alpha
v0.16.0build 1Added /xp.

Navigation