From 84cb9726a5217caf4d22f733be96a929f169bc62 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Fri, 24 Jun 2022 01:24:30 +0200 Subject: [PATCH] Problem finally solved. Adjusting log messages + removing invalid and unused ReflectRegistry data --- .../fr/pandacube/lib/paper/reflect/NMSReflect.java | 14 +++++--------- .../lib/paper/reflect/ReflectRegistry.java | 5 ----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java index 1868501..acead30 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/NMSReflect.java @@ -110,15 +110,13 @@ public class NMSReflect { try { clazz.cacheReflectClass(); } catch (Throwable e) { - if (missingRuntimeClasses == 0) { // first - Log.severe("[NMSReflect] Error while loading runtime classes referenced by the obfuscation mapping."); - } missingRuntimeClasses++; if (e instanceof ClassNotFoundException cnfe) { - Log.severe("[NMSReflect] Missing runtime class " + cnfe.getMessage() + (IS_SERVER_OBFUSCATED ? (" (moj class: " + clazz.mojName + ")") : "")); + Log.warning("[NMSReflect] Missing runtime class " + cnfe.getMessage() + (IS_SERVER_OBFUSCATED ? (" (moj class: " + clazz.mojName + ")") : "")); } else { - Log.severe("[NMSReflect] Unable to load runtime class " + (IS_SERVER_OBFUSCATED ? (clazz.obfName + " (moj class: " + clazz.mojName + ")") : clazz.mojName), e); + Log.warning("[NMSReflect] Unable to load runtime class " + (IS_SERVER_OBFUSCATED ? (clazz.obfName + " (moj class: " + clazz.mojName + ")") : clazz.mojName)); + Log.warning(e); // throwable on separate log message due to sometimes the message not showing at all because of this exception } CLASSES_BY_OBF.remove(clazz.obfName); CLASSES_BY_MOJ.remove(clazz.mojName); @@ -126,15 +124,13 @@ public class NMSReflect { } if (missingRuntimeClasses > 0) { - Log.severe("[NMSReflect] " + missingRuntimeClasses + " class have been removed from the mapping data due to errors."); + Log.warning("[NMSReflect] " + missingRuntimeClasses + " class have been removed from the mapping data due to the previously stated errors."); } } catch (Throwable t) { CLASSES_BY_OBF.clear(); CLASSES_BY_MOJ.clear(); - Log.severe("[NMSReflect] The plugin will have limited access to NMS stuff due to an error while loading the obfuscation mapping."); - Log.severe(t.toString()); - t.printStackTrace(); + Log.severe("[NMSReflect] The plugin will not have access to NMS stuff due to an error while loading the obfuscation mapping.", t); } Log.info("[NMSReflect] Obfuscation mapping loaded for " + CLASSES_BY_OBF.size() + " classes."); } diff --git a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java index 0f70530..2b44bb3 100644 --- a/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java +++ b/Paper/src/main/java/fr/pandacube/lib/paper/reflect/ReflectRegistry.java @@ -109,11 +109,6 @@ public class ReflectRegistry { public static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor()); } - public static final class BlockStateArgument { - public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.blocks.BlockStateArgument")); - public static final ReflectConstructor CONSTRUCTOR = wrapEx(() -> MAPPING.runtimeReflect().constructor()); - } - public static final class Vec3Argument { public static final ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.commands.arguments.coordinates.Vec3Argument")); public static final ReflectMethod vec3 = wrapEx(() -> MAPPING.mojMethod("vec3", boolean.class));