2

I have just created a Minecraft 1.13.1 server and was wondering if there was any way to give everyone the teleport command even if they are not op. If not, is there a way that I could make them op but only have access to the teleport command?

  • 1
    Reason for voting to reopen: The parent question is about modded Minecraft and the answer is installing mods. This question is for Vanilla Minecraft and many people can not or do not want to modify their game. Modded answers also get outdated much faster. – Fabian Röling Dec 2 at 22:27
  • 1
    These questions are clearly asking the same thing. The fact that one of them has only a mod-using answer means that it has an incomplete set of answers, not that this is not a duplicate. – pppery Dec 3 at 3:53
3

Teleporting requires op permissions. There is no way to allow teleportation without other cheat commands (without external mods).

If you know all the people on your server, or if you know all the locations you want to teleport to, you could have a series of command blocks that could be activated. Here are some ideas:

A command block that teleports the player to:

  • a specific username on the server (one command block per player).
  • the nearest player
  • a random player
  • specific coordinates, such as a person's base or landmark (one command block per landmark).

You could then place a command block in each person's base that would take them back to spawn, where they could then choose where they'd like to go. It's not as flexible as a /tp command, but a few command blocks should be able to take care of most scenarios where players want to teleport.

  • Thank you for answering instead of just downvoting. I appreciate it. I am a beginner and wasn't sure, that made it clear – nicks6853 Sep 26 '18 at 0:05
3

You can't grant access to only the /teleport command, but you can prepare a /trigger for them to use.

First create three scoreboards for the coordinates:

/scoreboard objectives add x trigger
/scoreboard objectives add y trigger
/scoreboard objectives add z trigger

The trigger type is what allows them to be set by non-OPs.

Then you enable them for use by everyone:

/scoreboard players enable @a x
/scoreboard players enable @a y
/scoreboard players enable @a z

This should be done in a clock, because using a trigger automatically disables it for that player.

Now the players can use commands like these to set their goal coordinates:

/trigger x
/trigger x add 123
/trigger x set 456

The first of these adds 1 to the scoreboard value for that player, the rest should be obvious.

Next you need something to actually start the teleportation. You can use this with yet another trigger of which you constantly check whether someone set it to 1 for himself, you can use the classical renamed item on the ground, you can do it whenever someone jumps 100 times on the spot, etc. Instructions for all of these can be found elsewhere.

Now to the actual teleportation: You can't just say /teleport @p <his_scoreboard_value_x> etc., so you have to use an entity of which you can set the coordinates in NBT. An armour stand is a nice dummy entity:

/execute at @p[tag=toTeleport] run summon armor_stand ~ ~ ~ {Marker:1,NoGravity:1,NoAI:1,Invisible:1,Tags:["teleportHelper"]}

This assumes that whatever detection system you use to initialise the teleportation gives the player the toTeleport tag.

And this is the trick: Unlike players, other entities can be teleported anywhere using their Pos NBT tag, which you can set to arbitrary numbers using /execute store:

/execute store result entity @e[tag=teleportHelper,limit=1] Pos[0] double 1 run scoreboard players get @p x
/execute store result entity @e[tag=teleportHelper,limit=1] Pos[1] double 1 run scoreboard players get @p y
/execute store result entity @e[tag=teleportHelper,limit=1] Pos[2] double 1 run scoreboard players get @p z

These three commands have to be in a chain (preferably your regular looping command block chain), followed by this command:

/tp @p[tag=toTeleport] @e[tag=teleportHelper,limit=1]

It's important that you teleport the player to the armour stand in the same tick that you set the Pos tag in, otherwise the chunk might unload and the teleportation would fail.

Then you just clean up everything:

/kill @e[tag=teleportHelper]
/tag remove @a[tag=toTeleport] toTeleport

This system should work fine in multiplayer, even if two players activate it at the exact same time, one will just be teleported one game tick later.

Thanks to vdvman1 in the Eigencraft Discord chat who told me that /trigger works with numbers and that you can teleport to far away entities if they were loaded at the start of the tick.


This is an optimized version of the above using functions that will also handle multiplayer better, it will allow any number of players to teleport in the same tick, to their own individual destinations. Written by vdvman1.

# run once
scoreboard objectives add x trigger
scoreboard objectives add y trigger
scoreboard objectives add z trigger
scoreboard objectives add tp trigger

# run every tick
execute as @a run function tp_trigger

# tp_trigger.mcfunction
scoreboard players enable @s x
scoreboard players enable @s y
scoreboard players enable @s z
execute if score @s tp matches 1.. run function tp_activate

# tp_activate.mcfunction
scoreboard players set @s tp 0
scoreboard players enable @s tp
scoreboard players operation #current x = @s x
scoreboard players operation #current y = @s y
scoreboard players operation #current z = @s z
tag @s add tp_trigger_source
summon area_effect_cloud ~ ~ ~ {Tags:["tp_trigger_target"]}
execute as @e[type=area_effect_cloud,tag=tp_trigger_target,limit=1] run function set_pos.mcfunction
tag @s remove tp_trigger_source

# set_pos.mcfunction
execute store result entity @s Pos[0] double 1 run scoreboard players get #current x
execute store result entity @s Pos[1] double 1 run scoreboard players get #current y
execute store result entity @s Pos[2] double 1 run scoreboard players get #current z
execute at @s run tp @a[tag=tp_trigger_source,limit=1] ~ ~ ~

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.