Add messages to exception

This commit is contained in:
Mark Vainomaa 2017-01-18 03:53:28 +02:00
parent 8b4a334873
commit 01a4ce3496

View File

@ -97,9 +97,11 @@ public class ServerUtils {
Class<?> clClass = classLoader.getClass(); Class<?> clClass = classLoader.getClass();
try { try {
Class<?> pluginClassLoader = checkNotNull(Reflect.getClass( Class<?> pluginClassLoader = checkNotNull(Reflect.getClass(
"org.bukkit.plugin.java.PluginClassLoader")); "org.bukkit.plugin.java.PluginClassLoader"),
"Couldn't find org.bukkit.plugin.java.PluginClassLoader class");
if(pluginClassLoader.isAssignableFrom(clClass)){ if(pluginClassLoader.isAssignableFrom(clClass)){
Field classesField = checkNotNull(Reflect.getField(clClass, "classes")); Field classesField = checkNotNull(Reflect.getField(clClass, "classes"),
"Failed to get classes field");
return (Map<String, Class<?>>) checkNotNull(Reflect.readField(classesField, classLoader)); return (Map<String, Class<?>>) checkNotNull(Reflect.readField(classesField, classLoader));
} else { } else {
throw new RuntimeException( throw new RuntimeException(