How do I put a player's name in a /title command? in JE 1.12.2 [duplicate]
like the title says, I'm looking for a way to display a player name in a /tellraw command which is run by a command block. Example:
/tellraw @a {"text":"","extra":[{"text":"A player has won the game!","color":"blue"}]}
And the output is something like this:
A player has won the game!
But I want the output to be something like
JasonSPQR has won the game!
Using the @p parameter
Tellraw allows for a "selector" part, which takes any selector you want and displays a name. You should do:
/tellraw @a {"text":"","color":"blue","extra":[{"selector":"@p"},{"text":" has won the game!"}]}
This will only work in 1.8 snapshots and above. There is no way to do this in older versions.