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
|
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>")
|
@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <redis-reset <player> | gamerules>")
|
||||||
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
@CommandPermissions(level = Rank.EXECUTIVE, permission = "plex.debug")
|
||||||
@System("debug")
|
@System(debug = true)
|
||||||
public class DebugCMD extends PlexCommand
|
public class DebugCMD extends PlexCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,13 +22,23 @@ public class CommandHandler extends PlexBase
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
System annotation = clazz.getDeclaredAnnotation(System.class);
|
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());
|
commands.add(clazz.getConstructor().newInstance());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commands.add(clazz.getConstructor().newInstance());
|
|
||||||
}
|
}
|
||||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
|
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user