0

Here's the command, formatted what I thoughtwas correctly...

/tellraw @p ["",{"text":"This map is based off of 1.9 features such as detecting when you pick up items,","color":"green"},{"text":" [HINT] ","color":"dark_green","bold":true,"clickEvent":{"action":"run_command","value":"/tellraw @p {{\"text\":\"[HINT]\",\"color\":\"dark_blue\"},{\"text\":\"This pickaxe cannot break lit glowstone lamps.\",\"color\":\"light_purple\"}}"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click For Hint"}]}}},{"text":"so you may need to think outside of the box for some levels. good Luck!","color":"green"}]

However it's giving me Invalid json: malformed JSON at line 1 column 3 Please help!

1

Your clickEvent value starts with two curly brackets instead of a square followed by a curly.

However, when a player clicks a clickEvent via /tellraw, they are running the value as if they have manually typed it into the chat themselves. This means that the player is subject to chat limitations, such as requiring OP to run commands as well as a 100-character limit. The command being run exceeds that character limit, so it is trimmed (causing an error due to invalid format as a result of the trim).

The solution is to either use a shorter command or to use a different command altogether. For example, /scoreboard for OP'd players or /trigger for non-OP'd players while using an external mechanism to target players with a changed score.

Example using /scoreboard:

The /tellraw command becomes:

/tellraw @p ["",{"text":"This map is based off of 1.9 features such as detecting when you pick up items,","color":"green"},{"text":" [HINT] ","color":"dark_green","bold":true,"clickEvent":{"action":"run_command","value":"/scoreboard players set @a[c=1] OBJ 1"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click For Hint"}]}}},{"text":"so you may need to think outside of the box for some levels. good Luck!","color":"green"}]

(clickEvent value specifically being):

/scoreboard players set @a[c=1] OBJ 1

External command sending a new /tellraw command to players with an OBJ score of 1:

/tellraw @a[score_OBJ_min=1] [{"text":"[HINT]","color":"dark_blue"},{"text":"This pickaxe cannot break lit glowstone lamps.","color":"light_purple"}]

Afterwards, set the player to have an OBJ score of 0 to prevent constant spam:

/scoreboard players set @a[score_OBJ_min=1] OBJ 0
|improve this answer|||||

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.