Is it possible to make custom commands in minecraft 1.12? [duplicate]
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?
42 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 triggerCreate a command block that is RepeatUnconditionalAlways Active with command:
scoreboard players enable @a tpTriggerSetup 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 0Change <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 0Continue 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 1To use the second warp the player would have to use command:
/trigger tpTrigger set 2And 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"}} 1 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.
0