From a76b48f853c896e3c024843d3e187d0e70bbe9a1 Mon Sep 17 00:00:00 2001 From: Rothes <449181985@qq.com> Date: Mon, 26 Feb 2024 00:00:51 +0800 Subject: [PATCH 1/2] Not serializing reset color --- .../java/net/md_5/bungee/chat/ComponentStyleSerializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java b/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java index f3d1d026c0..2c7c24b82d 100644 --- a/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java +++ b/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java @@ -62,7 +62,7 @@ static void serializeTo(ComponentStyle style, JsonObject object) { object.addProperty( "obfuscated", style.isObfuscatedRaw() ); } - if ( style.hasColor() ) + if ( style.hasColor() && style.getColor() != ChatColor.RESET ) { object.addProperty( "color", style.getColor().getName() ); } From e413f2c6564ca7d51fe307e6cb70d83fd1ef38bd Mon Sep 17 00:00:00 2001 From: Rothes <449181985@qq.com> Date: Mon, 26 Feb 2024 17:52:13 +0800 Subject: [PATCH 2/2] Only serialize color that color is actually present --- .../java/net/md_5/bungee/chat/ComponentStyleSerializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java b/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java index 2c7c24b82d..fdb8a3217a 100644 --- a/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java +++ b/chat/src/main/java/net/md_5/bungee/chat/ComponentStyleSerializer.java @@ -62,7 +62,7 @@ static void serializeTo(ComponentStyle style, JsonObject object) { object.addProperty( "obfuscated", style.isObfuscatedRaw() ); } - if ( style.hasColor() && style.getColor() != ChatColor.RESET ) + if ( style.hasColor() && style.getColor().getColor() != null ) { object.addProperty( "color", style.getColor().getName() ); }