Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int getTopzoneVotes()
- {
- int votes = -1;
- try
- {
- final URL obj = new URL(Config.VOTES_SITE_TOPZONE_URL);
- final HttpURLConnection con = (HttpURLConnection) obj.openConnection();
- con.addRequestProperty("User-Agent", "L2TopZone");
- con.setConnectTimeout(5000);
- final int responseCode = con.getResponseCode();
- if (responseCode == 200)
- {
- try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())))
- {
- String inputLine;
- while ((inputLine = in.readLine()) != null)
- {
- if (inputLine.contains("Votes:"))
- {
- votes = Integer.valueOf(inputLine.split("<br>")[1].replace("</div>", ""));
- break;
- }
- }
- }
- }
- }
- catch (Exception e)
- {
- announce("TOPZONE is offline. We will check reward as it will be online again.");
- }
- return votes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement