From 2f0361abbeeeef99f8aa1d9f86443ee8095a2892 Mon Sep 17 00:00:00 2001 From: Checkium Date: Sun, 11 Mar 2018 19:17:07 +0000 Subject: [PATCH 1/2] Fixed username bug Stats#getUsername was null --- build.gradle | 2 ++ src/main/java/examples/BrainStormExample.java | 1 + .../olympiccode/vhackos/api/entities/impl/vHackOSAPIImpl.java | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7d6160b..0538805 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ sourceCompatibility = 1.8 repositories { mavenCentral() + maven { url 'https://jitpack.io' } } dependencies { @@ -17,6 +18,7 @@ dependencies { compile group: 'org.json', name: 'json', version: '20090211' compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1' compileOnly 'org.projectlombok:lombok:1.16.20' + compile 'net.olympiccode:vHackOSAPI-Java:dev-SNAPSHOT' } shadowJar.destinationDir = file("/build/libs") diff --git a/src/main/java/examples/BrainStormExample.java b/src/main/java/examples/BrainStormExample.java index 253a5da..1c5d130 100644 --- a/src/main/java/examples/BrainStormExample.java +++ b/src/main/java/examples/BrainStormExample.java @@ -51,6 +51,7 @@ public static void main(String[] args) { // api.getAppManager().getApp(AppType.Spam).getAsUpdateable().fillTasks(); int lvl = 10000000; App capp = null; + System.out.println(api.getStats().getUsername()); System.out.println(api.getAppManager().getApps()); for (App app : api.getAppManager().getApps()) { if (!app.isInstalled() && app.getRequiredLevel() <= api.getStats().getLevel()) app.getAsInstallable().install(); diff --git a/src/main/java/net/olympiccode/vhackos/api/entities/impl/vHackOSAPIImpl.java b/src/main/java/net/olympiccode/vhackos/api/entities/impl/vHackOSAPIImpl.java index b6ca068..3481ab3 100644 --- a/src/main/java/net/olympiccode/vhackos/api/entities/impl/vHackOSAPIImpl.java +++ b/src/main/java/net/olympiccode/vhackos/api/entities/impl/vHackOSAPIImpl.java @@ -111,7 +111,7 @@ private void updateData() { stats.setLevel(Long.parseLong(object.optString("level", "0"))); stats.setLevelPorcentage(Long.parseLong(object.optString("exppc", "0"))); stats.setMoney(Long.parseLong(object.optString("money", "0"))); - stats.setUsername(object.optString("statsname")); + stats.setUsername(object.optString("username")); stats.setNetcoins(Long.parseLong(object.optString("netcoins", "0"))); stats.setRequiredExperience(Long.parseLong(object.optString("expreq", "0"))); } catch (JSONException e) { From 3bde9e2d2bf499fc94090f4d4ea05b0e36a1a957 Mon Sep 17 00:00:00 2001 From: Checkium Date: Sun, 11 Mar 2018 19:18:44 +0000 Subject: [PATCH 2/2] buid.gradle error *facepalm* --- build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0538805..91c3135 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,6 @@ dependencies { compile group: 'org.json', name: 'json', version: '20090211' compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1' compileOnly 'org.projectlombok:lombok:1.16.20' - compile 'net.olympiccode:vHackOSAPI-Java:dev-SNAPSHOT' } shadowJar.destinationDir = file("/build/libs")