As part of the Unified Community Platform project, your wiki will be migrated to the new platform in the next few weeks. Read more here.

Commands/experience

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

Operator

First introduced

Beta 1.9 (5)
PE Alpha 0.16.0 (PE Alpha 0.16.0 build 1)

Adds or removes player experience.

Syntax[edit]

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

Arguments[edit]

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

Must be a 32-bit integer number. And it must be between -2147483648 and 2147483647 (inclusive).
Specifies the amount of experience points or levels to give to the player.
Negative values remove experience instead of adding them.

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

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

BE: amount: int: int

Must be a 32-bit integer number.
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).
Specifies the amount of experience points or levels to be added to the player.
Negative values remove experience instead of adding them.

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

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

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

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

Result[edit]

CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Failed
/... add ...
/... set ...
if <targets>or player: target fails to resolve to one or more online players Failed
anyif player: target fails to resolve to one or more online players N/A
/... query ...if <targets> fails to resolve to one or more online players Failed N/A
if player: target is not specified and the command executor is not a player N/A Failed
/... set ...if the <amount> is greater than the current capacity of xp bar for any player Failed N/A
anyOn successAdds/removes/qureies experiences.

Output[edit]

CommandEditionSituationSuccess Count/execute store succeess .../execute store result ...
anyJava EditionOn fail000
/... query ...On success11the number of experience points or levels the player have
/... add ...
/... set ...
On success11the number of targeted players
anyBedrock EditionOn fail0N/AN/A
On successthe number of players who are given or taken experience.N/AN/A

Examples[edit]

History[edit]

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.
Negative points are now supported.
Pocket Edition Alpha
0.16.0build 1Added /xp.