/** * Listens for MyChunks commands to execute them * * @param sender The CommandSender who may not be a Player * @param command The command that was executed * @param alias The alias that the sender used * @param args The arguments for the command * @return true always */ public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) { // Cancel if the command is not from a Player if (!(sender instanceof Player)) return true; Player player = (Player) sender; // Display help page if the Player did not add any arguments if (args.length == 0) { sendHelp(player); return true; } Action action; try { action = Action.valueOf(args[0].toUpperCase()); } catch (Exception notEnum) { sendHelp(player); return true; } // Execute the correct command switch (action) { case BUY: buy(player); return true; case SELL: sell(player); return true; case LIST: list(player); return true; case INFO: info(player); return true; case COOWNER: if (args.length == 4) coowner(player, args[2], args[1], args[3]); else sendHelp(player); return true; case CLEAR: clear(player); return true; default: sendHelp(player); return true; } }