StringUtils#jsonToLegacy will now fail silently

This commit is contained in:
Auxilor
2021-12-26 17:21:01 +00:00
parent 51a61b65c6
commit 9168e68b5a

View File

@@ -3,7 +3,6 @@ package com.willfp.eco.util;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonSyntaxException;
import com.willfp.eco.core.Eco;
import com.willfp.eco.core.Prerequisite;
import com.willfp.eco.core.integrations.placeholder.PlaceholderManager;
import net.kyori.adventure.text.Component;
@@ -21,7 +20,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -84,11 +82,6 @@ public final class StringUtils {
.put("§k", ChatColor.MAGIC)
.build();
/**
* Logger.
*/
private static final Logger LOGGER = Eco.getHandler().getEcoPlugin().getLogger();
/**
* Format a list of strings.
* <p>
@@ -453,8 +446,7 @@ public final class StringUtils {
Component component = GSON_COMPONENT_SERIALIZER.deserialize(json);
return LEGACY_COMPONENT_SERIALIZER.serialize(component);
} catch (JsonSyntaxException e) {
LOGGER.warning("(Report this!) Erroneous json string " + json + " could not be deserialized");
return "";
return json;
}
}