// group) rename <foo> <bar> public void execute(MessageReceiver caller, String[] args) { if (args[args.length - 1].equals("--help")) { Canary.help().getHelp(caller, "group rename"); return; } Group group = Canary.usersAndGroups().getGroup(args[1]); if (group == null) { caller.notice(Translator.translateAndFormat("group unknown", args[1])); return; } Canary.usersAndGroups().renameGroup(group, args[2]); caller.message(Colors.YELLOW + Translator.translateAndFormat("group rename", group.getName())); }
private void console(MessageReceiver caller, String[] args) { if (args.length == 1) { caller.notice(Translator.translate("kill console")); } else { Player target = Canary.getServer().matchPlayer(args[1]); if (target != null) { target.kill(); caller.notice(Translator.translateAndFormat("killed other", target.getName())); } else { caller.notice( Translator.translate("not killed") + " " + Translator.translateAndFormat("unknown player", args[1])); } } }
private void console(MessageReceiver caller, String[] args) { if (args.length == 2) { caller.notice(Translator.translate("mode console")); } else { Player target = Canary.getServer().matchPlayer(args[2]); if (target != null) { int mode = Integer.parseInt(args[1]); target.setModeId(mode); caller.notice( Translator.translateAndFormat( "mode set other", target.getName(), GameMode.fromId(mode).name())); } else { caller.notice(Translator.translateAndFormat("unknown player", args[2])); } } }
public void execute(MessageReceiver caller, String[] parameters) { if (caller instanceof Server) { console(caller); } else if (caller instanceof Player) { player((Player) caller, parameters); } else { throw new CommandException( Translator.translateAndFormat( "unknown messagereceiver", caller.getClass().getSimpleName())); } }
public void execute(MessageReceiver caller, String[] parameters) { try { if (caller instanceof Player) { player((Player) caller, parameters); } else { console(caller, parameters); } } catch (NumberFormatException nfex) { caller.notice(nfex.getMessage()); } }
public void execute(MessageReceiver caller, String[] args) { if (caller instanceof Server || caller instanceof CommandBlock) { caller.notice(Translator.translate("warp console")); } else { Player player = (Player) caller; Warp target = Canary.warps().getWarp(args[1]); if (target != null) { if (target.warp(player)) { player.message( Colors.YELLOW + Translator.translateAndFormat("warp success", target.getName())); return; } else { player.message( Colors.YELLOW + Translator.translateAndFormat("warp not allowed", target.getName())); return; } } player.notice(Translator.translateAndFormat("warp unknown", args[1])); } }
private void console(MessageReceiver caller) { caller.notice(Translator.translate("home console")); }