diff --git a/src/main/java/de/presti/ree6/commands/CommandManager.java b/src/main/java/de/presti/ree6/commands/CommandManager.java index 6e25160b6..646bf82db 100644 --- a/src/main/java/de/presti/ree6/commands/CommandManager.java +++ b/src/main/java/de/presti/ree6/commands/CommandManager.java @@ -352,6 +352,7 @@ public void addCommand(ICommand command) throws CommandInitializerException { if (!commands.contains(command)) { commands.add(command); + log.info("Loaded Command {}", command.getClass().getSimpleName()); Command commandAnnotation = command.getClass().getAnnotation(Command.class); @@ -360,6 +361,8 @@ public void addCommand(ICommand command) throws CommandInitializerException { SettingsManager.getSettings().add(new Setting(-1, "command_" + commandAnnotation.name().toLowerCase(), commandAnnotation.name(), true)); + } else { + throw new CommandInitializerException(command.getClass()); } } diff --git a/src/main/java/de/presti/ree6/commands/exceptions/CommandInitializerException.java b/src/main/java/de/presti/ree6/commands/exceptions/CommandInitializerException.java index 32358282a..2c6b99839 100644 --- a/src/main/java/de/presti/ree6/commands/exceptions/CommandInitializerException.java +++ b/src/main/java/de/presti/ree6/commands/exceptions/CommandInitializerException.java @@ -29,7 +29,7 @@ public class CommandInitializerException extends ObjectStreamException { * @param commandClass the class. */ public CommandInitializerException(Class commandClass) { - this(commandClass != null ? commandClass.getName() : "Null!", commandClass == null ? "Class is null!" : Arrays.stream(commandClass.getInterfaces()).noneMatch(classname -> classname.isInstance(ICommand.class)) ? "Does not implement the ICommand Interface." : !commandClass.isAnnotationPresent(Command.class) ? "Command Annotation is not present." : commandClass.getAnnotation(Command.class).category() == null ? "It is not allowed to use NULL as Category!" : "Unknown Error!"); + this(commandClass != null ? commandClass.getName() : "Null!", commandClass == null ? "Class is null!" : Arrays.stream(commandClass.getInterfaces()).noneMatch(classname -> classname.isInstance(ICommand.class)) ? "Does not implement the ICommand Interface." : !commandClass.isAnnotationPresent(Command.class) ? "Command Annotation is not present." : commandClass.getAnnotation(Command.class).category() == null ? "It is not allowed to use NULL as Category!" : "Already registered or unknown!"); } /**