3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Add system property to print components before conversion

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-12-11 12:47:00 +01:00
Ursprung 4aefc23bb8
Commit 70645ec5ee
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -50,6 +50,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public final class ComponentConverter { public final class ComponentConverter {
private static final boolean DEBUG = Boolean.getBoolean("viaversion.debug.components");
private static final Set<String> BOOLEAN_TYPES = new HashSet<>(Arrays.asList( private static final Set<String> BOOLEAN_TYPES = new HashSet<>(Arrays.asList(
"interpret", "interpret",
"bold", "bold",
@ -69,6 +70,10 @@ public final class ComponentConverter {
); );
public static @Nullable JsonElement tagComponentToJson(@Nullable final Tag tag) { public static @Nullable JsonElement tagComponentToJson(@Nullable final Tag tag) {
if (DEBUG) {
Via.getPlatform().getLogger().info("Converting tag to json: " + tag);
}
try { try {
return convertToJson(null, tag); return convertToJson(null, tag);
} catch (final Exception e) { } catch (final Exception e) {
@ -78,6 +83,10 @@ public final class ComponentConverter {
} }
public static @Nullable Tag jsonComponentToTag(@Nullable final JsonElement component) { public static @Nullable Tag jsonComponentToTag(@Nullable final JsonElement component) {
if (DEBUG) {
Via.getPlatform().getLogger().info("Converting json to tag: " + component);
}
try { try {
return convertToTag(component); return convertToTag(component);
} catch (final Exception e) { } catch (final Exception e) {