diff options
author | Linnea Gräf <nea@nea.moe> | 2024-11-17 16:11:21 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-11-17 16:11:21 +0100 |
commit | ffebb438f8d1582ee65936399b79dd714454f223 (patch) | |
tree | 57b884d27026f115410743bfd69da983f442f799 /src/main/kotlin/util/SkyblockId.kt | |
parent | 762fb402151809395cf9883354804e49a9b188a8 (diff) | |
download | Firmament-ffebb438f8d1582ee65936399b79dd714454f223.tar.gz Firmament-ffebb438f8d1582ee65936399b79dd714454f223.tar.bz2 Firmament-ffebb438f8d1582ee65936399b79dd714454f223.zip |
fix: Pets missing an item rarity
Diffstat (limited to 'src/main/kotlin/util/SkyblockId.kt')
-rw-r--r-- | src/main/kotlin/util/SkyblockId.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/kotlin/util/SkyblockId.kt b/src/main/kotlin/util/SkyblockId.kt index eeca70c..1c1aa77 100644 --- a/src/main/kotlin/util/SkyblockId.kt +++ b/src/main/kotlin/util/SkyblockId.kt @@ -101,7 +101,7 @@ data class HypixelPetInfo( val uuid: UUID? = null, val active: Boolean = false, ) { - val skyblockId get() = SkyblockId("${type.uppercase()};${tier.ordinal}") + val skyblockId get() = SkyblockId("${type.uppercase()};${tier.ordinal}") // TODO: is this ordinal set up correctly? } private val jsonparser = Json { ignoreUnknownKeys = true } @@ -125,8 +125,8 @@ val ItemStack.skyblockUUID: UUID? private val petDataCache = WeakCache.memoize<ItemStack, Optional<HypixelPetInfo>>("PetInfo") { val jsonString = it.extraAttributes.getString("petInfo") if (jsonString.isNullOrBlank()) return@memoize Optional.empty() - runCatching { jsonparser.decodeFromString<HypixelPetInfo>(jsonString) } - .getOrElse { null }.intoOptional() + ErrorUtil.catch<HypixelPetInfo?>("Could not decode hypixel pet info") { jsonparser.decodeFromString<HypixelPetInfo>(jsonString) } + .or { null }.intoOptional() } val ItemStack.petData: HypixelPetInfo? |