Minecraft /xp wont let me target @p or @a
So I've been building a large battle arena type server where there is both PVP and PVE survival in a concentrated coliseum, and most of the map is governed via command blocks.
Score is measured at the end of a life by amount of xp gained while alive. To prevent looting of player corpses or loss of items, I recently turned the gamerule keepInventory on, but because keepInventory also lets the player keep their xp on death, it does not automatically reset them to zero anymore.
So I set up a small command block clock-chain under spawn that's supposed to test for any player in spawn with 1 or more levels, and then remove 1 level per tick until they reach zero. Currently the /testfor clock works flawlessly, but when I attempt to chain a block with the command:
/xp @a[-1,230,-11,5,m=0,lm=1] -1L
It reports that @a[-1,230,-11,5,m=0,lm=1] is invalid, so I tried shortening it to @a, and then @p. Still no dice. It seems the only way I know of that can get the /xp command to work is by specifically naming the player to target, which is useless for a public server spawn when I need it to target multiple random players at once.
Can anyone offer any tips to help me solve this delemma?
Best Answer
Well I figured it out myself moments after posting the question. Turns out it was a silly mistake, but I'll put it here anyways before closing the question so as to help any future minecrafter who may stumble on the same problem.
I had the target and amount backwards. Instead of:
/xp @a[-1,230,-11,5,m=0,lm=1] -1L
It needed to be:
/xp -1L @a[-1,230,-11,5,m=0,lm=1]
I've learned from my mistake. Maybe my experience can be of use to another.
Pictures about "Minecraft /xp wont let me target @p or @a"



What does @A @P mean Minecraft?
The selector \u201c@p\u201d selects the nearest player. Alternatively, you could also use your Minecraft username, but if you run a command from the console you will always be the nearest player. The other target selectors are \u201c@a\u201d for all players, \u201c@r\u201d for a random player, and \u201c@e\u201d will target all entities.How do you target specific entities in Minecraft?
The @e target selector is used to target all entities in the game. This includes both players and mobs in the world. Notice that in this last example, we have used [type=enderman] to target only enderman. This value is called a target selector argument and allows us to filter the target.What is @A in Minecraft commands?
How to use Minecraft commands- @p = nearest player.
- @r = random player.
- @a = all players.
- @e = all entities.
- @s = the entity executing the command.
What does to @A mean in Minecraft?
Here are some more helpful teleport commands for Minecraft: Command. Effect. /tp @a @s. Teleport all players to you.Minecraft - xp command!
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Kampus Production, Kampus Production, Kampus Production, Kampus Production
