3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Catch errors in Bungee chat parsing

Dieser Commit ist enthalten in:
KennyTV 2020-11-22 09:55:39 +01:00
Ursprung e85f9e7510
Commit 9c0b187f31
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -4,6 +4,7 @@ import com.google.gson.JsonElement;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer; import net.md_5.bungee.chat.ComponentSerializer;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.rewriters.ComponentRewriter; import us.myles.ViaVersion.api.rewriters.ComponentRewriter;
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ComponentRewriter1_13; import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.ComponentRewriter1_13;
import us.myles.ViaVersion.util.GsonUtil; import us.myles.ViaVersion.util.GsonUtil;
@ -86,7 +87,12 @@ public class ChatRewriter {
} }
public static String jsonTextToLegacy(String value) { 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) { public static void processTranslate(JsonElement value) {