How can I mention a specific name?
/say
can chain names together. So if you for example want to kill everyone with the "foo" tag and display your own combined death message instead of the normal ones, you can first turn off the regular death messages (you only need to do this once):
/gamerule showDeathMessages false
Then you can mention the names in chat:
/say The players @a[tag=foo] died a tragic death by commands.
And then kill them right after:
/kill @a[tag=foo]
The output should in theory be something like
[@] The players Horst, Hugo and Herbert died a tragic death by commands.
…but due to a bug it instead outputs this:
[@] The players Horst, Hugo, Herbert died a tragic death by commands.
The "@
" is the name of the command block (if you used a command block, otherwise it can be different), you can change this to whatever you want by renaming the command block in an anvil before placing it. If you don't want that there at all, you need to use /tellraw
, which is a bit more complicated:
/tellraw @a [{"text":"The players "},{"selector":"@a[tag=foo]"},{"text":" died a tragic death by commands."}]
Output:
The players Horst, Hugo, Herbert died a tragic death by commands.