From 70645ec5ee9615af58063ade2009fa4c35713a9a Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 11 Dec 2023 12:47:00 +0100 Subject: [PATCH] Add system property to print components before conversion --- .../protocol1_20_3to1_20_2/util/ComponentConverter.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/util/ComponentConverter.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/util/ComponentConverter.java index 3017dd3e9..5d856a457 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/util/ComponentConverter.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_20_3to1_20_2/util/ComponentConverter.java @@ -50,6 +50,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; public final class ComponentConverter { + private static final boolean DEBUG = Boolean.getBoolean("viaversion.debug.components"); private static final Set BOOLEAN_TYPES = new HashSet<>(Arrays.asList( "interpret", "bold", @@ -69,6 +70,10 @@ public final class ComponentConverter { ); public static @Nullable JsonElement tagComponentToJson(@Nullable final Tag tag) { + if (DEBUG) { + Via.getPlatform().getLogger().info("Converting tag to json: " + tag); + } + try { return convertToJson(null, tag); } catch (final Exception e) { @@ -78,6 +83,10 @@ public final class ComponentConverter { } public static @Nullable Tag jsonComponentToTag(@Nullable final JsonElement component) { + if (DEBUG) { + Via.getPlatform().getLogger().info("Converting json to tag: " + component); + } + try { return convertToTag(component); } catch (final Exception e) {