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;
}