minecraftminecraft-commands

Is it possible to add two ClickEvents in one word in Minecraft


Now I have the following command, but these command does not work:

/tellraw @p ["",{"text":"Click here","color":"aqua","clickEvent":{"action":"run_command","value":"/give @p diamond 2"},"clickEvent":{"action":"run_command","value":"/give @p diamond 2"}},{"text":" for 2","color":"none"},{"text":" diamonds","color":"blue"}},{"text":"!","color":"none"}]

Is it possible to place 2 commands in one "word"?


Solution

  • It is not possible to have two clickEvent tags on the same word. Among other things, it's not valid JSON. So you can't do it this way.

    However, you can use /trigger to achieve a similar effect (though you will need several command blocks). You'd need to have several command blocks that first run the commands you want on players with a specific scoreboard value and then clear that scoreboard value.