mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Prevent all commands from being loaded
This commit is contained in:
parent
172080576c
commit
d669da9f28
@ -3,5 +3,7 @@ package dev.plex.command.annotation;
|
||||
public @interface System
|
||||
{
|
||||
|
||||
String value();
|
||||
String value() default "";
|
||||
|
||||
boolean debug() default false;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <redis-reset <player> | gamerules>")
|
||||
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
||||
@System("debug")
|
||||
@System(debug = true)
|
||||
public class DebugCMD extends PlexCommand
|
||||
{
|
||||
@Override
|
||||
|
@ -22,14 +22,24 @@ 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());
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
|
||||
{
|
||||
PlexLog.log("Failed to register " + clazz.getSimpleName() + " as a command!");
|
||||
|
Loading…
Reference in New Issue
Block a user