Prevent all commands from being loaded

This commit is contained in:
Focusvity
2022-03-19 15:17:43 +11:00
parent 172080576c
commit d669da9f28
3 changed files with 18 additions and 6 deletions

View File

@ -22,13 +22,23 @@ public class CommandHandler extends PlexBase
try
{
System annotation = clazz.getDeclaredAnnotation(System.class);
if (annotation != null && annotation.value().equalsIgnoreCase(plugin.getSystem()))
if (annotation != null)
{
if (annotation.value().equalsIgnoreCase(plugin.getSystem()))
{
commands.add(clazz.getConstructor().newInstance());
return;
}
if (plugin.config.getBoolean("debug") && annotation.debug())
{
commands.add(clazz.getConstructor().newInstance());
}
}
else
{
commands.add(clazz.getConstructor().newInstance());
return;
}
commands.add(clazz.getConstructor().newInstance());
}
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
{