Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit d670895

Browse files
authored
Merge pull request #34 from C0mm4nd/master
Fixed a little thing
2 parents 6ce8cb4 + eb694a2 commit d670895

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/main/java/me/checkium/vhackapi/vHackAPI.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class vHackAPI {
1515
protected String password;
1616
protected String username;
1717
protected String userHash;
18+
private JSONObject stats = null;
1819

1920

2021
public Console getConsole() {
@@ -32,14 +33,19 @@ public SpywareManager getSpywareManager() {
3233
}
3334

3435
public String getStats(Stats stat) {
35-
try {
36-
TimeUnit.MILLISECONDS.sleep(200);
37-
} catch (InterruptedException e1) {
38-
e1.printStackTrace();
36+
if(stats == null){
37+
try {
38+
TimeUnit.MILLISECONDS.sleep(200);
39+
} catch (InterruptedException e1) {
40+
e1.printStackTrace();
41+
}
42+
stats = Utils.JSONRequest("user::::pass::::uhash", username + "::::" + password + "::::" + userHash, "vh_update.php");
3943
}
40-
JSONObject json = Utils.JSONRequest("user::::pass::::uhash", username + "::::" + password + "::::" + userHash, "vh_update.php");
41-
42-
return json.getString(stat.toString());
44+
return stats.getString(stat.toString());
45+
}
46+
47+
public void refreshStats() {
48+
stats = null;
4349
}
4450

4551
public PackageOpener getPackageOpener() {

0 commit comments

Comments
 (0)