Minecraft – How to include a selector in hover text in /tellraw

minecraft-commandsminecraft-java-edition

I currently have a problem with /tellraw. If I want to display a selector (@s, @p, …) in a normal text, I always use {"selector":"@s"}. But now I want to display a selector in a hover text. I have tried the following two variants, but both only showed "@s" and no player name:

"hoverEvent": {
            "action":"show_text",
            "value": {
                "translate":"%s executed this command.",
                "with": [{
                    "selector":"@s"
                }]
            }
        }

"hoverEvent": {
            "action":"show_text",
            "value": [{
                "selector":"@s"
            }, {
                "text":" führte diesen Befehl aus."
            }]
            
        }

Best Answer

This is a bug that was fixed in the 20w17a snapshot for 1.16. The bug has been in place since 1.8, and has been present for every version up to 1.16.

Try the latest snapshot or wait for 1.16 and it should work.

Please note that the value component has been renamed to contents in 1.16.

View the bug report here.