Define colored messages in configuration files

Will there be a standard for defining colored messages in configuration files?

Bukkit had something like this:

&d[Server]&a Hello World!

Minecraft uses this JSON format:

[{text: "[Server]", color: light_purple}, {text: " Hello World!", color: green}]

What is the recommended format for Sponge?

Edit: Some proposals

XML syntax

<text color="light_purple">[Server]</text><text color="green">Hello World!</text>

BBCode-like syntax

{color=light_purple}[Server]{/color}{color=green}Hello World!{/color}
1 Like

If anything it will likely be the second option as the first one is already deprecated and will be removed from Minecraft.

I like JSON so I’d prefer that.
Even if it’s more text it’s just easier and more intuitive to use imo (at least if you know the basics of JSON).


If ya dunno JSON, then you have fundamentally messed up at some point in your life.


Step 1: learn JSON
Step 2:
Step 3: become rich.


Even if the old way isn’t all that intuitive I’d still prefer using the old color code style over JSON, less stuff to type out and much better for the chat if you are trying to use color code in the chat.

That’s what I thought. The JSON format is very hard to read. On the other hand, it can be extended with click events and other stuff:

{text: "Please ", color: gold}, 
{text: "/confirm", color: red, clickEvent: {action:run_command,value:"/confirm"}}, 
{text: " or", color: gold}, 
{text: "/deny", color: red, clickEvent: {action: run_command, value: "/deny"}}, 
{text: " this action.", color: gold}

//Output: Please /confirm or /deny this action.

I would prefer XML syntax:

<gold>Please <red>/confirm</red> or <red>/deny</red> this action.</gold>

With properties for events:

<bold clickEvent="{action: run_command, value: "/confirm"}">Do something!</bold>

Pls no tag for each and every color. Also, why introduce another way of formatting messages? We already have the &-syntax, we have JSON, adding XML would only create confusion.

I added a tag for every color to shorten it.

I don’t like the JSON format because it is so hard to read it. The XML format also adds the possibility to add nested elements.

It could also be something like:

<text color="gold" bold="true">Please <text color="red">/confirm</text> or <text color="red">/deny</text> this action.</text>

We haven’t decided this completely yet, but there will be a way to load colored messages easily from configurations. Because the JSON format is used by Minecraft itself in various areas like command blocks, JSON will be most likely the only way supported directly in the SpongeAPI.

While loading colored messages in the way Bukkit did previously (using color codes) is also possible in the SpongeAPI, this is deprecated already and only designed to be used for converting old configurations or simple usage like coloring sent chat messages by players. It supports only a small part of the features available in Minecraft now (click actions, hover actions, are not possible) therefore JSON should be preferred because it supports all these features.

At the end, every plugin should support the JSON format for messages, however providing additional formats for easier configurations shouldn’t be a big problem.

I’d say be able to pick and choose from a certain number of formats.