From 9c0b187f3116789ec717579af188932d249ad2a1 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sun, 22 Nov 2020 09:55:39 +0100 Subject: [PATCH] Catch errors in Bungee chat parsing --- .../protocols/protocol1_13to1_12_2/ChatRewriter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/ChatRewriter.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/ChatRewriter.java index a25840ad1..a44f4044a 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/ChatRewriter.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_13to1_12_2/ChatRewriter.java @@ -4,6 +4,7 @@ import com.google.gson.JsonElement; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.chat.ComponentSerializer; +import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.rewriters.ComponentRewriter; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ComponentRewriter1_13; import us.myles.ViaVersion.util.GsonUtil; @@ -86,7 +87,12 @@ public class ChatRewriter { } public static String jsonTextToLegacy(String value) { - return TextComponent.toLegacyText(ComponentSerializer.parse(value)); + try { + return TextComponent.toLegacyText(ComponentSerializer.parse(value)); + } catch (Exception e) { + Via.getPlatform().getLogger().warning("Error converting json text to legacy: " + value); + return ""; + } } public static void processTranslate(JsonElement value) {