Minecraft – Vanilla 1.8 detect new player

minecraft-commandsminecraft-java-editionminecraft-java-edition-server

In vanilla 1.8 using command blocks, is it possible to change a player's spawn point after they first join a server?

When a player first joins a server they are in location "A"
When they press a button to leave the spawn point (or use any other trigger) they are sent to location "B"
If they die after leaving the spawn they will respawn in location "B"

No mods or plugins
1.8 Vanilla
McEdit map editing is OK

Best Answer

Create a new scoreboard objective "new"

/scoreboard objectives add new dummy

Make the world spawn where you want the non-new players to spawn. Put a pressure plate under them (So they spawn on a pressure plate) that triggers a command block with the command

testfor @p[score_new_min=1,score_new=1] 

This will test for any player with a score of one in "new" Make that command block connect to a comparator that connects to another command block with the command

tp @p[score_new_min=1,score_new=1] x y z

Where x, y, and z are the coordinates of the place you want new players to spawn.

If you are going to have a lot of new players spawning at once however, this system might teleport the wrong new player. In that case, do this system except make the pressure plate in front of where they spawn, and make it their only option to walk over that pressure plate to get to the main spawn room.