aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorLorenz <lo.scherf@gmail.com>2022-08-16 17:09:12 +0200
committerLorenz <lo.scherf@gmail.com>2022-08-16 17:09:12 +0200
commitb92a9f8f757ee6bf9e7e7c98eeab349ac01f9064 (patch)
tree8e99019f6aa2d5849c1c8aed2442f36d540882eb /src/main/java/io
parentdcc12db33655e95ba2015bcdfe14e64b576d6015 (diff)
downloadNotEnoughUpdates-b92a9f8f757ee6bf9e7e7c98eeab349ac01f9064.tar.gz
NotEnoughUpdates-b92a9f8f757ee6bf9e7e7c98eeab349ac01f9064.tar.bz2
NotEnoughUpdates-b92a9f8f757ee6bf9e7e7c98eeab349ac01f9064.zip
auto reloading the api data every 3 minutes
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
index cf12a099..de0aff7e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/minionhelper/loaders/MinionHelperApiLoader.java
@@ -52,6 +52,7 @@ public class MinionHelperApiLoader {
private boolean apiReadyToUse = false;
private ApiData apiData = null;
private boolean notifyNoCollectionApi = false;
+ private long lastLoaded = 0;
public MinionHelperApiLoader(MinionHelperManager manager) {
this.manager = manager;
@@ -75,10 +76,15 @@ public class MinionHelperApiLoader {
if (dirty) {
load();
+ } else {
+ if (System.currentTimeMillis() > lastLoaded + 60_000 * 3) {
+ dirty = true;
+ }
}
}
private void load() {
+ lastLoaded = System.currentTimeMillis();
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
if (thePlayer == null) return;