diff options
| author | efefury <69400149+efefury@users.noreply.github.com> | 2022-08-21 10:37:00 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-21 20:37:00 +1000 |
| commit | 013abf6525c39b99afdeba62d33dbeac9b9f766e (patch) | |
| tree | b87a8204253ac195664131231e66f20fa60723c8 /src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java | |
| parent | 38771c209e98c8e0a5325798c0c99101d00f0762 (diff) | |
| download | notenoughupdates-013abf6525c39b99afdeba62d33dbeac9b9f766e.tar.gz notenoughupdates-013abf6525c39b99afdeba62d33dbeac9b9f766e.tar.bz2 notenoughupdates-013abf6525c39b99afdeba62d33dbeac9b9f766e.zip | |
misc dungeon profit changes (#240)
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java index 74409648..4e920aea 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -61,6 +61,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -87,6 +89,8 @@ public class SBInfo { public Date currentTimeDate = null; + private JsonObject mayorJson = new JsonObject(); + /** * Use Utils.getOpenChestName() instead */ @@ -97,6 +101,7 @@ public class SBInfo { private long lastManualLocRaw = -1; private long lastLocRaw = -1; public long joinedWorld = -1; + private long lastMayorUpdate; public long unloadedWorld = -1; private JsonObject locraw = null; public boolean isInDungeon = false; @@ -297,7 +302,10 @@ public class SBInfo { lastLocRaw = System.currentTimeMillis(); NotEnoughUpdates.INSTANCE.sendChatMessage("/locraw"); } - + if (currentTime - lastMayorUpdate > 300 * 1000) { + updateMayor(); + lastMayorUpdate = currentTime; + } try { for (NetworkPlayerInfo info : Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()) { String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); @@ -421,4 +429,17 @@ public class SBInfo { e.printStackTrace(); } } + + public void updateMayor() { + NotEnoughUpdates.INSTANCE.manager.hypixelApi.getHypixelApiAsync( + NotEnoughUpdates.INSTANCE.config.apiData.apiKey, + "resources/skyblock/election", + new HashMap<>() + ).thenAcceptAsync(newJson -> mayorJson = newJson); + } + + + public JsonObject getMayorJson() { + return mayorJson; + } } |
