mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-11 00:55:10 +02:00
Use correct classloader to load
This commit is contained in:
@@ -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");
|
||||||
|
Reference in New Issue
Block a user