From b92a9f8f757ee6bf9e7e7c98eeab349ac01f9064 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Tue, 16 Aug 2022 17:09:12 +0200 Subject: auto reloading the api data every 3 minutes --- .../miscgui/minionhelper/loaders/MinionHelperApiLoader.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/main/java/io') 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; -- cgit