aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2024-01-04 11:13:43 +0100
committerGitHub <noreply@github.com>2024-01-04 11:13:43 +0100
commit193c0c8acd7dfefadd496b50ce2ecf2ff12a35f7 (patch)
tree5897b15237181de13f81069382671cf65277f290 /src/main/java
parented5b74e3d9fc3056187cd153a118019b657e061a (diff)
downloadNotEnoughUpdates-193c0c8acd7dfefadd496b50ce2ecf2ff12a35f7.tar.gz
NotEnoughUpdates-193c0c8acd7dfefadd496b50ce2ecf2ff12a35f7.tar.bz2
NotEnoughUpdates-193c0c8acd7dfefadd496b50ce2ecf2ff12a35f7.zip
Fixed another rift page crash (#992)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
index 62948b9b..93878bf0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
@@ -124,6 +124,7 @@ public class RiftPage extends GuiProfileViewerPage {
"rift.dead_cats",
new JsonObject()
).getAsJsonObject();
+
if (deadCats != null && !deadCats.entrySet().isEmpty() && deadCats.has("found_cats")) {
JsonArray foundCats = Utils.getElementOrDefault(
selectedProfile.getProfileJson(),
@@ -186,10 +187,11 @@ public class RiftPage extends GuiProfileViewerPage {
}
// Timecharms
-
- JsonObject gallery = riftData.getAsJsonObject("gallery");
- JsonArray timecharm = gallery.getAsJsonArray("secured_trophies");
- // 346, 16
+ JsonArray timecharm = Utils.getElementOrDefault(
+ selectedProfile.getProfileJson(),
+ "rift.gallery.secured_trophies",
+ new JsonArray()
+ ).getAsJsonArray();
if (timecharm != null) {
Utils.renderAlignedString(
@@ -208,7 +210,7 @@ public class RiftPage extends GuiProfileViewerPage {
String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString();
ItemStack timecharmItem = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName(
"RIFT_TROPHY_" + timecharmType.toUpperCase()).resolveToItemStack();
- if(timecharmItem != null) {
+ if (timecharmItem != null) {
displayNames.add(timecharmItem.getDisplayName() + "§7: §a✔");
} else {
displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "ERROR LOADING TIMECHARM!");