Package org.melonbrew.fe.command

Examples of org.melonbrew.fe.command.SubCommand


            sendDefaultCommand(sender, cmd, commandLabel, args);

            return true;
        }

        SubCommand command = getCommand(args[0]);

        if (command == null) {
            sendDefaultCommand(sender, cmd, commandLabel, args);

            return true;
        }

        boolean console = !(sender instanceof Player);

        if (console && args.length < 2 && command.getCommandType() == CommandType.CONSOLE_WITH_ARGUMENTS) {
            Phrase.COMMAND_NEEDS_ARGUMENTS.sendWithPrefix(sender);

            return true;
        }

        if (console && command.getCommandType() == CommandType.PLAYER) {
            Phrase.COMMAND_NOT_CONSOLE.sendWithPrefix(sender, commandLabel);

            return true;
        }

        if (!sender.hasPermission(command.getPermission())) {
            Phrase.NO_PERMISSION_FOR_COMMAND.sendWithPrefix(sender);

            return true;
        }

        String[] realArgs = new String[args.length - 1];

        for (int i = 1; i < args.length; i++) {
            realArgs[i - 1] = args[i];
        }

        if (!command.onCommand(sender, cmd, commandLabel, realArgs)) {
            Phrase.TRY_COMMAND.sendWithPrefix(sender, parse(commandLabel, command));
        }

        return true;
    }
View Full Code Here

TOP

Related Classes of org.melonbrew.fe.command.SubCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.