Based off of QbsidianH20's comment, to do it with commands only, follow the below guide which extra information can be found here.
To start off, the command you are looking for is shown below:
/tp [target player] <x> <y> <z> [<y-rot> <x-rot>]
Syntax for the above command:
[target player]
is the player that will be teleported.
<x>
is the X coordinate the targeted player will be teleported to.
<y>
is the Y coordinate the targeted player will be teleported to.
<z>
is the Z coordinate the targeted player will be teleported to.
[<y-rot> <x-rot>]
is the rotation on the Y and X axis that the player will be rotated accordingly on.
Guide for usage:
- Firstly, find your position on the map. Press F3 and jot down your X, Y & Z coordinates located on the left.
- Then type into the chat bar
/tp [target player] <x> <y> <z> [<y-rot> <x-rot>]
replacing <x>
, <y>
and <z>
with your coordinates you wrote down.
- Then, change
<y-rot>
and <x-rot>
with the angles you want.
Angles/Rotation Description from Commands page
y-rot (optional)
Specifies the horizontal rotation (-180.0 for due north, -90.0 for due east, 0.0 for due south, 90.0 for due west, to 179.9 for just west of north, before wrapping back around to -180.0). Tilde notation can be used to specify a rotation relative to the target's previous rotation.
x-rot (optional)
Specifies the vertical rotation (-90.0 for straight up to 90.0 for straight down). Tilde notation can be used to specify a rotation relative to the target's previous rotation.
As for when the player spawns, if you are using Bukkit for the setspawn command, using plugins like this automatically make the facing direction wherever you were looking when you executed the setspawn command.
If not, put a pressure plate down on the spawn block, a command block under that and teleport the nearest player wherever you want (a good suggestion again from QbsidianH20 would be a fake spawn), by inputting the below command into the command block:
/tp @p [x=0,y=0,z=0,r=0] tp coordinates
Where the values x, y, z define the center of the search (the player nearest to these coordinates would get teleported) and r defines the radius of the search. If you don't want to limit the radius omit r.
Do not use decimal values for the search center, this will not work.
- Excerpt from this Arqade question.
Good luck!
Yes, there is a way. When you make the world, you can select Creative mode with no cheats. Now when the world is loaded, entering commands like /gamemode 1
will result in a message saying you don't have permission to use that command. So there is this feature where you can enable cheats in a non-cheat world. Go to the pause menu, then "Open to LAN". From there, select "Enable Cheats". Now you have access to cheats. Note that this cheats mode is temporary, once you quit the world, cheats is deactivated. When building the map, you get access to commands like /give
and /gamemode
. When you give out the map, the players do not get access to the commands.
TL; DR
To a certain extend, yes you can do that. However, if the players find out about this feature, they can abuse it. Perhaps what you could do is have a armour-stand tracking system and detect a player who teleported away and teleport them back.
Best Answer
Here's the thing.
Popular servers like Hypixel and Mineplex don't use Vanilla Minecraft commands. They actually use something called plugins which are actually programmed with Java. Unfortunately, I couldn't find anything on the internet where you can actually do this with commands, but Hypixel definitely used plugins for this game. If you're trying to emulate what Hypixel is doing, I'm afraid I have to break the news that you probably can't (or it would be really, really hard to) do what you're wanting to do.
There may be a solution, but I am alerting you of what Hypixel does