SimpleCommandMap.java 文件源码

java
阅读 43 收藏 0 点赞 0 评论 0

项目:Jupiter 作者:
@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);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号