-
Notifications
You must be signed in to change notification settings - Fork 1
Legacy Format Support
Leo edited this page Dec 19, 2023
·
4 revisions
Messages can be read from and formed into different formats.
The default format using the Adventure MiniMessage.
a="<red>Hello world!</red>" # <-- because MiniMessage is default format this will be parsed as MiniMessage
// Whyever you would need it, its just deserializing and then serializing again
String miniMessage = MY_MESSAGE.toString(MessageFormat.MINI_MESSAGE);
The JSON like format that is being used by Minecraft internally
a="<nbt>{"text":"Hello world!","color":"red"}</nbt>"
a="<json>{"text":"Hello world!","color":"red"}</json>"
a="<gson>{"text":"Hello world!","color":"red"}</gson>"
String nbt = MY_MESSAGE.toString(MessageFormat.NBT);
The original ingame formatter to make colored values. Does not support hover texts or clickable texts.
HexColors follow the pattern §x§r§r§g§g§b§b
a="<legacy:'§'>§cHello world!</legacy>"
String legacyParagraph = MY_MESSAGE.toString(MessageFormat.LEGACY_PARAGRAPH);
Similar to the § formatter, but with the ampersand symbol instead. HexColors follow the patterh &#rrggbb
a="<legacy:'&'>&cHello world!</legacy>"
String legacyAmpersand = MY_MESSAGE.toString(MessageFormat.LEGACY_AMPERSAND);
Simply turns everything into unformatted text.
# no reason, since MiniMessage would produce the same result.
a="<plain>Hello world!</plain>"
a="<pre>Hello world!</pre>"
# more likely example, where you don't want a tag to be parsed and display it as is:
a="<plain><msg:example></plain>"
# it will produce the string "<msg:example>" and not the resolved message with key 'example'.
String plain = MY_MESSAGE.toString(MessageFormat.PLAIN);