aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorVixid <52578495+VixidDev@users.noreply.github.com>2023-03-03 13:15:07 +0000
committerGitHub <noreply@github.com>2023-03-04 00:15:07 +1100
commit974f03b262b9a84ab52ca8ff63d207c923c21601 (patch)
tree6e170162acc4eea8b1e2baa0fb0ddd231ef7eae5 /src/main/java/io
parent4957f0b7d7cc8b06fe6bdb6883a48dbeb2e41ad5 (diff)
downloadNotEnoughUpdates-974f03b262b9a84ab52ca8ff63d207c923c21601.tar.gz
NotEnoughUpdates-974f03b262b9a84ab52ca8ff63d207c923c21601.tar.bz2
NotEnoughUpdates-974f03b262b9a84ab52ca8ff63d207c923c21601.zip
Fixed colour formatting on sb levels >= 360 (#638)
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java15
1 files changed, 7 insertions, 8 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 6f8427ae..62f55fd7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -963,30 +963,29 @@ public class ProfileViewer {
}
double skyblockLevel = getSkyblockLevel(profileName);
+ EnumChatFormatting levelColour = EnumChatFormatting.WHITE;
- EnumChatFormatting previousColor = EnumChatFormatting.WHITE;
if (Constants.SBLEVELS == null || !Constants.SBLEVELS.has("sblevel_colours")) {
Utils.showOutdatedRepoNotification();
return EnumChatFormatting.WHITE;
}
+
JsonObject sblevelColours = Constants.SBLEVELS.getAsJsonObject("sblevel_colours");
try {
for (Map.Entry<String, JsonElement> stringJsonElementEntry : sblevelColours.entrySet()) {
- int key = Integer.parseInt(stringJsonElementEntry.getKey());
+ int nextLevelBracket = Integer.parseInt(stringJsonElementEntry.getKey());
EnumChatFormatting valueByName = EnumChatFormatting.getValueByName(stringJsonElementEntry
.getValue()
.getAsString());
- if (skyblockLevel <= key) {
- skyBlockExperienceColour.put(profileName, previousColor);
- return previousColor;
+ if (skyblockLevel >= nextLevelBracket) {
+ levelColour = valueByName;
}
- previousColor = valueByName;
}
} catch (RuntimeException ignored) {
// catch both numberformat and getValueByName being wrong
}
- skyBlockExperienceColour.put(profileName, EnumChatFormatting.WHITE);
- return EnumChatFormatting.WHITE;
+ skyBlockExperienceColour.put(profileName, levelColour);
+ return levelColour;
}
public double getSkyblockLevel(String profileName) {