private void pollServer(ServerNBTStorage servernbtstorage) throws IOException { String s = servernbtstorage.host; String as[] = s.split(":"); if(s.startsWith("[")) { int i = s.indexOf("]"); if(i > 0) { String s2 = s.substring(1, i); String s3 = s.substring(i + 1).trim(); if(s3.startsWith(":") && s3.length() > 0) { s3 = s3.substring(1); as = new String[2]; as[0] = s2; as[1] = s3; } else { as = new String[1]; as[0] = s2; } } } if(as.length > 2) { as = new String[1]; as[0] = s; } String s1 = as[0]; int j = as.length <= 1 ? 25565 : parseIntWithDefault(as[1], 25565); Socket socket = null; DataInputStream datainputstream = null; DataOutputStream dataoutputstream = null; try { socket = new Socket(); socket.setSoTimeout(3000); socket.setTcpNoDelay(true); socket.setTrafficClass(18); socket.connect(new InetSocketAddress(s1, j), 3000); datainputstream = new DataInputStream(socket.getInputStream()); dataoutputstream = new DataOutputStream(socket.getOutputStream()); dataoutputstream.write(254); if(datainputstream.read() != 255) { throw new IOException("Bad message"); } String s4 = Packet.readString(datainputstream, 64); char ac[] = s4.toCharArray(); for(int k = 0; k < ac.length; k++) { if(ac[k] != '\247' && ChatAllowedCharacters.allowedCharacters.indexOf(ac[k]) < 0) { ac[k] = '?'; } } s4 = new String(ac); String as1[] = s4.split("\247"); s4 = as1[0]; int l = -1; int i1 = -1; try { l = Integer.parseInt(as1[1]); i1 = Integer.parseInt(as1[2]); } catch(Exception exception) { } servernbtstorage.motd = (new StringBuilder()).append("\2477").append(s4).toString(); if(l >= 0 && i1 > 0) { servernbtstorage.playerCount = (new StringBuilder()).append("\2477").append(l).append("\2478/\2477").append(i1).toString(); } else { servernbtstorage.playerCount = "\2478???"; } } finally { try { if(datainputstream != null) { datainputstream.close(); } } catch(Throwable throwable) { } try { if(dataoutputstream != null) { dataoutputstream.close(); } } catch(Throwable throwable1) { } try { if(socket != null) { socket.close(); } } catch(Throwable throwable2) { } } }