I have been working on a server and want to add warps as can be typed in the chat without using /tp, somebody knows how?
-
This can't be done in vanilla minecraft as far as I know. What are you using for your server/ – creulcat Nov 13 '17 at 07:50
-
Same question as creulcat, are you using a stock server jar? If you use bukkit/spigot, there are plugins that allow custom warps, player set homes, and teleporting to each other without giving them access to any other commands. Otherwise, in vanilla Minecraft, you could use scoreboard triggers to accomplish this but it would be complicated and would require the use of tellraw on signs or chat or it would require the player type trigger commands which are not very short. If you are interested in this still, look at this answer. – IronAnvil Nov 13 '17 at 15:51
-
I am trying to make a vanilla server with only commands. – Lucky MC Nov 14 '17 at 08:29
-
So i think i will use /trigger and /scoreboard commands. Thanks everybody for answering! – Lucky MC Nov 14 '17 at 08:37
2 Answers
In vanilla minecraft, the use of scoreboard triggers is a solution to allow non OP players to trigger the execution of op level commands. Current Minecraft Java Edition is 1.12.2
Setup
Create a trigger objective one time manually:scoreboard objectives add tpTrigger trigger
Create a command block that is RepeatUnconditionalAlways Active with command:
scoreboard players enable @a tpTrigger
Setup Warps
Now create a chain of two command blocks. This chain will need to be repeated for each warp that you want to create but the scores and coordinates in the commands will be changed.First command block is RepeatUnconditionalAlways Active with command:
tp @a[score_tpTrigger_min=1,score_tpTrigger=1] <x> <y> <z>
Second command block is ChainConditionalAlways Active with command:
scoreboard players set @a[score_tpTrigger_min=1,score_tpTrigger=1] tpTrigger 0
Change <x> <y> <z> in the first command block to the coordinates of your warp. A second set of commands for a different warp would be commands:
tp @a[score_tpTrigger_min=2,score_tpTrigger=2] <x2> <y2> <z2>
scoreboard players set @a[score_tpTrigger_min=2,score_tpTrigger=2] tpTrigger 0
Continue with as many chains as you want warps.
Player Warp Commands
To use the first warp the player would have to use command:/trigger tpTrigger set 1
To use the second warp the player would have to use command:
/trigger tpTrigger set 2
And so on for all your warps.
You can also use the tellraw command in chat with a clickEvent which causes the player to run those commands. You can use this Tellraw Generator to create them. Here is an example:
/tellraw @a [{"text":"To teleport to spawn: "},{"text":"[Click Here]","color":"aqua","clickEvent":{"action":"run_command","value":"/trigger tpTrigger set 1"}}]
You can also use command signs which use a clickEvent as well. You could have a hub of signs that sends you to many places. Each place could have a sign that goes back to the hub. You can use this Command Sign Generator to create these signs. Here is an example command that will give you a sign that when placed and clicked, will run the trigger command for the first warp:
/give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"Teleport to\"}",Text2:"{\"text\":\"spawn\"}",Text4:"{\"text\":\"Click the sign\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/trigger tpTrigger set 1\"}}"},display:{Name:"Custom Sign"}}
-
Oh right, trigger. That's pretty much the only command I don't know at all yet. – Fabian Röling Nov 14 '17 at 21:17
Well, you can use /trigger. A non-op player is able to use the /trigger command so you'll just have to create a scoreboard objective with /scoreboard objectives ad trigger, and them allow the players using a repeating command block using /scoreboard players enable @a , and the player will use /trigger set 1.
- 22,281
- 30
- 97
- 143