If you only want to teleport people who are in a certain group, you can use the new scoreboard command to create a 'group' of people (using teams), and then teleport only that team with this command (targets nearest player in the group specified)
/tp @p[team=<internal group name>,<other params here>] <x> <y> <z>
To set up your groups, you can create a group like this:
/scoreboard teams add <internal group name> <display name>
And then add people to this group like this:
/scoreboard teams join <internal group name> <user name>
The advantage of this system is also that you can use it actually to separate groups in the actual game. The scoreboard command has a feature that means that the display name
of a team will be displayed before the actual username, appearing like this in the chat:
[<display name>] <user name>: ...
More info on this system can be found in the wiki page linked above.
Changing the @p
in the first command above to a player name will stop it from working, because parameters that are inside the [
and ]
will only work for @p
, @a
, and @r
. So you cannot substitute the first command above to /tp <player name>[r=2] <x> <y> <z>
. It just won't work.
If you really want to use the r
parameter on a single person, try using the above method that uses teams, but only put one person in the team. Here is a quick way to do this. Type these into the command console:
/scoreboard teams add <internal player name> <external player name>
/scoreboard teams join <internal player name> <player name>
And then in the command block, to teleport that person if they are in a radius of 2, you could use:
/tp @p[team=<internal player name>,r=2] <x> <y> <z>
Alternatively, you could just specify the name of the player in the selector. Following the previous example, if you want to teleport a certain person if they are in a radius of 2, you could use:
/tp @p[name=<player name>,r=2] <x> <y> <z>
I'm not sure if this would fit your needs, but you could try the spreadplayers
command.
Despite it's name, it is also capable of spreading mobs, with the in Minecraft 1.8 newly introduced @e
selector.
/spreadplayers x z distance radius false @e[type=Creeper]
x z: The coordinates of where the mobs should go.
distance: The approximate distance the mobs should have.
radius: The radius of the area in which the mobs are spread (not a circle, but a square).
false: Just leave this at false, it is intended to respect teams when spreading players.
@e[type=Creeper]: The mob selector, the type=Creeper
is very important. You can write other mobs name in this, but do not leave it out, as that would spread itemframes, signs, minecarts... And that would be a mess.
Of course this only spreads the mobs, but you have to summon them first, but i think that is no problem, just use command blocks with /summon Creeper x y z
and you're good to go ;)
Best Answer
Due to the way Minecraft handles player spawning, they will always (naturally) spawn on the highest block that isn´t water, like the normal y=64 of typical worlds. You could get everyone on the server, then run
/spawnpoint @a
for everyone, but it wont affect new players who come on later. I´d put a barrier platform at y=255 and a command block chain saying/spawnpoint @a[radius=5] ~ (y level) ~
and then/tp @a[radius=5] ~ (y level) ~ .
this will teleport all new players to the spawnpoint you select.