1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-11 09:05:01 +02:00

Use correct classloader to load

This commit is contained in:
md_5
2012-10-07 21:47:14 +11:00
parent 6d3119dfe6
commit 7a36150f3c

View File

@@ -79,8 +79,8 @@ public class EssentialsExtra extends JavaPlugin
getServer().getPluginManager().disablePlugin(this); getServer().getPluginManager().disablePlugin(this);
} }
ClassLoader loader = new URLClassLoader(urls, getClassLoader()); ClassLoader loader = new URLClassLoader(urls);
final ICommandHandler handler = new EssentialsCommandHandler(loader, "Command", "essentials.", ess);; final ICommandHandler handler = new EssentialsCommandHandler(loader, "Command", "essentials.", ess);
for (File file : commandDir.listFiles()) for (File file : commandDir.listFiles())
{ {
String fileName = file.getName(); String fileName = file.getName();
@@ -89,7 +89,7 @@ public class EssentialsExtra extends JavaPlugin
String commandName = fileName.substring(7, fileName.length() - 7); String commandName = fileName.substring(7, fileName.length() - 7);
try try
{ {
AnnotatedCommand anot = Class.forName(fileName).getAnnotation(AnnotatedCommand.class); AnnotatedCommand anot = Class.forName(fileName, true, loader).getAnnotation(AnnotatedCommand.class);
if (anot == null) if (anot == null)
{ {
throw new IllegalArgumentException("Command class is not annotated with AnnotatedCommand.class"); throw new IllegalArgumentException("Command class is not annotated with AnnotatedCommand.class");