Skip to content

Always format

Always format is FeatherMC’s one-call text formatter. Give it a string that uses legacy color codes, MiniMessage, or a mix of both, and it returns an Adventure Component that renders correctly everywhere the server accepts components — chat, the tab list, sign lines, book pages, boss bars, and kick / shutdown / restart messages.

FeatherMC uses it for its own messages. Your plugin can use it on any text:

import dev.feathermc.feather.Feather;
import net.kyori.adventure.text.Component;
Component msg = Feather.format("&6Welcome &lback&r&6, <green>have fun!");
player.sendMessage(msg);

Feather.format(...) is a convenience for dev.feathermc.feather.text.AlwaysFormat.format(String). Both are pure text handling (just Adventure under the hood), so they also work on plain Paper and are safe to bundle — see Supporting Paper too.

InputExampleResult
Legacy colors / formats&a, &l, &o, §cgreen, bold, italic, red
Legacy hex (Bungee)&#ff8800that exact color
Legacy hex (Spigot)&x&f&f&8&8&0&0that exact color
MiniMessage tags<red>, <bold>, <underlined>colors and formats
MiniMessage gradients<gradient:#ff0000:#0000ff>text</gradient>a smooth gradient
MiniMessage rainbow<rainbow>text</rainbow>rainbow text
New line\n (or a real line break)a line break

Legacy codes and MiniMessage can be combined in one string — legacy is translated to MiniMessage first, then the whole thing is parsed, so gradients and the rest work alongside & codes.

// Legacy
Feather.format("&cError: &7something went wrong");
// MiniMessage + gradient
Feather.format("<gradient:#f9a825:#e65100><bold>FeatherMC</bold></gradient>");
// Mixed, with a line break
Feather.format("&6Server restarting\n<gray>back in a minute");
// A sign (4 lines via \n), tab header, or a kick reason - all the same call:
sign.line(0, Feather.format("<gradient:#00e5ff:#2979ff>Spawn</gradient>"));
player.sendPlayerListHeader(Feather.format("&b&lMyServer\n<gray>welcome"));
event.disallow(Result.KICK_BANNED, Feather.format("&cYou are banned\n<gray>appeal at /discord"));

If you want the translated MiniMessage string rather than a component (for example to store it), use AlwaysFormat.toMiniMessage(String):

String mm = dev.feathermc.feather.text.AlwaysFormat.toMiniMessage("&a&lHi");
// -> "<green><bold>Hi"
  • Unknown or malformed markup never throws: the text is returned as-is instead.
  • For the full MiniMessage tag reference, see the Component API and the MiniMessage format.
Full Javadoc

Adapted from the PaperMC docs (CC BY-SA 4.0). About these docs.