From 013635e095e67510a07bc97ffce2c5ccf781f897 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Fri, 24 Jun 2022 00:34:58 +0200 Subject: [PATCH] Having fun with a log message not showing exception + fixing obf data handling in case of error to avoid invalid internal state --- .../fr/pandacube/lib/paper/reflect/NMSReflect.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 89e138e..bfb7e32 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 @@ -53,6 +53,8 @@ public class NMSReflect { Log.info("[NMSReflect] Initializing NMS obfuscation mapping..."); + boolean clearIfError = true; + try { ReflectClass obfHelperClass; try { @@ -117,13 +119,19 @@ public class NMSReflect { } } + clearIfError = false; + if (missingRuntimeClasses) throw new ClassNotFoundException("Unable to find all the following runtime classes referenced by the obfuscation mapping. They are removed from the mapping data."); } catch (Throwable t) { - Log.severe("[NMSReflect] The plugin will hava limited access to access NMS stuff due to an error while loading the obfuscation mapping."); + if (clearIfError) { + 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()); - Log.severe(t); + t.printStackTrace(); } Log.info("[NMSReflect] Obfuscation mapping loaded for " + CLASSES_BY_OBF.size() + " classes."); }