as kara said, you should use API instead of all those crap connections...
@Kara` How old do you think are the above codes? :D
Ontopic:
try this one:
protected int getL2NetworkVotes()
{
try
{
final URL obj = new URL(PowerPakConfig.VOTES_SITE_L2NETWORK_URL);
final HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.addRequestProperty("User-Agent", "L2Network");
con.setConnectTimeout(5000);
String inputLine;
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())))
{
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("color:#e7ebf2"))
return Integer.valueOf(inputLine.split(">")[2].split("<")[0].replace(",", ""));
}
}
}
catch (Exception e)
{
Broadcast.toAllOnlinePlayers(new CreatureSay(2, Say2.HERO_VOICE,"[Network]", "Offline!"));
Broadcast.toAllOnlinePlayers(new CreatureSay(0, Say2.HERO_VOICE,"[Server Site]", PowerPakConfig.SERVER_WEB_SITE));
}
return -1;
}