aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt3
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt12
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt2
3 files changed, 8 insertions, 9 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
index ebd53c4d..8e5a2973 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/SacksPage.kt
@@ -369,8 +369,7 @@ class SacksPage(pvInstance: GuiProfileViewer) : GuiProfileViewerPage(pvInstance)
val sackTypes = sacksJson.getAsJsonObject("sacks")
val selectedProfile = selectedProfile?.profileJson ?: return
- if (!selectedProfile.has("sacks_counts") || !selectedProfile.get("sacks_counts").isJsonObject) return
- val sacksInfo = selectedProfile.get("sacks_counts").asJsonObject
+ val sacksInfo = Utils.getElementOrDefault(selectedProfile, "inventory.sacks_counts", JsonObject()).asJsonObject
var totalValue = 0.0
var totalItems = 0
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt
index 2320163d..312c5d9b 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/UrsaClient.kt
@@ -181,21 +181,21 @@ class UrsaClient(val apiUtil: ApiUtil) {
companion object {
@JvmStatic
- fun profiles(uuid: UUID) = KnownRequest("v1/hypixel/profiles/${uuid}", JsonObject::class.java)
+ fun profiles(uuid: UUID) = KnownRequest("v1/hypixel/v2/profiles/${uuid}", JsonObject::class.java)
@JvmStatic
- fun player(uuid: UUID) = KnownRequest("v1/hypixel/player/${uuid}", JsonObject::class.java)
+ fun player(uuid: UUID) = KnownRequest("v1/hypixel/v2/player/${uuid}", JsonObject::class.java)
@JvmStatic
- fun guild(uuid: UUID) = KnownRequest("v1/hypixel/guild/${uuid}", JsonObject::class.java)
+ fun guild(uuid: UUID) = KnownRequest("v1/hypixel/v2/guild/${uuid}", JsonObject::class.java)
@JvmStatic
- fun bingo(uuid: UUID) = KnownRequest("v1/hypixel/bingo/${uuid}", JsonObject::class.java)
+ fun bingo(uuid: UUID) = KnownRequest("v1/hypixel/v2/bingo/${uuid}", JsonObject::class.java)
@JvmStatic
- fun museumForProfile(profileUuid: String) = KnownRequest("v1/hypixel/museum/${profileUuid}", JsonObject::class.java)
+ fun museumForProfile(profileUuid: String) = KnownRequest("v1/hypixel/v2/museum/${profileUuid}", JsonObject::class.java)
@JvmStatic
- fun status(uuid: UUID) = KnownRequest("v1/hypixel/status/${uuid}", JsonObject::class.java)
+ fun status(uuid: UUID) = KnownRequest("v1/hypixel/v2/status/${uuid}", JsonObject::class.java)
}
}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt
index e5c7263c..9a6a8c9f 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/hypixelapi/Collection.kt
@@ -118,7 +118,7 @@ data class ProfileCollectionInfo(
}
val generators = members.entrySet().mapNotNull { (uuid, data) ->
if (data !is JsonObject) return null
- data["crafted_generators"] as? JsonArray
+ data.getAsJsonObject("player_data")?.get("crafted_generators") as? JsonArray
}.flatMap { it.toList() }
return ProfileCollectionInfo(
collectionData.allCollections.mapValues { (name, collection) ->