Пример #1
0
  public static void tpNext() {
    checkId++;
    if (checkId >= wakeups.size()) {
      p.msg(checkPlayer, p.languageReader.get("Player_WakeLast"));
      checkId = -1;
      checkPlayer = null;
      return;
    }

    Wakeup wakeup = wakeups.get(checkId);
    if (!wakeup.active) {
      tpNext();
      return;
    }

    String world = wakeup.loc.getWorld().getName();
    int x = (int) wakeup.loc.getX();
    int y = (int) wakeup.loc.getY();
    int z = (int) wakeup.loc.getZ();

    if (wakeup.check()) {
      p.msg(
          checkPlayer,
          p.languageReader.get("Player_WakeTeleport", "" + checkId, world, "" + x, "" + y, "" + z));
      checkPlayer.teleport(wakeup.loc);
    } else {
      p.msg(
          checkPlayer,
          p.languageReader.get("Player_WakeFilled", "" + checkId, world, "" + x, "" + y, "" + z));
    }
    p.msg(checkPlayer, p.languageReader.get("Player_WakeHint1"));
    p.msg(checkPlayer, p.languageReader.get("Player_WakeHint2"));
  }
Пример #2
0
  public static void check(CommandSender sender, int id, boolean all) {
    if (sender instanceof Player) {
      Player player = (Player) sender;

      if (!all) {
        if (wakeups.isEmpty() || id >= wakeups.size()) {
          p.msg(sender, p.languageReader.get("Player_WakeNotExist", "" + id));
          return;
        }

        Wakeup wakeup = wakeups.get(id);
        if (wakeup.check()) {
          player.teleport(wakeup.loc);
        } else {
          String world = wakeup.loc.getWorld().getName();
          int x = (int) wakeup.loc.getX();
          int y = (int) wakeup.loc.getY();
          int z = (int) wakeup.loc.getZ();
          p.msg(
              sender,
              p.languageReader.get("Player_WakeFilled", "" + id, world, "" + x, "" + y, "" + z));
        }

      } else {
        if (wakeups.isEmpty()) {
          p.msg(sender, p.languageReader.get("Player_WakeNoPoints"));
          return;
        }
        if (checkPlayer != null && checkPlayer != player) {
          checkId = -1;
        }
        checkPlayer = player;
        tpNext();
      }

    } else {
      p.msg(sender, p.languageReader.get("Error_PlayerCommand"));
    }
  }