Files
netease-modsdk-wiki/docs/wiki/commands/tellraw.md
2025-03-20 00:13:44 +08:00

2.7 KiB

title, category, mentions
title category mentions
Tellraw Commands
SirLich
Dreamedc2015
MedicalJewel105
Luthorius
Fabrimat
Sprunkles137
ThomasOrs
zheaEvyline
SmokeyStack

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>
  • <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

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

Escaping Characters

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

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

Line breaks

To insert a line break use \n

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

Displaying entities / player

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

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

Displaying scores

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

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

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.lang

example.langcode.1=I am line one

RP/texts/de_DE.lang

example.langcode.1=Ich bin Zeile eins

The command:

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

Translate text with selectors/scores

language files:

example.langcode.2=The winner is: %s. With a score of %s

/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"}}]}}]}