Skip to content

Messages

Package: com.hypixel.hytale.server.core.Message

The Message class is the universal text type in Hytale — used for chat, commands, UI text, entity names, and notifications. It wraps the protocol-level FormattedMessage and provides a fluent builder API for styling, composition, and parameterization.

FactoryDescription
Message.raw(String)Literal text, sent as-is
Message.translation(String)Translation key, resolved client-side by player’s locale
Message.empty()Blank message — use as a container for children
Message.join(Message...)Concatenates multiple messages as children of an empty parent
Message.parse(String)Decodes a JSON-encoded message (used by /say for structured input)
Message greeting = Message.raw("Hello!");
Message translated = Message.translation("mymod.welcome");
Message combined = Message.join(
Message.raw("[Server] "),
Message.translation("mymod.motd")
);

Use Message.translation() for anything player-facing. Use Message.raw() for debug output or text that shouldn’t be translated. See Translations for .lang file format, parameter syntax, and plural rules.

All style methods modify the message in-place and return this for chaining.

Message.raw("Important").bold(true);
Message.raw("Emphasis").italic(true);
Message.raw("Code output").monospace(true);
MethodEffect
.bold(true)Bold text
.italic(true)Italic text
.monospace(true)Monospace font

Underline exists at the protocol level (FormattedMessage.underlined) but has no convenience method on Message. To set it, access the underlying object:

message.getFormattedMessage().underlined = MaybeBool.True;

Colors are hex strings — no named color enum.

// hex string
Message.raw("Warning!").color("#F2D729");
Message.raw("Error").color("#ff5555");
// java.awt.Color constant
Message.raw("Enabled").color(Color.GREEN);
Message.raw("Disabled").color(Color.RED);

The hex string accepts #RGB, #RRGGBB, and #RRGGBBAA formats. The .color(Color) overload converts via ColorParseUtil.colorToHex().

Message.raw("Click here").link("https://example.com");

The link field stores a URL string on the protocol message. The client renders it as a clickable link.

Styles use a tri-state system (MaybeBool): Null (inherit from parent), True, or False. When you build a message tree with children, unstyled children inherit their parent’s formatting. Passing false explicitly resets an inherited style:

Message parent = Message.empty().bold(true);
parent.insert(Message.raw("This is bold ")); // inherits bold
parent.insert(Message.raw("this is not").bold(false)); // explicitly resets

Messages form a tree — each message can have children that render in sequence after the parent’s own text.

// append a child message
Message msg = Message.empty();
msg.insert(Message.raw("Line 1\n"));
msg.insert(Message.raw("Line 2\n"));
// append multiple children
msg.insertAll(Message.raw("A"), Message.raw("B"), Message.raw("C"));

.insert() also accepts a plain String (wraps it in Message.raw() internally).

Message.join() creates an empty parent and adds all arguments as children:

Message dialog = Message.join(
Message.translation("mymod.npc.name"),
Message.raw(": "),
Message.translation("mymod.npc.dialog")
);
// build a list incrementally
Message list = Message.empty();
for (String item : items) {
list.insert(Message.raw("- " + item + "\n"));
}

Parameters use {key} placeholders in translation strings. The .param() method accepts several value types directly:

Value TypeExample
String.param("name", playerName)
int.param("count", 5)
long.param("id", entityId)
float.param("speed", 1.5f)
double.param("x", position.getX())
boolean.param("enabled", true)
Message.param("target", Message.translation("..."))
playerRef.sendMessage(Message.translation("mymod.healed")
.param("name", targetName)
.param("amount", healAmount));

Pass a Message as a parameter to embed styled or translated fragments inside a translation:

// styled name inside a translated string
Message msg = Message.translation("mymod.banned")
.param("player", Message.raw(username).bold(true).color(Color.RED));
// nested translation
Message msg = Message.translation("mymod.objective.completed")
.param("title", Message.translation(objective.getTitleKey()));

The .lang file uses {paramName} regardless of whether the value is a scalar or nested Message:

mymod.banned = {player} has been banned
mymod.objective.completed = Completed: {title}

Primitive params and message params are stored in separate maps internally (params for scalars, messageParams for nested messages).

For format specifiers ({key, upper}, {key, number}, {key, plural, ...}), see Translations.

Messages are mutable.bold(), .color(), .insert() and other methods modify the message in-place and return this. Don’t reuse a message object after styling:

// the bold leaks to the console send too
Message name = Message.raw(username);
sendToPlayer(name.bold(true));
sendToConsole(name); // also bold

Build each message separately:

sendToPlayer(Message.raw(username).bold(true));
sendToConsole(Message.raw(username));

Any class implementing IMessageReceiver can receive messages — this includes Player, PlayerRef, and ConsoleSender.

playerRef.sendMessage(Message.translation("mymod.welcome"));
world.sendMessage(Message.translation("world.event.started"));
Universe universe = Universe.get();
universe.sendMessage(Message.raw("Server restart in 5 minutes"));

Package: com.hypixel.hytale.server.core.universe.world.PlayerUtil

// broadcast message — players who have the sender hidden won't receive it
PlayerUtil.broadcastMessageToPlayers(senderUuid, message, store);

See Visibility for the hidden players system.

For sending arbitrary packets (not just messages):

// to all players in a world
PlayerUtil.broadcastPacketToPlayers(componentAccessor, packet);
// to all players server-wide
Universe.get().broadcastPacket(packet);

Package: com.hypixel.hytale.server.core.util.message.MessageFormat

Pre-built message patterns used across commands:

// returns green "enabled" or red "disabled" message
Message status = MessageFormat.enabled(isEnabled);
// formats a list: inline with commas (4 or fewer) or newline-delimited (5+)
Message list = MessageFormat.list(headerMessage, valueMessages);

Message.getAnsiMessage() resolves the message to plain text for console/logging. For translations, it looks up the en-US locale server-side and substitutes parameters:

String consoleText = message.getAnsiMessage();

Message delivery is packet-based. See Interface Packets for field details: ServerMessage, ChatMessage, KillFeedMessage.

PlayerRef.sendMessage() writes a ServerMessage packet with ChatType.Chat.