/**
   * @param activeChar
   * @throws IllegalArgumentException
   */
  private void findDualbox(L2PcInstance activeChar, int multibox) throws IllegalArgumentException {
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);

    Map<String, List<L2PcInstance>> ipMap = new HashMap<String, List<L2PcInstance>>();

    String ip = "0.0.0.0";
    L2GameClient client;

    final Map<String, Integer> dualboxIPs = new HashMap<String, Integer>();

    for (L2PcInstance player : players) {
      client = player.getClient();
      if (client.isDetached()) continue;
      else {
        ip = client.getConnection().getInetAddress().getHostAddress();
        if (ipMap.get(ip) == null) ipMap.put(ip, new ArrayList<L2PcInstance>());
        ipMap.get(ip).add(player);

        if (ipMap.get(ip).size() >= multibox) {
          Integer count = dualboxIPs.get(ip);
          if (count == null) dualboxIPs.put(ip, multibox);
          else dualboxIPs.put(ip, count + 1);
        }
      }
    }

    List<String> keys = new ArrayList<String>(dualboxIPs.keySet());
    Collections.sort(
        keys,
        new Comparator<String>() {
          public int compare(String left, String right) {
            return dualboxIPs.get(left).compareTo(dualboxIPs.get(right));
          }
        });
    Collections.reverse(keys);

    final StringBuilder results = new StringBuilder();
    for (String dualboxIP : keys) {
      StringUtil.append(
          results,
          "<a action=\"bypass -h admin_find_ip "
              + dualboxIP
              + "\">"
              + dualboxIP
              + " ("
              + dualboxIPs.get(dualboxIP)
              + ")</a><br1>");
    }

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/dualbox.htm");
    adminReply.replace("%multibox%", String.valueOf(multibox));
    adminReply.replace("%results%", results.toString());
    activeChar.sendPacket(adminReply);
  }
  /**
   * @param activeChar
   * @param IpAdress
   * @throws IllegalArgumentException
   */
  private void findCharactersPerIp(L2PcInstance activeChar, String IpAdress)
      throws IllegalArgumentException {
    boolean findDisconnected = false;

    if (IpAdress.equals("disconnected")) {
      findDisconnected = true;
    } else {
      if (!IpAdress.matches(
          "^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
        throw new IllegalArgumentException("Malformed IPv4 number");
    }
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players;
    // synchronized (L2World.getInstance().getAllPlayers())
    {
      players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    }
    int CharactersFound = 0;
    L2GameClient client;
    String name, ip = "0.0.0.0";
    final StringBuilder replyMSG = new StringBuilder(1000);
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/ipfind.htm");
    for (L2PcInstance player : players) {
      client = player.getClient();
      if (client.isDetached()) {
        if (!findDisconnected) {
          continue;
        }
      } else {
        if (findDisconnected) {
          continue;
        } else {
          ip = client.getConnection().getInetAddress().getHostAddress();
          if (!ip.equals(IpAdress)) continue;
        }
      }

      name = player.getName();
      CharactersFound = CharactersFound + 1;
      StringUtil.append(
          replyMSG,
          "<tr><td width=80><a action=\"bypass -h admin_character_list ",
          name,
          "\">",
          name,
          "</a></td><td width=110>",
          player.getTemplate().className,
          "</td><td width=40>",
          String.valueOf(player.getLevel()),
          "</td></tr>");

      if (CharactersFound > 20) break;
    }
    adminReply.replace("%results%", replyMSG.toString());

    final String replyMSG2;

    if (CharactersFound == 0) {
      replyMSG2 = MessageTable.Messages[681].getMessage();
    } else if (CharactersFound > 20) {
      adminReply.replace(
          "%number%", MessageTable.Messages[1213].getMessage() + String.valueOf(CharactersFound));
      replyMSG2 = MessageTable.Messages[682].getMessage();
    } else if (CharactersFound == 1) {
      replyMSG2 = MessageTable.Messages[1196].getMessage();
    } else {
      replyMSG2 = MessageTable.Messages[1197].getMessage();
    }
    adminReply.replace("%ip%", ip);
    adminReply.replace("%number%", String.valueOf(CharactersFound));
    adminReply.replace("%end%", replyMSG2);
    activeChar.sendPacket(adminReply);
  }