Chat

From wiki.vg
Revision as of 12:19, 6 January 2011 by 14mRh4X0r (talk | contribs) (→‎Colors: Copied the table from minecraftwiki.net's Classic Server Protocol page and updated values.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Chat strings are subject to myriad limitations imposed by defects in the Notchian server and client, and also have special meanings for certain characters.

Character Set

The following list of characters is known to be supported by the Notchian server:

"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø׃áíóúñѪº¿®¬½¼¡«»"

Characters not in this list will cause Notchian servers to kick clients, and Notchian clients to choke and die horribly.

Colors

The Notchian client has support for colorized text. To select a color, a color escape code, similar to an ANSI color escape code, is inserted to change the color of the following characters.

Sample Code Common Name Foreground Color Background Color
R G B R G B
&0 Black 0 0 0 0 0 0
&1 Dark blue 0 0 170 0 0 42
&2 Dark green 0 170 0 0 42 0
&3 Dark cyan 0 170 170 0 42 42
&4 Dark red 170 0 0 42 0 0
&5 Purple 170 0 170 42 0 42
&6 Gold 255 170 0 42 42 0
&7 Gray 170 170 170 42 42 42
&8 Dark gray 85 85 85 21 21 21
&9 Blue 85 85 255 21 21 63
&a Bright green 85 255 85 21 63 21
&b Cyan 85 255 255 21 63 63
&c Red 255 85 85 63 21 21
&d Pink 255 85 255 63 21 63
&e Yellow 255 255 85 63 63 21
&f White 255 255 255 63 63 63

These correspond very roughly to the colors available in ANSI terminals.

A color escape code is created by combining the control character § (U+00A7) with the character specifying the color; thus, "§4" selects dark red as the color for the following text.

Bugs

The Notchian client expects that a color escape code in a chat message will be followed by at least one character, and will otherwise crash with a StringIndexOutOfBoundsException. The workaround for servers is to never end a message with a color control character.