aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java4
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt5
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt6
3 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index 62f55fd7..ea852da3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -937,10 +937,10 @@ public class ProfileViewer {
JsonObject profile = skyblockProfiles.get(i).getAsJsonObject();
String cuteName = profile.get("cute_name").getAsString();
- String profileId = profile.get("profile_id").getAsString();
+ String profileId = profile.get("profile_id").getAsString().replace("-", "");
SoopyNetworthData networth;
- if (jsonObject.getAsJsonObject("data").get(profileId).isJsonNull()) {
+ if (jsonObject.getAsJsonObject("data").get(profileId) == null) {
networth = new SoopyNetworthData(null);
} else {
networth = new SoopyNetworthData(jsonObject.getAsJsonObject("data").get(profileId).getAsJsonObject());
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
index bc1a0c74..58da635e 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.kt
@@ -31,6 +31,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.Custom
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager
import io.github.moulberry.notenoughupdates.miscgui.pricegraph.GuiPriceGraph
+import io.github.moulberry.notenoughupdates.util.ApiCache
import io.github.moulberry.notenoughupdates.util.PronounDB
import io.github.moulberry.notenoughupdates.util.SBInfo
import io.github.moulberry.notenoughupdates.util.TabListUtils
@@ -186,6 +187,10 @@ class DevTestCommand {
NotEnoughUpdates.INSTANCE.saveConfig()
reply("Config saved")
}.withHelp("Force sync the config to disk")
+ thenLiteralExecute("clearapicache") {
+ ApiCache.clear()
+ reply("Cleared API cache")
+ }.withHelp("Clear the API cache")
thenLiteralExecute("searchmode") {
NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = true
reply(AQUA.toString() + "I would never search")
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
index 59fc2dd5..f670346d 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/ApiCache.kt
@@ -151,6 +151,12 @@ object ApiCache {
}
}
+ fun clear() {
+ synchronized(this) {
+ cachedRequests.clear()
+ }
+ }
+
private fun evictCache() {
synchronized(this) {
val it = cachedRequests.iterator()