public final class TextSerializers extends Object
TextSerializer
available together with SpongeAPI.Modifier and Type | Field and Description |
---|---|
static FormattingCodeTextSerializer |
FORMATTING_CODE
A
FormattingCodeTextSerializer for a simple Text
representation similar to LEGACY_FORMATTING_CODE but using the
formatting character & instead of the internal one. |
static TextSerializer |
JSON
The
TextSerializer for Mojang's JSON (Mojangson)
representation of a Text object. |
static FormattingCodeTextSerializer |
LEGACY_FORMATTING_CODE
Deprecated.
Legacy formatting codes are being phased out of Minecraft
|
static SafeTextSerializer |
PLAIN
The
TextSerializer for plain text input, without support for
formatting or special text types. |
Modifier and Type | Method and Description |
---|---|
static FormattingCodeTextSerializer |
formattingCode(char formattingChar)
Returns a representation that accepts and outputs formatting codes, using
the provided formatting character.
|
public static final SafeTextSerializer PLAIN
TextSerializer
for plain text input, without support for
formatting or special text types.@Deprecated public static final FormattingCodeTextSerializer LEGACY_FORMATTING_CODE
FormattingCodeTextSerializer
using the internal formatting
char.
Note: This serializer is ONLY available for compatibility
reasons. Using texts with legacy formatting codes as-is, without using
this FormattingCodeTextSerializer
is broken in many ways and
should not be used anymore unless really necessary. It is recommended to
use a different text serializer such as FORMATTING_CODE
instead.
FormattingCodeTextSerializer
public static final FormattingCodeTextSerializer FORMATTING_CODE
FormattingCodeTextSerializer
for a simple Text
representation similar to LEGACY_FORMATTING_CODE
but using the
formatting character &
instead of the internal one.
Example of a string parsed by this TextSerializer
&cHello &eSponge!
, would refer to a red and yellow formatted
text.
Note: Unlike the LEGACY_FORMATTING_CODE
TextSerializer
this is safe to use as simple Text
format
for plugins as long as you keep in mind that it does not support
additional Text
features such as ClickAction
s or
HoverAction
s.
FormattingCodeTextSerializer
public static final TextSerializer JSON
TextSerializer
for Mojang's JSON (Mojangson)
representation of a Text
object.public static FormattingCodeTextSerializer formattingCode(char formattingChar)
formattingChar
- The formatting character to parse and serialize
with