Minecraft:Commands/xp: Difference between revisions
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft |
||
| Line 4: | Line 4: | ||
* 2 {{only|java|short=1}} | * 2 {{only|java|short=1}} | ||
* 1 {{only|bedrock|short=1}} | * 1 {{only|bedrock|short=1}} | ||
|others=Cheat only{{only|bedrock|short=1}} | |others=[[Minecraft:Cheat]] only{{only|bedrock|short=1}} | ||
|alias= | |alias= | ||
* {{ | * {{cmd|experience|link=none}}{{only|java|short=1}} | ||
}} | }} | ||
Adds, removes or queries player experience. | Adds, removes or queries player [[Minecraft:experience]]. | ||
==Syntax== | ==Syntax== | ||
| Line 16: | Line 16: | ||
: <code>xp add <targets> <amount> [levels|points]</code> | : <code>xp add <targets> <amount> [levels|points]</code> | ||
:* Increases or decreases experience amount or experience level. | :* Increases or decreases experience amount or experience level. | ||
:** If experience amount, it is counted into the player's Score. | :** If experience amount, it is counted into the player's [[Minecraft:experience#Score|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. | :** 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. | ||
: <code>experience set <targets> <amount> [levels|points]</code> | : <code>experience set <targets> <amount> [levels|points]</code> | ||
| Line 34: | Line 34: | ||
==Arguments== | ==Arguments== | ||
{{ | {{el|je|short=1}}: {{argument|amount|integer}} (in <code>add</code> mode) | ||
: Specifies the amount of experience points or levels to give to the player. Negative values remove experience instead of adding them. | : Specifies the amount of experience points or levels to give to the player. Negative values remove experience instead of adding them. | ||
: {{ | : {{arg desc|je=integer}} | ||
{{ | {{el|je|short=1}}: {{argument|amount|integer}} (in <code>set</code> mode) | ||
: Specifies the amount of experience points or levels to be set to the player. | : Specifies the amount of experience points or levels to be set to the player. | ||
: {{ | : {{arg desc|je=integer|min=0}} | ||
{{ | {{el|be|short=1}}: {{argument|be=1|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. | : 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 <code>L</code> is added to the end, adds levels. Negative values remove experience instead of adding them. | : If an <code>L</code> is added to the end, adds levels. Negative values remove experience instead of adding them. | ||
: {{ | : {{arg desc|be=int}} If the amount is expressed in points, it must be not lower than 0. | ||
{{ | {{el|je|short=1}}: {{argument|targets|entity}} (in <code>add</code> and <code>set</code> mode)<br> | ||
{{ | {{el|be|short=1}}: {{argument|be=1|player: target|CommandSelector<Player>}} | ||
: Specifies the target of the command. {{ | : Specifies the target of the command. {{IN|bedrock}}, if not specified, defaults to the command's executor. | ||
: {{ | : {{arg desc|je=entity|amount=multiple|type=players|be=player}} | ||
{{ | {{el|je|short=1}}: {{argument|targets|entity}} (in <code>query</code> mode) | ||
: Specifies the target of the command. | : Specifies the target of the command. | ||
: {{ | : {{arg desc|je=entity|amount=single|type=players}} | ||
==Result== | ==Result== | ||
| Line 72: | Line 72: | ||
== Output == | == Output == | ||
{{ | {{Output table}} | ||
{{ | {{Output table|edition=je|On fail|0|0|0}} | ||
{{ | {{Output table|cmd=/... query ...|On success|1|1|The number of experience points or levels the player has}} | ||
{{ | {{Output table|cmd=/... add ...<br>/... set ...|On success|1|1|The number of targeted players}} | ||
{{ | {{Output table|cmd=|edition=be|On fail|0}} | ||
{{ | {{Output table|On success|The number of players who are given or taken experience}} | ||
{{ | {{Output table}} | ||
== Examples == | == Examples == | ||
| Line 90: | Line 90: | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|java}} | ||
|{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 5|Added {{ | |{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 5|Added {{cmd|xp|link=none}}. The command took a player name and then a number of xp orbs to award.}} | ||
|{{HistoryLine||1.3.1|dev=12w16a|{{ | |{{HistoryLine||1.3.1|dev=12w16a|{{cmd|xp|link=none}} is now usable in singleplayer.|Syntax changed to have the number of orbs first, and then the player, and the player is now optional.}} | ||
|{{HistoryLine||1.4.2|dev=12w39a|Added <code>L</code> notation for levels. Levels can be subtracted, but points cannot, failing with the message "Cannot give player negative experience points".|The limit for {{ | |{{HistoryLine||1.4.2|dev=12w39a|Added <code>L</code> notation for levels. Levels can be subtracted, but points cannot, failing with the message "Cannot give player negative experience points".|The limit for {{cmd|xp|link=none}} is now 2,147,483,647 (2<sup>31</sup>−1) instead of 5,000.}} | ||
|{{HistoryLine||1.13|dev=17w45a|Added {{ | |{{HistoryLine||1.13|dev=17w45a|Added {{cmd|experience|link=none}} and made {{cmd|xp|link=none}} alias it.|Restructured syntax into {{cmd|experience add|link=none}}, {{cmd|experience set|link=none}}, and {{cmd|experience query|link=none}} sub-commands.|Negative points are now supported.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 1|Added {{ | |{{HistoryLine||v0.16.0|dev=build 1|Added {{cmd|xp|link=none}}.}} | ||
}} | }} | ||
| Line 108: | Line 108: | ||
== Navigation == | == Navigation == | ||
{{ | {{Navbox commands}} | ||
de:Befehl/experience | [[Minecraft:de:Befehl/experience]] | ||
es:Comandos/xp | [[Minecraft:es:Comandos/xp]] | ||
ja:コマンド/experience | [[Minecraft:fr:Commandes/xp]] | ||
pt:Comandos/xp | [[Minecraft:ja:コマンド/experience]] | ||
ru:Команды консоли/experience | [[Minecraft:pt:Comandos/xp]] | ||
th:คำสั่ง/experience | [[Minecraft:ru:Команды консоли/experience]] | ||
uk:Команди консолі/xp | [[Minecraft:th:คำสั่ง/experience]] | ||
zh:命令/experience | [[Minecraft:uk:Команди консолі/xp]] | ||
[[Minecraft:zh:命令/experience]] | |||
Latest revision as of 11:05, 9 May 2026
Template:Infobox command Adds, removes or queries player Minecraft: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.
- Increases or decreases experience amount or experience level.
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.
- Setting experience amount or experience level. Does not change the player's score.
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
Template:El: Template:Argument (in add mode)
- Specifies the amount of experience points or levels to give to the player. Negative values remove experience instead of adding them.
- Template:Arg desc
Template:El: Template:Argument (in set mode)
- Specifies the amount of experience points or levels to be set to the player.
- Template:Arg desc
Template:El: Template:Argument
- 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
Lis added to the end, adds levels. Negative values remove experience instead of adding them. - Template:Arg desc If the amount is expressed in points, it must be not lower than 0.
Template:El: Template:Argument (in add and set mode)
Template:El: Template:Argument
- Specifies the target of the command. Template:IN, if not specified, defaults to the command's executor.
- Template:Arg desc
Template:El: Template:Argument (in query mode)
- Specifies the target of the command.
- Template:Arg desc
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
Examples
- To display Steve's current level:
experience query Steve levelsTemplate:Only - To give 7 experience to yourself:
xp 7Template:Only orexperience add @s 7Template:Only - To give 3 levels to Alice:
xp 3L AliceTemplate:Only orxp add Alice 3 levelsTemplate:Only - To remove all levels from all players:
xp -2147483648L @aTemplate:Only orxp set @a 0Template:Only orxp set @a 0 levelsTemplate:Only
History
Java Edition
Bedrock Edition
External links
Minecraft:de:Befehl/experience Minecraft:es:Comandos/xp Minecraft:fr:Commandes/xp Minecraft:ja:コマンド/experience Minecraft:pt:Comandos/xp Minecraft:ru:Команды консоли/experience Minecraft:th:คำสั่ง/experience Minecraft:uk:Команди консолі/xp Minecraft:zh:命令/experience