Mojira Archive
MC-277308

/tellraw "clickEvent" only excepts singular String

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: [...] 

 

 

Works As Intended

E_T_31

2024-10-05, 01:51 PM

2024-10-23, 07:26 AM

2024-10-23, 07:26 AM

0

0

Confirmed

Commands

1.21.1, 24w40a

-