Hello guys i have one problem with the vote manager at l2network, when the votes are until 999 the vote manager work
but when goes 1000 and up i got error because the website write the votes 1,000 with a comma.
maybe someone can help me to work this ?
ERROR RequestByPassToServer.runImpl : invalid number format
java.lang.NumberFormatException: For input string: "19,474"
the code is this
public static int getL2NetworkVotes()
{
int votes = 0;
boolean lineFound = false;
try
{
URL url = new URL(Config.VOTES_SITE_L2NETWORK_URL);
InputStream is = url.openStream();
try (
BufferedReader br = new BufferedReader(new InputStreamReader(is)))
{
String line;
while ((line = br.readLine()) != null)
{
if (line.contains("color:#e7ebf2"))
votes = Integer.parseInt(line.split(">")[2].split("<")[0]);
lineFound = true;
}
}
}
catch (IOException e)
{
e.printStackTrace();
System.out.println("NetWork is offline. We will check reward as it will be online again.");
}
if (!lineFound)
System.out.println("The line wasn't found in Network, check site in case they updated.");
return votes;
}
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.
Not any training model, i should fix that, just a very well done bot engine. As we use it on a local Internet Cafe spot and people join to test server, they don't seem to understand they are bots. Their behaviour is really well done. Many actions that other bots can't do are possible and the are complicated patterns that can be done due to structure of the engine such as Pick items of dead party pk member and later on trade them back to owner. So i'll fix later the title to Bot Engine rather than A.I.
Question
cyta5
Hello guys i have one problem with the vote manager at l2network, when the votes are until 999 the vote manager work
but when goes 1000 and up i got error because the website write the votes 1,000 with a comma.
maybe someone can help me to work this ?
ERROR RequestByPassToServer.runImpl : invalid number format java.lang.NumberFormatException: For input string: "19,474"
the code is this
public static int getL2NetworkVotes() { int votes = 0; boolean lineFound = false; try { URL url = new URL(Config.VOTES_SITE_L2NETWORK_URL); InputStream is = url.openStream(); try ( BufferedReader br = new BufferedReader(new InputStreamReader(is))) { String line; while ((line = br.readLine()) != null) { if (line.contains("color:#e7ebf2")) votes = Integer.parseInt(line.split(">")[2].split("<")[0]); lineFound = true; } } } catch (IOException e) { e.printStackTrace(); System.out.println("NetWork is offline. We will check reward as it will be online again."); } if (!lineFound) System.out.println("The line wasn't found in Network, check site in case they updated."); return votes; }
4 answers to this question
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.