public boolean handleCommand(CommandSender sender, String commandString, boolean testOnly) { boolean noSlash = true; if (commandString.startsWith("/")) { noSlash = false; commandString = commandString.substring(1); } for (MCommand<?> command : this.getBaseCommands()) { if (noSlash && !command.allowNoSlashAccess) continue; for (String alias : command.aliases) { if (commandString.startsWith(alias + " ") || commandString.equals(alias)) { List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+"))); args.remove(0); if (testOnly) return true; command.execute(sender, args); return true; } } } return false; }
public BukkitGlueCommand(String name, MCommand mcommand, Plugin plugin) { super(name, mcommand.getDesc(), mcommand.getUseageTemplate(), new ArrayList<String>()); this.mcommand = mcommand; this.plugin = plugin; }