Tellraw

tellraw sends a JSON message to selected or all players being useful for sending plain messages to players ingame

The titleraw command follows the same theme

Format

this is how the tell raw command is formatted

tellraw <target: target> <raw json message: json>
1
  • <target: target>: The target is expressed as a playername or player groups such as @a @r @s @p
  • <raw json message: json>: This is a json schema that tells how the message is structured or constructed. expressed with for example: {"rawtext":[{"text":""}]}

Examples

This sends the words in the last set of quotes

Copy
json
/tellraw @a {"rawtext":[{"text":"Hello"}]}
1

Escaping Characters

To use quotations in a tellraw message place a backslash to the left side of the quotation mark.

Copy
json
/tellraw @a {"rawtext":[{"text":"Quote me: \"I am here\"."}]}
1

Line breaks

To insert a line break use \n

Copy
json
/tellraw @a { "rawtext": [ { "text":"I am line one\nI am line two" } ] }
1

Displaying entities / player

You can use the following to use selector to display names.

Copy
json
/tellraw @a {"rawtext": [{"text": "§6The winner is: §a"}, {"selector": "@a[r=5,c=1]"}]}
1

Displaying scores

You can use the following to use selector to display names.

Copy
json
/tellraw @a {"rawtext": [{"text": "§6The winner is: §a"}, {"selector": "@a[r=5,c=1]"}, {"text": "§6With a score of: "}, {"score":{"name": "@s","objective": "value"}}]}
1

Translate text

To have a language dependant text you can use the translate component and translation keys. please note you will need relevant information in each of the desired .lang files for this to work.

RP/texts/en_US.langCopy
example.langcode.1=I am line one
1
RP/texts/de_DE.langCopy
example.langcode.1=Ich bin Zeile eins
1

The command:

Copy
json
/tellraw @a { "rawtext": [ { "translate": "example.langcode.1" } ] }
1

Translate text with selectors/scores

language files:

Copy
example.langcode.2=The winner is: %s. With a score of %s
1
Copy
json
/tellraw @a {"rawtext":[{"translate":"example.langcode.2","with":{"rawtext":[{"selector":"@a[r=5,c=1]"},{"text":"§6With a score of: "},{"score":{"name":"@s","objective":"value"}}]}}]}
1

Contributors

MedicalJewel105FabrimatSmokeyStack