ITADN

Escaped tags in Serialization

#1354ClosedOntey6 创建于 2025-12-21
type: bugresolution: wontfixarea: text-minimessage
O
Ontey6commented
# Problem When calling MiniMessage#serialize(String), all tags are escaped. **Example**: > ```java > Component deserialized = Component.text("Hello, World", NamedTextColor.GREEN); > String serialized = MiniMessage.miniMessage().serialize(deserialized); > > IO.println(serialized); > ``` > prints: `\<green>Hello, World`. As you can probably see, the green color is escaped. Then if you deserialize it again, it will be just plain text like `<green>Hello, World` Why would you want that? It especially doesn't make sense, because in the Component, it too, represents a seen color, not its literal name. ## Why it's annoying As everyone knows, you can't really edit a Component like a String, so you sometimes need to convert it to a String. Then you have a cycle like this: `serialize` - `edit` - `deserialize`. Then the problem is, that you have a plain String if the component before already had data # Easy solution I think this should technically work. Make this simple change in the `net.kyori.adventure-text-minimessage`: **Class: `net.kyori.adventure.text.minimessage.MiniMessageSerializer` line `104`** Before ```java private static final char[] TEXT_ESCAPES = {TokenParser.ESCAPE, TokenParser.TAG_START}; ``` After ```java private static final char[] TEXT_ESCAPES = new char[0]; ```
关闭于 2025-12-21 4 条评论