-
Bug
-
Resolution: Works As Intended
-
None
-
1.21.1, 24w40a
-
None
-
Confirmed
-
Commands
The "clickEvent" option of "/tellraw" components only allows for single strings instead of json compounds as its "value". This is unexpected because both the "/tellraw" command itself and the thematically similar and structurally identical "hoverEvent" component both do support json compounds alongside singular strings.
Thus, not only can't simple strings be combined for a "clickEvent", but also scores from scoreboards, translation keys, entity selector and nbt data from for example storages (see the examples below) cannot be employed.
Setup:
/data modify storage example message set value 'Hello World!'
/tellraw:
# Singular String works: /tellraw @p "Message!" # Compound works: /tellraw @p ["Message: ",{"nbt":"message","storage":"example","interpret":false}]
/tellraw hoverEvent:
# Singular String works: /tellraw @p {"text":"Hover here","hoverEvent":{"action":"show_text","value":"Message!"}} # Compound works: /tellraw @p {"text":"Hover here","hoverEvent":{"action":"show_text","value":["Message: ",{"nbt":"message","storage":"example","interpret":false}]}}
/tellraw clickEvent:
# Singular String works: /tellraw @p {"text":"Click here","clickEvent":{"action":"suggest_command","value":"Message!"}} # Compound doesn't work: /tellraw @p {"text":"Click here","clickEvent":{"action":"suggest_command","value":["Message: ",{"nbt":"message","storage":"example","interpret":false}]}}
The latter command results in the following error message:
Invalid chat component: Not a string: [...]