Minecraft – Tellraw with combination

minecraft-commandsminecraft-java-edition

enter image description here
enter image description here

I want to make several items in a /tellraw line, where each item can be on or off, where on items and off items can have different colors and hoverEvents (maybe and clickEvents). If there are too many items, and each possible combination cost a tellraw command, it explodes. Is there a good way to do such thing?

The selector way doesn't match hoverEvent requirement. Issue https://bugs.mojang.com/browse/MC-55493 . Another solution blocked https://bugs.mojang.com/browse/MC-129718

Best Answer

team prefix&suffix can contain events, so such code makes an armor_stand that "named" aaa and show bbb when hover:

team add test
team modify test prefix {"text":"aaa","hoverEvent":{"action":"show_text","value":"bbb"}}
summon minecraft:armor_stand ~ ~ ~ {CustomName:"\"\""}
team join test @e[type=minecraft:armor_stand]
say @e[type=armor_stand]