5 min

Titles & Messages

Display titles, subtitles, and chat messages to players with full formatting control.

FormattedMessage

Text in Hytale uses FormattedMessage objects for rich formatting. The constructor has many parameters for styling.

1FormattedMessage message = new FormattedMessage(
2 "Hello World", // text content
3 null, // click action
4 null, // hover text
5 null, // insertion
6 null, // font
7 "#00FF88", // color (hex string)
8 MaybeBool.True, // bold
9 MaybeBool.False, // italic
10 MaybeBool.False, // underline
11 MaybeBool.False, // strikethrough
12 null, // obfuscated
13 false // reset
14);
maybebool enum
Use MaybeBool.True and MaybeBool.False (PascalCase), not TRUE/FALSE.

ShowEventTitle Packet

Display large text on the player's screen:

1private void showTitle(Player player, String titleText, String subtitleText) {
2 // Create title message (big text)
3 FormattedMessage title = new FormattedMessage(
4 titleText,
5 null, null, null, null,
6 "#FFFFFF", // white
7 MaybeBool.True, // bold
8 MaybeBool.False,
9 MaybeBool.False,
10 MaybeBool.False,
11 null, false
12 );
13
14 // Create subtitle message (smaller text below)
15 FormattedMessage subtitle = null;
16 if (subtitleText != null) {
17 subtitle = new FormattedMessage(
18 subtitleText,
19 null, null, null, null,
20 "#AAAAAA", // gray
21 MaybeBool.False,
22 MaybeBool.True, // italic
23 MaybeBool.False,
24 MaybeBool.False,
25 null, false
26 );
27 }
28
29 // Create and send packet
30 ShowEventTitle packet = new ShowEventTitle(
31 0.5f, // fadeIn (seconds)
32 0.5f, // fadeOut (seconds)
33 3.0f, // duration (seconds)
34 null, // event ID
35 true, // show (true to display, false to hide)
36 title,
37 subtitle
38 );
39
40 player.getPlayerConnection().write(packet);
41}

Title Timing

parametertypedescription
fadeInfloatSeconds to fade in (0.5 = smooth)
fadeOutfloatSeconds to fade out
durationfloatSeconds to display at full opacity
showbooleantrue = show, false = hide immediately

Message Builder Helper

MessageBuilder.javajava
1public class MessageBuilder {
2
3 private String text;
4 private String color = "#FFFFFF";
5 private boolean bold = false;
6 private boolean italic = false;
7 private boolean underline = false;
8 private boolean strikethrough = false;
9
10 public MessageBuilder(String text) {
11 this.text = text;
12 }
13
14 public static MessageBuilder of(String text) {
15 return new MessageBuilder(text);
16 }
17
18 public MessageBuilder color(String hex) {
19 this.color = hex;
20 return this;
21 }
22
23 public MessageBuilder bold() {
24 this.bold = true;
25 return this;
26 }
27
28 public MessageBuilder italic() {
29 this.italic = true;
30 return this;
31 }
32
33 public MessageBuilder underline() {
34 this.underline = true;
35 return this;
36 }
37
38 public MessageBuilder strikethrough() {
39 this.strikethrough = true;
40 return this;
41 }
42
43 public FormattedMessage build() {
44 return new FormattedMessage(
45 text,
46 null, null, null, null,
47 color,
48 bold ? MaybeBool.True : MaybeBool.False,
49 italic ? MaybeBool.True : MaybeBool.False,
50 underline ? MaybeBool.True : MaybeBool.False,
51 strikethrough ? MaybeBool.True : MaybeBool.False,
52 null, false
53 );
54 }
55}

Usage

1// Create styled messages easily
2FormattedMessage title = MessageBuilder.of("VICTORY")
3 .color("#00FF88")
4 .bold()
5 .build();
6
7FormattedMessage subtitle = MessageBuilder.of("You won the game!")
8 .color("#AAAAAA")
9 .italic()
10 .build();

Title Presets

TitlePresets.javajava
1public class TitlePresets {
2
3 public static void success(Player player, String text) {
4 showTitle(player, text, null, "#00FF88", 0.3f, 0.3f, 2.0f);
5 }
6
7 public static void error(Player player, String text) {
8 showTitle(player, text, null, "#FF4444", 0.1f, 0.1f, 2.0f);
9 }
10
11 public static void warning(Player player, String text) {
12 showTitle(player, text, null, "#FFAA00", 0.2f, 0.2f, 2.5f);
13 }
14
15 public static void info(Player player, String text, String subtitle) {
16 showTitle(player, text, subtitle, "#00AAFF", 0.5f, 0.5f, 3.0f);
17 }
18
19 public static void announcement(Player player, String text, String subtitle) {
20 showTitle(player, text, subtitle, "#FFFFFF", 1.0f, 1.0f, 5.0f);
21 }
22
23 private static void showTitle(
24 Player player,
25 String text,
26 String subtitle,
27 String color,
28 float fadeIn,
29 float fadeOut,
30 float duration
31 ) {
32 FormattedMessage titleMsg = MessageBuilder.of(text)
33 .color(color)
34 .bold()
35 .build();
36
37 FormattedMessage subtitleMsg = subtitle != null
38 ? MessageBuilder.of(subtitle).color("#888888").italic().build()
39 : null;
40
41 ShowEventTitle packet = new ShowEventTitle(
42 fadeIn, fadeOut, duration, null, true, titleMsg, subtitleMsg
43 );
44
45 player.getPlayerConnection().write(packet);
46 }
47}

Hide Title

1private void hideTitle(Player player) {
2 // Send packet with show=false to immediately hide
3 ShowEventTitle packet = new ShowEventTitle(
4 0f, 0f, 0f, null,
5 false, // hide
6 null, null
7 );
8 player.getPlayerConnection().write(packet);
9}

Common Colors

namehexusage
White#FFFFFFDefault, important text
Gray#AAAAAASubtitles, secondary
Green#00FF88Success, positive
Red#FF4444Error, danger
Yellow#FFAA00Warning, caution
Blue#00AAFFInfo, neutral
Purple#AA00FFSpecial, rare
Gold#FFD700Premium, achievement