# MiniMessageHelper > Utility class for parsing, serializing, and manipulating MiniMessage-formatted strings and Adventure Components. `gg.lode.bookshelfapi.api.util.MiniMessageHelper` --- ## Signature ```java public class MiniMessageHelper ``` --- ## Static Methods ### Deserialization | Method | Return Type | Description | |--------|-------------|-------------| | `deserialize(String input)` | `Component` | Parses a MiniMessage string into a Component. | | `deserialize(String input, VariableContext ctx)` | `Component` | Parses with variable substitution via [[VariableContext]]. | | `deserialize(Object input)` | `Component` | Parses from an Object (calls `toString()`). | | `deserializeIntoList(String input, VariableContext ctx)` | `List<Component>` | Parses a multi-line string into a list of Components. | ### Serialization | Method | Return Type | Description | |--------|-------------|-------------| | `serialize(Component component)` | `String` | Converts a Component back to a MiniMessage string. | ### Centering | Method | Return Type | Description | |--------|-------------|-------------| | `center(String message, VariableContext ctx)` | `String` | Centers a message for Minecraft chat width. | | `centerAndSend(Player player, String message, VariableContext ctx)` | `void` | Centers and sends a message to a player. | | `centerAndBroadcast(String message, VariableContext ctx)` | `void` | Centers and broadcasts a message to all players. | ### Formatting Conversion | Method | Return Type | Description | |--------|-------------|-------------| | `convertAmpersandToMiniMessage(String input)` | `String` | Converts legacy `&` color codes to MiniMessage format. | | `removeAmpersands(String input)` | `String` | Strips all `&` color codes from a string. | | `color(String input)` | `String` | Processes color codes in the string. | ### Component Manipulation | Method | Return Type | Description | |--------|-------------|-------------| | `getComponentContent(Component component)` | `String` | Extracts the plain text content of a Component. | | `persistStyle(Component... components)` | `Component` | Merges multiple Components while preserving styling. | | `stripFont(Component component)` | `Component` | Removes font styling from a Component. | | `stripItalic(Component component)` | `Component` | Removes italic styling from a Component. | --- ## Usage ```java // Simple deserialization Component msg = MiniMessageHelper.deserialize("<green>Hello <bold>World</bold>!</green>"); // With variables VariableContext ctx = VariableContext.of("player", player.getName()); Component welcome = MiniMessageHelper.deserialize("<gold>Welcome, {player}!</gold>", ctx); // Centering MiniMessageHelper.centerAndSend(player, "<red>Centered Message", VariableContext.of()); // Legacy conversion String modern = MiniMessageHelper.convertAmpersandToMiniMessage("&aGreen &bAqua"); ``` --- ## Related Pages - [[VariableContext]] - [[FontInfo]]