View at: Template:Commands/content [edit]
Commands/experience - minecraft.fandom.com
Treść tej podstrony pochodzi z artykułu „Commands/experience” w domenie minecraft.fandom.com na licencji CC BY-NC-SA 3.0
Adds, removes or queries player experience.
Syntax[]
- 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[]
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 32-bit integer number.
JE: <amount>: integer (in set mode)
- Specifies the amount of experience points or levels to be set to the player.
- 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 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. - 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).
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[Java Edition only]. And the target selector must[JE only]/should[BE only] 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[]
| Command | Trigger | Java Edition | Bedrock Edition |
|---|---|---|---|
| any | the arguments are not specified correctly | Unparseable | Unparseable |
/... add ... | <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 bar for any player | ||
| any | player: target 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 | |||
| any | Otherwise | Successful | |
Output[]
| Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
|---|---|---|---|---|---|
| any | Java Edition | On fail | 0 | 0 | 0 |
/... query ... | On success | 1 | 1 | the number of experience points or levels the player have | |
/... add ... | On success | 1 | 1 | the number of targeted players | |
| any | Bedrock Edition | On fail | 0 | N/A | N/A |
| On success | the number of players who are given or taken experience. | N/A | N/A |
Examples[]
- To display Steve's current level:
experience query Steve levels[Java Edition only] - To give 7 experience to yourself:
xp 7[Bedrock Edition only] orexperience add @s 7[Java Edition only] - To give 3 levels to Alice:
xp 3L Alice[Bedrock Edition only] orxp add Alice 3 levels[Java Edition only] - To remove all levels from all players:
xp -2147483648L @a[Bedrock Edition only] orxp set @a 0[Java Edition only] orxp set @a 0 levels[Java Edition only]
History[]
| Java Edition | |||||
|---|---|---|---|---|---|
| 1.0.0 | Beta 1.9 Prerelease 5 | Added /xp. The command took a player name and then a number of xp orbs to award. | |||
| 1.3.1 | 12w16a | /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.2 | 12w39a | Added 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.13 | 17w45a | Added /experience and made /xp alias it. | |||
Restructured syntax into /experience add <targets>, /experience set <targets>, and /experience query <targets>. | |||||
| Negative points are now supported. | |||||
| Pocket Edition Alpha | |||||
| v0.16.0 | build 1 | Added /xp. | |||