I am making a minecraft multiplayer server, and I am trying to make a safe, grief-proof spawnpoint. For that I need a few things:
Block Place and Destroy Protection (disable placing and breaking
blocks in the spawn area)Automatically set a player's spawnpoint upon joining, or if their spawnpoint is destroyed
Teleport them to the spawn upon respawning, if their spawn had to be reset
I have some command block code, but it only works for one player.
/execute run data get entity @p SpawnX
/spawnpoint @p 39 257 -16
/tp @p 39 257 -16
I have attached my command block configuration and commands, in matching order.
My first command block is Repeating, Unconditional, Always Active
My second command block is Impulse, Unconditional, Needs Redstone
My third command block is Chain, Condition, Always Active
The way it currently works is by checking the x-coordinate of the player spawnpoint. The output is then inverted such that the next command block is triggered only if the player does not have an x-coordinate. If this is the case, that command block will set the player spawn, and the final command block teleports them.
My question, is how do I make this work for all players? Using execute data get entity @a SpawnX
does not work. @p
only targets players nearest to the command block, which is 250 blocks in the sky. I need to be able to run this little command block script on every player in a loop, so upon joining and dying, the circuit works.