예제 #1
0
  private void player(Player player, String[] args) {
    int mode = Integer.parseInt(args[1]);

    if (args.length == 3) {
      Player receiver = Canary.getServer().matchPlayer(args[2]);

      if (receiver == null) {
        player.notice(Translator.translateAndFormat("unknown player", args[2]));
      } else {
        receiver.setModeId(mode);
        player.notice(
            Translator.translateAndFormat(
                "mode set other", receiver.getName(), GameMode.fromId(mode).name()));
      }
    } else {
      player.setModeId(mode);
    }
  }
예제 #2
0
  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]));
      }
    }
  }