diff --git a/src/main/java/dev/plex/command/annotation/System.java b/src/main/java/dev/plex/command/annotation/System.java index fb5343e..718be26 100644 --- a/src/main/java/dev/plex/command/annotation/System.java +++ b/src/main/java/dev/plex/command/annotation/System.java @@ -3,5 +3,7 @@ package dev.plex.command.annotation; public @interface System { - String value(); + String value() default ""; + + boolean debug() default false; } diff --git a/src/main/java/dev/plex/command/impl/DebugCMD.java b/src/main/java/dev/plex/command/impl/DebugCMD.java index 6a8d0a0..3cf0a55 100644 --- a/src/main/java/dev/plex/command/impl/DebugCMD.java +++ b/src/main/java/dev/plex/command/impl/DebugCMD.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable; @CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/ | gamerules>") @CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug") -@System("debug") +@System(debug = true) public class DebugCMD extends PlexCommand { @Override diff --git a/src/main/java/dev/plex/handlers/CommandHandler.java b/src/main/java/dev/plex/handlers/CommandHandler.java index fae0a40..c9ba2be 100644 --- a/src/main/java/dev/plex/handlers/CommandHandler.java +++ b/src/main/java/dev/plex/handlers/CommandHandler.java @@ -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) {