Minecraft:Commands/xp: Difference between revisions
More actions
Remove broken links to missing pages |
Fix template calls: add MC/ prefix |
||
| Line 6: | Line 6: | ||
|others=Cheat only{{only|bedrock|short=1}} | |others=Cheat only{{only|bedrock|short=1}} | ||
|alias= | |alias= | ||
* {{ | * {{MC/Cmd|experience|link=none}}{{only|java|short=1}} | ||
}} | }} | ||
Adds, removes or queries player experience. | Adds, removes or queries player experience. | ||
| Line 34: | Line 34: | ||
==Arguments== | ==Arguments== | ||
{{ | {{MC/El|je|short=1}}: {{MC/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. | ||
: {{ | : {{MC/Arg desc|je=integer}} | ||
{{ | {{MC/El|je|short=1}}: {{MC/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. | ||
: {{ | : {{MC/Arg desc|je=integer|min=0}} | ||
{{ | {{MC/El|be|short=1}}: {{MC/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. | ||
: {{ | : {{MC/Arg desc|be=int}} If the amount is expressed in points, it must be not lower than 0. | ||
{{ | {{MC/El|je|short=1}}: {{MC/Argument|targets|entity}} (in <code>add</code> and <code>set</code> mode)<br> | ||
{{ | {{MC/El|be|short=1}}: {{MC/Argument|be=1|player: target|CommandSelector<Player>}} | ||
: Specifies the target of the command. {{ | : Specifies the target of the command. {{MC/In|bedrock}}, if not specified, defaults to the command's executor. | ||
: {{ | : {{MC/Arg desc|je=entity|amount=multiple|type=players|be=player}} | ||
{{ | {{MC/El|je|short=1}}: {{MC/Argument|targets|entity}} (in <code>query</code> mode) | ||
: Specifies the target of the command. | : Specifies the target of the command. | ||
: {{ | : {{MC/Arg desc|je=entity|amount=single|type=players}} | ||
==Result== | ==Result== | ||
| Line 72: | Line 72: | ||
== Output == | == Output == | ||
{{Output table}} | {{MC/Output table}} | ||
{{Output table|edition=je|On fail|0|0|0}} | {{MC/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}} | {{MC/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}} | {{MC/Output table|cmd=/... add ...<br>/... set ...|On success|1|1|The number of targeted players}} | ||
{{Output table|cmd=|edition=be|On fail|0}} | {{MC/Output table|cmd=|edition=be|On fail|0}} | ||
{{Output table|On success|The number of players who are given or taken experience}} | {{MC/Output table|On success|The number of players who are given or taken experience}} | ||
{{Output table}} | {{MC/Output table}} | ||
== Examples == | == Examples == | ||
| Line 90: | Line 90: | ||
=== ''Java Edition'' === | === ''Java Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|java}} | |{{MC/HistoryLine|java}} | ||
|{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 5|Added {{ | |{{HistoryLine||1.0.0|dev=Beta 1.9 Prerelease 5|Added {{MC/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|{{MC/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 {{MC/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 {{MC/Cmd|experience|link=none}} and made {{MC/Cmd|xp|link=none}} alias it.|Restructured syntax into {{MC/Cmd|experience add|link=none}}, {{MC/Cmd|experience set|link=none}}, and {{MC/Cmd|experience query|link=none}} sub-commands.|Negative points are now supported.}} | ||
}} | }} | ||
=== ''Bedrock Edition'' === | === ''Bedrock Edition'' === | ||
{{HistoryTable | {{HistoryTable | ||
|{{HistoryLine|pocket alpha}} | |{{MC/HistoryLine|pocket alpha}} | ||
|{{HistoryLine||v0.16.0|dev=build 1|Added {{ | |{{HistoryLine||v0.16.0|dev=build 1|Added {{MC/Cmd|xp|link=none}}.}} | ||
}} | }} | ||
| Line 108: | Line 108: | ||
== Navigation == | == Navigation == | ||
{{Navbox commands}} | {{MC/Navbox commands}} | ||
de:Befehl/experience | de:Befehl/experience | ||
Latest revision as of 20:15, 9 April 2026
Template:Infobox command 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.
- 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
- REDIRECT Template:Edition
Template:Rcat: <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.
- {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|integer}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
Template:Rcat: <amount>: integer (in set mode)
- Specifies the amount of experience points or levels to be set to the player.
- {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|integer}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
Template:Rcat: 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
Lis added to the end, adds levels. Negative values remove experience instead of adding them. - {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|integer}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}} If the amount is expressed in points, it must be not lower than 0.
- REDIRECT Template:Edition
Template:Rcat: <targets>: entity (in add and set mode)
- REDIRECT Template:Edition
Template:Rcat: player: target: CommandSelector<Player>
- Specifies the target of the command. in Template:Editions, if not specified, defaults to the command's executor.
- {{#vardefine:onlyje|Template:IN,}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|entity}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
- REDIRECT Template:Edition
Template:Rcat: <targets>: entity (in query mode)
- Specifies the target of the command.
- {{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}
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
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|The number of experience points or levels the player has}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|/... query ...}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|The number of targeted players}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|/... add ...}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|Any}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|be}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}}
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|The number of players who are given or taken experience}}{{#vardefine:output2-{{#var:output-table-lines}}|N/A}}{{#vardefine:output3-{{#var:output-table-lines}}|N/A}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}
/... set ...
{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}
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
de:Befehl/experience es:Comandos/xp ja:コマンド/experience pt:Comandos/xp ru:Команды консоли/experience th:คำสั่ง/experience uk:Команди консолі/xp zh:命令/experience