use of cn.nukkit.command.simple.CommandPermission in project Nukkit by Nukkit.
the class SimpleCommandMap method registerSimpleCommands.
@Override
public void registerSimpleCommands(Object object) {
for (Method method : object.getClass().getDeclaredMethods()) {
cn.nukkit.command.simple.Command def = method.getAnnotation(cn.nukkit.command.simple.Command.class);
if (def != null) {
SimpleCommand sc = new SimpleCommand(object, method, def.name(), def.description(), def.usageMessage(), def.aliases());
Arguments args = method.getAnnotation(Arguments.class);
if (args != null) {
sc.setMaxArgs(args.max());
sc.setMinArgs(args.min());
}
CommandPermission perm = method.getAnnotation(CommandPermission.class);
if (perm != null) {
sc.setPermission(perm.value());
}
if (method.isAnnotationPresent(ForbidConsole.class)) {
sc.setForbidConsole(true);
}
this.register(def.name(), sc);
}
}
}
Aggregations