コード例 #1
0
  @EventHandler
  public void pingEvent(ProxyPingEvent e) {

    online = 0;
    slots = 0;

    servers[0] = new Minequery("91.121.7.118", 25571);
    servers[1] = new Minequery("91.121.7.118", 25572);

    for (Minequery query : servers) {
      String result = query.connetti();
      String[] array_query = result.split("/");
      try {
        int s_online = Integer.valueOf(array_query[0]).intValue();
        int s_slots = Integer.valueOf(array_query[1]).intValue();
        online += s_online;
        slots += s_slots;
      } catch (Exception ex) {
      }
    }

    e.setResponse(
        new ServerPing(
            ps.getProtocolVersion(),
            ps.getGameVersion(),
            e.getConnection().getListener().getMotd(),
            online,
            slots));
  }
コード例 #2
0
  public static void main(String[] args) {

    servers[0] = new Minequery("94.23.67.215", 25567);
    servers[1] = new Minequery("94.23.67.215", 25556);

    for (Minequery query : servers) {
      String result = query.connetti();
      System.out.println(result);
      String[] array_query = result.split("/");
      try {
        int s_online = Integer.valueOf(array_query[0]).intValue();
        int s_slots = Integer.valueOf(array_query[1]).intValue();

      } catch (Exception ex) {
      }
    }
  }