Detroitas Posted December 11, 2016 Share Posted December 11, 2016 So i need change that: With that? Quote Link to comment Share on other sites More sharing options...
Waster Posted December 11, 2016 Share Posted December 11, 2016 So i need change that: With that? Yes Quote Link to comment Share on other sites More sharing options...
Reborn12 Posted December 11, 2016 Share Posted December 11, 2016 (edited) Not all only the lines replace yours with this is just the same String line; while ((line = in.readLine()) != null) { if (line.contains("Total Votes") ) { String inputLine = line.split(">")[2].replace("</span", ""); votes = Integer.parseInt(inputLine); break; Edited December 11, 2016 by Reborn12 Quote Link to comment Share on other sites More sharing options...
Detroitas Posted December 11, 2016 Share Posted December 11, 2016 Quote Link to comment Share on other sites More sharing options...
Reborn12 Posted December 11, 2016 Share Posted December 11, 2016 Send me here or in pastebin the method pls Quote Link to comment Share on other sites More sharing options...
Detroitas Posted December 11, 2016 Share Posted December 11, 2016 http://pastebin.com/0w8muvzF - Hopzone.java Quote Link to comment Share on other sites More sharing options...
Reborn12 Posted December 11, 2016 Share Posted December 11, 2016 @Override public int getVotes() { int votes = -1; try { final URL obj = new URL(Config.VOTES_SITE_HOPZONE_URL); final HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.addRequestProperty("User-Agent", "L2Hopzone"); con.setConnectTimeout(5000); final int responseCode = con.getResponseCode(); if (responseCode == 200) { try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String line; while ((line = in.readLine()) != null) { if (line.contains("Total Votes") ) { String inputLine = line.split(">")[2].replace("</span", ""); votes = Integer.parseInt(inputLine); break; } } } } } catch (Exception e) { e.printStackTrace(); System.out.println("Error while getting server vote count from "+getSiteName()+"."); } return votes; } Quote Link to comment Share on other sites More sharing options...
Detroitas Posted December 11, 2016 Share Posted December 11, 2016 Quote Link to comment Share on other sites More sharing options...
An4rchy Posted December 11, 2016 Author Share Posted December 11, 2016 Since hopzone has an API to get the total votes you should use that. I used the old way in this vote system by reading the votes from the server information page. Quote Link to comment Share on other sites More sharing options...
Reborn12 Posted December 11, 2016 Share Posted December 11, 2016 Import it.. Quote Link to comment Share on other sites More sharing options...
Detroitas Posted December 11, 2016 Share Posted December 11, 2016 Import it.. what do you mean? Sorry for a lot of questions, i'm really new on it.. Quote Link to comment Share on other sites More sharing options...
Reborn12 Posted December 11, 2016 Share Posted December 11, 2016 Simpy let your mouse cursor on it and eclipse will give you some choices select to import this Quote Link to comment Share on other sites More sharing options...
Detroitas Posted December 11, 2016 Share Posted December 11, 2016 Quote Link to comment Share on other sites More sharing options...
Reborn12 Posted December 11, 2016 Share Posted December 11, 2016 Click on first Quote Link to comment Share on other sites More sharing options...
Detroitas Posted December 11, 2016 Share Posted December 11, 2016 Click on first now ok with code, i will check it later then i fix tvt problems. Quote Link to comment Share on other sites More sharing options...
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.