A bidirectional serializer for converting between PaperMC Adventure Component objects and Hytale's Message system.
- Bidirectional Conversion: Seamlessly convert between Adventure Components and Hytale Messages
- Full Style Support: Preserves colors, bold, italic, underline, and monospace formatting
- Translation Support: Handles translatable components with typed arguments
- Recursive Children: Properly serializes and deserializes nested components
- Type-Safe Arguments: Supports boolean, numeric, string, and component translation arguments
Convert an Adventure Component to a Hytale Message:
// Create an Adventure component
Component component = Component.text("Hello, World!")
.color(NamedTextColor.RED)
.decorate(TextDecoration.BOLD);
// Serialize to Hytale Message
Message message = HytaleComponentSerializer.get().serialize(component);Convert a Hytale Message to an Adventure Component:
// Create a Hytale message
Message message = Message.raw("Hello, World!")
.color("#FF0000")
.bold(true);
// Deserialize to Adventure Component
Component component = HytaleComponentSerializer.get().deserialize(message);// Serialize a translatable component
Component component = Component.translatable("chat.welcome")
.arguments(
TranslationArgument.component(Component.text("Player123")),
TranslationArgument.numeric(42)
);
Message message = HytaleComponentSerializer.get().serialize(component);// Create a complex component with children
Component component = Component.text("Hello ")
.color(NamedTextColor.YELLOW)
.append(
Component.text("World")
.color(NamedTextColor.GREEN)
.decorate(TextDecoration.BOLD)
)
.append(Component.text("!"));
Message message = HytaleComponentSerializer.get().serialize(component);// Apply multiple styles
Component component = Component.text("Important Message")
.color(TextColor.fromHexString("#FF5555"))
.decorate(TextDecoration.BOLD)
.decorate(TextDecoration.ITALIC);
Message message = HytaleComponentSerializer.get().serialize(component);// Add a clickable link
Component component = Component.text("Visit our website")
.color(NamedTextColor.AQUA)
.clickEvent(ClickEvent.openUrl("https://example.com"));
Message message = HytaleComponentSerializer.get().serialize(component);- ✅ Raw text content
- ✅ Empty components
- ✅ Translation keys
- ✅ Boolean arguments
- ✅ Numeric arguments (int, long, float, double)
- ✅ String arguments
- ✅ Component arguments
- ✅ Hex colors (
#RRGGBB) - ✅ Named colors (e.g.,
red,blue) - ✅ Bold
- ✅ Italic
- ✅ Underline
- ✅ Monospace (mapped to/from obfuscated)
- ✅ Open URL links
- ✅ Nested children
- ✅ Recursive serialization/deserialization
| Adventure | Hytale | Notes |
|---|---|---|
TextColor |
color |
Supports hex and named colors |
BOLD |
bold |
Direct mapping |
ITALIC |
italic |
Direct mapping |
UNDERLINED |
underlined |
Direct mapping |
OBFUSCATED |
monospace |
Closest equivalent mapping |
STRIKETHROUGH |
❌ | Not supported in Hytale |
| Adventure | Hytale | Notes |
|---|---|---|
ClickEvent.OPEN_URL |
link |
Direct mapping |
ClickEvent.RUN_COMMAND |
❌ | Not supported |
ClickEvent.SUGGEST_COMMAND |
❌ | Not supported |
ClickEvent.CHANGE_PAGE |
❌ | Not supported |
ClickEvent.COPY_TO_CLIPBOARD |
❌ | Not supported |
The serializer handles all Adventure translation argument types:
// Boolean arguments
TranslationArgument.bool(true);
// Numeric arguments
TranslationArgument.numeric(42); // int
TranslationArgument.numeric(42L); // long
TranslationArgument.numeric(3.14f); // float
TranslationArgument.numeric(3.14); // double
// Component arguments
TranslationArgument.component(Component.text("Hello"));- Strikethrough: Not supported by Hytale's message system
- Click Events: Only
OPEN_URLis supported (commands, suggestions, etc. are not available) - Hover Events: Not supported by Hytale's message system
- Insertions: Not supported by Hytale's message system
- Fonts: Not supported by Hytale's message system
Add the serializer to your project:
// Access the singleton instance
HytaleComponentSerializer serializer = HytaleComponentSerializer.get();- Java 17 or higher (for pattern matching and modern syntax)
- Kyori Adventure API 4.15.0+ (for
TranslationArgumentsupport) - Hytale Server Core (for
Messageclasses)
This serializer is designed for use with Hytale's server framework and Kyori Adventure library.
When contributing, please ensure:
- Code follows the existing style conventions
- Changes maintain backward compatibility where possible
- New features are documented in this README