diff options
| author | Lulonaut <67191924+Lulonaut@users.noreply.github.com> | 2022-04-13 07:53:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-13 05:53:52 +0000 |
| commit | 6ca951d739913486e9a345be47ab467bad8e97c3 (patch) | |
| tree | 64cc968deddbef07bfbe396cb2174ac544655f1a /src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java | |
| parent | 0f7fb90f9a757117584daf37b6eba8b37add1518 (diff) | |
| download | notenoughupdates-6ca951d739913486e9a345be47ab467bad8e97c3.tar.gz notenoughupdates-6ca951d739913486e9a345be47ab467bad8e97c3.tar.bz2 notenoughupdates-6ca951d739913486e9a345be47ab467bad8e97c3.zip | |
Crimson Essence support (#110)
* jani1
* update bingo more often
* crimson support
* move method to Utils
* remove debug prints
* fix single items
* gray items
* improvements
better variable names
fix behavior from 10 to 15 stars
use EnumChatFormatting instead of the color code directly
* fix dungeonize cost
* remove master stars check
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java | 21 |
1 files changed, 14 insertions, 7 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 b8f8554e..22656b1a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -20,7 +20,13 @@ import net.minecraft.util.EnumChatFormatting; import javax.annotation.Nullable; import java.io.ByteArrayInputStream; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.regex.Matcher; @@ -477,12 +483,13 @@ public class ProfileViewer { } public JsonObject getBingoInformation() { - if (bingoInformation != null) return bingoInformation; - if (updatingBingoInfo.get()) return null; - long currentTime = System.currentTimeMillis(); - if (currentTime - lastBingoInfoState < 15 * 1000) return null; + if (bingoInformation != null && currentTime - lastBingoInfoState < 15 * 1000) return bingoInformation; + if (updatingBingoInfo.get() && bingoInformation != null) return bingoInformation; + if (updatingBingoInfo.get() && bingoInformation == null) return null; + lastBingoInfoState = currentTime; + updatingBingoInfo.set(true); HashMap<String, String> args = new HashMap<>(); args.put("uuid", "" + uuid); @@ -492,15 +499,15 @@ public class ProfileViewer { args, jsonObject -> { if (jsonObject == null) return; - updatingBingoInfo.set(false); if (jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { bingoInformation = jsonObject; } else { bingoInformation = null; } + updatingBingoInfo.set(false); }, () -> updatingBingoInfo.set(false) ); - return null; + return bingoInformation != null ? bingoInformation : null; } public long getNetWorth(String profileId) { |
