Messages & text

Send text to players and the console, and colour it with Minecraft formatting codes.

Most plugin output is text - chat messages, titles, popups, sign text, form labels. You send it through whichever API surface carries text: a player with sendMessage, sendTitle, or sendPopup, or the whole server with getServer().broadcastMessage. However you send it, you colour and style the text the same way - with formatting codes.

Formatting codes

Color codes customise the color and formatting of text - in chat, on signs, in titles, in forms, and more. Each code is the section sign (§) followed by a character. Endstone exposes them through ColorFormat, so you don't type the raw codes.

#include <endstone/endstone.hpp>

namespace es = endstone;

auto text = std::format("This is {}yellow, {}aqua and {}gold{}.", es::ColorFormat::Yellow,
                        es::ColorFormat::Aqua, es::ColorFormat::Gold, es::ColorFormat::Reset);

End colored text with es::ColorFormat::Reset to clear all color and formatting options.

All color and format codes

For the full list of codes and their names, see Formatting codes on the Minecraft Wiki. Every code maps to a ColorFormat member.

On this page