diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2022-10-21 06:32:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-20 23:32:47 -0700 |
commit | d1f618d8e952ee2ac2cba4b97df7677773c66472 (patch) | |
tree | 1f1502929060ecbbc56cd710ee6002760eaf22bb | |
parent | 0a5c62857747c80ce039fcef182c7098a4a0503a (diff) | |
download | NotEnoughUpdates-d1f618d8e952ee2ac2cba4b97df7677773c66472.tar.gz NotEnoughUpdates-d1f618d8e952ee2ac2cba4b97df7677773c66472.tar.bz2 NotEnoughUpdates-d1f618d8e952ee2ac2cba4b97df7677773c66472.zip |
Fix dungeon page going blank (#382)
382/merge
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java index 15a70ded..6d59db27 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/DungeonPage.java @@ -124,7 +124,6 @@ public class DungeonPage extends GuiProfileViewerPage { ProfileViewer.Profile profile = GuiProfileViewer.getProfile(); String profileId = GuiProfileViewer.getProfileId(); JsonObject hypixelInfo = profile.getHypixelProfile(); - if (hypixelInfo == null) return; JsonObject profileInfo = profile.getProfileInformation(profileId); if (profileInfo == null) return; @@ -443,7 +442,10 @@ public class DungeonPage extends GuiProfileViewerPage { //Random stats - float secrets = Utils.getElementAsFloat(Utils.getElement(hypixelInfo, "achievements.skyblock_treasure_hunter"), 0); + float secrets = -1; + if (hypixelInfo != null) { + secrets = Utils.getElementAsFloat(Utils.getElement(hypixelInfo, "achievements.skyblock_treasure_hunter"), 0); + } float totalRunsF = 0; float totalRunsF5 = 0; for (int i = 1; i <= 7; i++) { @@ -507,14 +509,14 @@ public class DungeonPage extends GuiProfileViewerPage { ); Utils.renderAlignedString( EnumChatFormatting.YELLOW + "Secrets (Total) ", - EnumChatFormatting.WHITE + StringUtils.shortNumberFormat(secrets), + EnumChatFormatting.WHITE + (secrets == -1 ? "?" : StringUtils.shortNumberFormat(secrets)), x, miscTopY + 20, sectionWidth ); Utils.renderAlignedString( EnumChatFormatting.YELLOW + "Secrets (/Run) ", - EnumChatFormatting.WHITE.toString() + (Math.round(secrets / Math.max(1, totalRuns) * 100) / 100f), + EnumChatFormatting.WHITE.toString() + (secrets == -1 ? "?" : (Math.round(secrets / Math.max(1, totalRuns) * 100) / 100f)), x, miscTopY + 30, sectionWidth |