aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java12
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt9
2 files changed, 15 insertions, 6 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
index f26cab17..253ff17e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 NotEnoughUpdates contributors
+ * Copyright (C) 2022-2024 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -383,7 +383,8 @@ public class TrophyFishPage extends GuiProfileViewerPage {
totalCount = 0;
for (Map.Entry<String, JsonElement> stringJsonElementEntry : trophyObject.entrySet()) {
String key = stringJsonElementEntry.getKey();
- if (key.equalsIgnoreCase("rewards") || key.equalsIgnoreCase("total_caught")) {
+ if (key.equalsIgnoreCase("rewards") || key.equalsIgnoreCase("total_caught") ||
+ key.equalsIgnoreCase("last_caught")) {
if (key.equalsIgnoreCase("total_caught")) {
totalCount = stringJsonElementEntry.getValue().getAsInt();
}
@@ -393,7 +394,12 @@ public class TrophyFishPage extends GuiProfileViewerPage {
String[] s = key.split("_");
String type = s[s.length - 1];
TrophyFish.TrophyFishRarity trophyFishRarity;
- int value = stringJsonElementEntry.getValue().getAsInt();
+ int value = 0;
+ try {
+ value = stringJsonElementEntry.getValue().getAsInt();
+ } catch (NumberFormatException e) {
+ value = -1;
+ }
if (key.startsWith("golden_fish_")) {
type = s[2];
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
index ef8468ac..cf11b355 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2023 NotEnoughUpdates contributors
+ * Copyright (C) 2023-2024 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
@@ -124,11 +124,14 @@ object BestiaryData {
val apiDeaths = profileInfo.getAsJsonObject("bestiary").getAsJsonObject("deaths") ?: return mutableListOf()
val killsMap: HashMap<String, Int> = HashMap()
for (entry in apiKills.entrySet()) {
- killsMap[entry.key] = entry.value.asInt
+ if (entry.key == "last_killed_mob") {
+ continue
+ }
+ killsMap[entry.key] = entry.value.asString.toIntOrNull() ?: -1
}
val deathsMap: HashMap<String, Int> = HashMap()
for (entry in apiDeaths.entrySet()) {
- deathsMap[entry.key] = entry.value.asInt
+ deathsMap[entry.key] = entry.value.asString.toIntOrNull() ?: -1
}
for (categoryId in categoriesToParse) {