Currently, tellraw clickEvents do not support JSON text while hoverEvents do.
In this example, there is a player selection menu of all online players shown to all players where the player clicks on the name to set their TargetPlayerID score to the ID score of the clicked player:
Hover Event Command:
/execute as @a run tellraw @a [{"text":"Hover to show Trigger Command","hoverEvent":{"action":"show_text","value":[{"text":"/trigger TargetPlayerID set "},{"score":{"name":"@s","objective":"ID"}}]}}]
When command is run, text is printed:
Hover to show Trigger Command
When this text is hovered, it shows:
/trigger TargetPlayerID set <Target Player's ID Score>
Click Event Command:
/execute as @a run tellraw @a [{"text":"Click to run Trigger Command","clickEvent":{"action":"run_command","value":[{"text":"/trigger TargetPlayerID set "},{"score":{"name":"@s","objective":"ID"}}]}}]
When command is run, text is printed:
Click to run Trigger Command
When this text is clicked, it should run this command:
/trigger TargetPlayerID set <Target Player's ID Score>
This should be made more consistent by allowing JSON text components in the value field for the tellraw clickEvent similar to when using tellraw hoverEvent.
Please sign in to leave a comment.
1 Comments