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());