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?


Solution 1:

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.