Adding more logging in NMSReflect
This commit is contained in:
parent
e45ac45ac6
commit
766bb43a5f
@ -81,13 +81,11 @@ public class NMSReflect {
|
|||||||
try {
|
try {
|
||||||
Class.forName(clazz.obfName);
|
Class.forName(clazz.obfName);
|
||||||
IS_SERVER_OBFUSCATED = true;
|
IS_SERVER_OBFUSCATED = true;
|
||||||
Log.info("[NMSReflect] NMS classes are obfuscated.");
|
|
||||||
break;
|
break;
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
try {
|
try {
|
||||||
Class.forName(clazz.mojName);
|
Class.forName(clazz.mojName);
|
||||||
IS_SERVER_OBFUSCATED = false;
|
IS_SERVER_OBFUSCATED = false;
|
||||||
Log.info("[NMSReflect] NMS classes are using mojang mapping.");
|
|
||||||
break;
|
break;
|
||||||
} catch (ClassNotFoundException ee) {
|
} catch (ClassNotFoundException ee) {
|
||||||
ee.addSuppressed(e);
|
ee.addSuppressed(e);
|
||||||
@ -100,27 +98,31 @@ public class NMSReflect {
|
|||||||
if (IS_SERVER_OBFUSCATED == null) {
|
if (IS_SERVER_OBFUSCATED == null) {
|
||||||
throw new IllegalStateException("Unable to determine if this server is obfuscated or not", exIfUnableToDetermine);
|
throw new IllegalStateException("Unable to determine if this server is obfuscated or not", exIfUnableToDetermine);
|
||||||
}
|
}
|
||||||
|
if (IS_SERVER_OBFUSCATED) {
|
||||||
|
Log.info("[NMSReflect] NMS runtime classes are obfuscated.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Log.info("[NMSReflect] NMS runtime classes are mojang mapped.");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean missingRuntimeClasses = false;
|
||||||
ClassNotFoundException exIfUnableToGetInstanceClass = null;
|
|
||||||
for (ClassMapping clazz : mappings) {
|
for (ClassMapping clazz : mappings) {
|
||||||
try {
|
try {
|
||||||
clazz.cacheReflectClass();
|
clazz.cacheReflectClass();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
if (exIfUnableToGetInstanceClass == null)
|
missingRuntimeClasses = true;
|
||||||
exIfUnableToGetInstanceClass = e;
|
Log.severe("[NMSReflect] Missing runtime class " + e.getMessage() + (IS_SERVER_OBFUSCATED ? (" (moj class: " + clazz.mojName + ")") : ""));
|
||||||
else {
|
|
||||||
exIfUnableToGetInstanceClass.addSuppressed(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exIfUnableToGetInstanceClass != null)
|
if (missingRuntimeClasses)
|
||||||
throw exIfUnableToGetInstanceClass;
|
throw new ClassNotFoundException("Unable to find all the following runtime classes referenced by the obfuscation mapping. They are removed from the mapping data.");
|
||||||
|
|
||||||
Log.info("[NMSReflect] Obfuscation mapping loaded for " + mappings.size() + " classes.");
|
Log.info("[NMSReflect] Obfuscation mapping loaded for " + mappings.size() + " classes.");
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
Log.severe("[NMSReflect] The plugin will not be able to access NMS stuff because the obfuscation mapping couldn't be loaded.", t);
|
Log.severe("[NMSReflect] The plugin will hava limited access to access NMS stuff due to an error while loading the obfuscation mapping.");
|
||||||
|
Log.severe(t.toString());
|
||||||
|
Log.severe(t);
|
||||||
CLASSES_BY_MOJ.clear();
|
CLASSES_BY_MOJ.clear();
|
||||||
CLASSES_BY_OBF.clear();
|
CLASSES_BY_OBF.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user