Lioy Posted August 8, 2015 Posted August 8, 2015 (edited) Since topzone changed again , you need to change the code. Use this one to solve your problem. Just the getTopZoneVotes() method (just changed Frozen's one) protected int getTopZoneVotes() { int votes = -1; URL url = null; URLConnection con = null; InputStream is = null; InputStreamReader isr = null; BufferedReader in = null; try { url = new URL(PowerPakConfig.VOTES_SITE_TOPZONE_URL); con = url.openConnection(); con.addRequestProperty("User-Agent", "L2TopZone"); is = con.getInputStream(); isr = new InputStreamReader(is); in = new BufferedReader(isr); String inputLine; while ((inputLine = in.readLine()) != null) { if (inputLine.contains("thumbs-up")) { int startPosition = inputLine.indexOf("</i>") + "</i>".length(); int endPosition = inputLine.indexOf("</span>", startPosition); String ss = inputLine.substring(startPosition, endPosition); votes = Integer.valueOf(ss); break; } } } catch (final Exception e) { LOGGER.warn("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link"); Announcements.getInstance().gameAnnounceToAll("[AutoVoteReward] TOPZONE is offline. We will check reward as it will be online again"); // e.printStackTrace(); } finally { if (in != null) try { in.close(); } catch (final IOException e1) { e1.printStackTrace(); } if (isr != null) try { isr.close(); } catch (final IOException e1) { e1.printStackTrace(); } if (is != null) try { is.close(); } catch (final IOException e1) { e1.printStackTrace(); } } return votes; } Edited August 8, 2015 by PonyRider❤ Quote
`NeverMore Posted August 8, 2015 Posted August 8, 2015 (edited) or simply -> http://l2topzone.com/forum/announcements-and-news/1/fix-for-vote-reward-that-use-total-votes/23902/ Edited August 8, 2015 by `NeverMore Quote
Lioy Posted August 8, 2015 Author Posted August 8, 2015 (edited) or simply -> http://l2topzone.com/forum/announcements-and-news/1/fix-for-vote-reward-that-use-total-votes/23902/ Never seen that before xD , but I think it changed again and code needs to be edited (not like my version ofc, there are too many ways) since code doesn't fit. I mean there were some <span> html tags in old topzone vote site's source code and now there aren't (and code was based on these spans , in Frozen's version at least). Edited August 9, 2015 by PonyRider❤ Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.