Formatting code

From Warlords Wiki
Jump to: navigation, search

Formatting codes are a set of special codes that can be used to control the formatting of text for chat messages and item name and lore. They typically start with &, followed by one or more other characters.

Usage

Formatting codes have a number of uses:

  • Marking different characters in a game (typically each character will have a format associated with them)
  • Distinguishing between different elements in item lore
  • Adding emphasis in chat messages

Basic formatting codes

These are the chat codes available in most servers that have them. Typically a plugin such as Essentials provides these, and so they are fairly universal. Essentials was the chat plugin used for all Warlords servers prior to Warlords 3, and so are the only codes that were available there.

Code Effect
&0 Black
&1 Dark Blue
&2 Dark Green
&3 Dark Aqua
&4 Dark Red
&5 Dark Purple
&6 Gold
&7 Light Gray
&8 Dark Gray
&9 Blue
&a, &A Green
&b, &B Aqua
&c, &C Red
&d, &D Purple
&e, &E Yellow
&f, &F White
&k Displays text that rapidly flickers between characters.
&l Bold
&m Strikethrough
&n Underlined
&o Italic
&r Resets all formatting to the default. In chat messages, this will use a player's prefix color, if available.

In addition, some plugins allow arbitrary RGB colors. These are either in the format &#ABCDEF or &x&A&B&C&D&E&F where ABCDEF represent digits of a web color. wlplugin only supports the former syntax.

Escapes

Sometimes, typing a raw & is wanted without it being interpreted as a formatting code. In most situations, this can be dealt with automatically (e.g. if the following character would not be a valid formatting code, then it can simply be outputted as-is). However, in some situations this is not possible, for example if one wanted to type &0. This is the reason escapes exist, which let one type characters which would otherwise be interpreted as formatting codes. To type a single &, most plugins (including wlplugin) offer the ability to type && and have it render as a single &; &&0 would render as &0 and not be interpreted as a formatting code. To type && itself, one would need to type &&&&.

Backslash escapes

In addition, wlplugin offers backslash escapes. This allows one to use a backslash to escape the meaning of certain characters. For example, & may be escaped as \&. This is also used for \n, which adds a line break to a chat message. Other special characters, such as [, ], and | (as used in component codes; see below) may be escaped as well.

Component codes

Component codes are a feature exclusive to wlplugin and therefore Warlords 3. They allow the use of text components in normal chat messages. The syntax of component codes is either &[action|content] or &[action|data|content], with the former syntax equivalent to the latter syntax with both data and content as the same text. content represents how the component should display (i.e. the text visible in chat) and the use of data is dependent on action, as listed in the following table:

Action Effect Equivalent Minecraft component
copy Copy data to the clipboard when clicked. copy_to_clipboard
link Open the URL data in the user's browser when clicked. open_url
cmd, command Copy data into the user's chat box, allowing them to send it by pressing enter. suggest_command
hover Display data when the text is hovered over. show_text

External resources