Look at this particular part, which is causing the first error:
Text1:"{"text
- Minecraft reads
Text:
, and is expecting a string (surrounded with quotation marks) to follow
- Minecraft reads
"
, so starts reading the string to go with Text1 (the key)
- Minecraft reads
{
as the string
- Minecraft reads
"
, so stops reading the string, and is now expecting a comma to start the next key-value pair, e.g: Text1:"Hello",Text2:"World"
- Minecraft finds
t
instead, so throws the unexpected token error
To fix this, you need to escape (put a backslash before) quotation marks that are part of the JSON. \"
tells Minecraft to read "
just as another character in the string, rather than stopping reading the string, as the "
is part of the JSON rather than the top-level NBTData.
Even more confusing is when you have a tellraw command, requiring JSON, within the sign's text JSON. You now need to escape the backslash itself (\\
) before the quotation mark (\"
) so that it's not read as NBTData, nor as the sign's text JSON, but as part of a string within the sign's text JSON.
Fully fixed command:
/give @p sign 1 0 {BlockEntityTag:{Text1:"{\"text\":\"[MF2]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"tellraw @a [{\\\"text\\\":\\\"[MF2] \\\",\\\"color\\\":\\\"gold\\\"},{\\\"selector\\\":\\\"@p\\\",\\\"color\\\":\\\"dark_aqua\\\"},{\\\"text\\\":\\\" is now an admin of the server!\\\",\\\"color\\\":\\\"white\\\"}]\"}}",Text3:"{\"text\":\"Click to join Admin\",\"color\":\"dark_aqua\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"scoreboard teams join admin @p\"}}"},display:{Name:"Custom Sign"}}
In the future, use a generator, or use a trigger
/scoreboard
command to set off the tellraw
command, as this can get pretty confusing and annoying to find errors in.
Do this for all of your armor stands. I believe this is the only way for it to work. It is going to be more command blocks, but I think its the only working one.
/execute @e[type=ArmorStand,name=(insertname)] ~ ~ ~ tellraw @a[score_goto=-1]
{
"selector": "@e[type=ArmorStand,r=1]",
"clickEvent": {
"action": "run_command",
"value": "/tp @p @e[type=ArmorStand,name=(insertname)]"
},
"color":"blue"
}
Best Answer
To clarify Daniel's answer, you can assign a tag to a player when they click on a command in the chat using the following command in a tellraw command:
Then, in a repeating command block chain, you can execute the following 3 commands in order: