Package net.sourceforge.queried

Examples of net.sourceforge.queried.PlayerInfo


        ArrayList playerInfo = QueriEd.playerQuery(27777, gameType, ip, port);
        if(playerInfo != null && playerInfo.size() > 0) {
            Iterator iter = playerInfo.iterator();
            int count = 0;
            while(iter.hasNext()) {
                PlayerInfo pInfo = (PlayerInfo) iter.next();
                if(count > 0) {
                    System.out.print(", ");
                }
                count++;
                System.out.print(pInfo.getName() +" ["+ pInfo.getScore() +"/"+ pInfo.getKills() +"/"+ pInfo.getDeaths() +"]");
            }
        } else {
            System.out.println("No players");
        }
        System.out.println("");
View Full Code Here


      String[] plyrs = queryResult.split("�>");
      for (int x = 1; x < plyrs.length; x++) {
        String plyr = plyrs[x];
        String name = plyr.substring(2, plyr.length() - 4);

        PlayerInfo player = new PlayerInfo();
        player.setName(name);
        playerInfo.add(player);
      }
      Collections.sort(playerInfo, new ScoreComparator());
    }
View Full Code Here

//    int playerCount = buf[5] & 255;

    int off = 7;

    while (off < buf.length) {
      PlayerInfo playerInfo = new PlayerInfo();
      StringBuffer playerName = new StringBuffer(20);
      while (buf[off] != 0) {
        playerName.append((char) (buf[off++] & 255));
      }
      off++;
      playerInfo.setName(playerName.toString().trim());
      playerInfo.setKills((buf[off] & 255) | ((buf[off + 1] & 255) << 8) |
              ((buf[off + 2] & 255) << 16) | ((buf[off + 3] & 255) << 24));
      sorted.add(playerInfo);
      off += 9;
    }
    Collections.sort(sorted, new KillsComparator());
View Full Code Here

        String plyr = plyrs[x];
        String score = plyr.substring(0, plyr.indexOf(" "));
        String ping = plyr.substring(plyr.indexOf(" ") + 1, plyr.indexOf(" ", plyr.indexOf(" ") + 1));
        String name = plyr.substring(plyr.indexOf("\"") + 1, plyr.lastIndexOf("\""));

        PlayerInfo player = new PlayerInfo();
        player.setKills(Integer.valueOf(score).intValue());
        player.setName(name);
        player.setPing(Integer.valueOf(ping).intValue());
        playerInfo.add(player);
      }
      Collections.sort(playerInfo, new ScoreComparator());
    }
View Full Code Here

      for (int x = 1; x < plyrs.length; x++) {
        String plyr = plyrs[x];
        String score = plyr.substring(0, plyr.indexOf(" "));
        String name = plyr.substring(plyr.lastIndexOf(" "));

        PlayerInfo player = new PlayerInfo();
        player.setKills(Integer.valueOf(score).intValue());
        player.setName(name);
        playerInfo.add(player);
      }
      Collections.sort(playerInfo, new ScoreComparator());
    }
View Full Code Here

    Pattern playerPattern = Pattern.compile("(.)(.)\\x00(.{2})\\x00\\x00([\\w\\s/\\x19-\\x2f\\x51-\\x5e\\x7d\\x7b@!:~_]+)\\x00?([\\w\\s/\\x19-\\x2f\\x51-\\x5e\\x7d\\x7b@!:~_]+|\\x00?)");
    Matcher m = playerPattern.matcher(plyrs);

    while (m.find()) {
      PlayerInfo player = new PlayerInfo();

      byte[] rawPing = m.group(2).getBytes();
      if (rawPing.length > 1) {
        player.setPing(PosInt(rawPing[0]) + PosInt(rawPing[1]));
      } else if (rawPing.length > 0) {
        player.setPing(PosInt(rawPing[0]));
      } else {
        player.setPing(0);
      }
      byte[] rawRate = m.group(3).getBytes();
      if (rawRate.length > 1) {
        player.setRate(PosInt(rawRate[0]) + PosInt(rawRate[1]));
      } else if (rawRate.length > 0) {
        player.setRate(PosInt(rawRate[0]));
      } else {
        player.setRate(15000); // that's probably what it is anyway :-(
      }

      player.setName("\"" + m.group(4) + "\"");

      if (m.group(5).hashCode() != 0) {
        player.setClan("\"" + m.group(5) + "\"");
      } else {
        player.setClan("");
      }

      playerInfo.add(player);
      // testing
      // System.out.println(m.group(4) + " : " + m.group(5).hashCode());
View Full Code Here

    if (recStr != null && recStr.length() > 0) {
      String[] plyrs = recStr.split("deaths_");
      for (int x = 1; x < plyrs.length; x++) {
        String plyrLine = "\\deaths_" + plyrs[x];

        PlayerInfo player = new PlayerInfo();
        player.setDeaths(Integer.valueOf(Util.getPart(plyrLine, "deaths_" + (x - 1))).intValue());
        player.setKills(Integer.valueOf(Util.getPart(plyrLine, "kills_" + (x - 1))).intValue());
        player.setName(Util.getPart(plyrLine, "playername_" + (x - 1)));
        player.setScore(Integer.valueOf(Util.getPart(plyrLine, "score_" + (x - 1))).intValue());
        playerInfo.add(player);
      }
      Collections.sort(playerInfo, new ScoreComparator());
    }
    return playerInfo;
View Full Code Here

      for (String plyr : plyrs) {
        String score = plyr.substring(0, plyr.indexOf(" ")).trim();
        String whatsit = plyr.substring(plyr.indexOf(" "), plyr.lastIndexOf(" ")).trim();
        String name = plyr.substring(plyr.indexOf("\"") + 1, plyr.lastIndexOf("\"")).trim();
        PlayerInfo player = new PlayerInfo();

        player.setKills(Integer.valueOf(score).intValue());
        player.setName(name);
        player.setScore(Integer.valueOf(whatsit).intValue());
        playerInfo.add(player);

      }
      Collections.sort(playerInfo, new ScoreComparator());
View Full Code Here

    String[] skills = assembleParts(recStr, "skill_");

    try {
      for (int i = 0; i < players.length; i++) {
        PlayerInfo player = new PlayerInfo();
        // name
        player.setName(players[i]);
        // score
        player.setScore(Integer.valueOf(scores[i]).intValue());
        // deaths
        player.setDeaths(Integer.valueOf(deaths[i]).intValue());
        // kills
        player.setKills(Integer.valueOf(skills[i]).intValue());
        playerInfo.add(player);
      }
    } catch (ArrayIndexOutOfBoundsException aiex) {
      // was time to break out - end of getting correct info
    } catch (NumberFormatException nfex) {
View Full Code Here

    if (recStr != null && recStr.length() > 0) {
      String[] plyrs = recStr.split("player_");
      for (int x = 1; x < plyrs.length; x++) {
        String plyrLine = "\\player_" + plyrs[x];

        PlayerInfo player = new PlayerInfo();
        player.setName(Util.getPart(plyrLine, "player_" + (x - 1)));
        player.setKills(Integer.valueOf(Util.getPart(plyrLine, "frags_" + (x - 1))).intValue());
        playerInfo.add(player);
      }
      Collections.sort(playerInfo, new ScoreComparator());
    }
    return playerInfo;
View Full Code Here

TOP

Related Classes of net.sourceforge.queried.PlayerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.