aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-10 12:38:19 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-10 12:38:19 +0200
commitb90ed51d4a57f05c14f02daf4ffc09c37a6bb2b7 (patch)
tree7252baf896e22c377118beeb94a5b5f543ac06a1 /src/main/java/at
parent855cda60f0650811fd5af1934c430294b51dc5f0 (diff)
downloadskyhanni-b90ed51d4a57f05c14f02daf4ffc09c37a6bb2b7.tar.gz
skyhanni-b90ed51d4a57f05c14f02daf4ffc09c37a6bb2b7.tar.bz2
skyhanni-b90ed51d4a57f05c14f02daf4ffc09c37a6bb2b7.zip
Safety check for getItemRarityOrCommon
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
index 63b32ebb4..3dc13f8d5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt
@@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.c
import at.hannibal2.skyhanni.features.garden.fortuneguide.FFGuideGUI.Companion.getItem
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
import at.hannibal2.skyhanni.utils.ItemUtils.getItemName
-import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarity
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrCommon
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil.addSuffix
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments
@@ -254,7 +254,7 @@ object FortuneUpgrades {
} ?: return
FarmingFortuneDisplay.loadFortuneLineData(item, 0.0)
- val increase = reforge[item.getItemRarity().id + 1, FarmingFortuneDisplay.reforgeFortune] ?: return
+ val increase = reforge[item.getItemRarityOrCommon().id + 1, FarmingFortuneDisplay.reforgeFortune] ?: return
list.add(
FortuneUpgrade("§7Recombobulate your ${item.displayName}", null, "RECOMBOBULATOR_3000", 1, increase)
)
@@ -267,7 +267,7 @@ object FortuneUpgrades {
copperPrice: Int? = null
) {
FarmingFortuneDisplay.loadFortuneLineData(item, 0.0)
- val increase = reforge[item.getItemRarity().id, FarmingFortuneDisplay.reforgeFortune] ?: return
+ val increase = reforge[item.getItemRarityOrCommon().id, FarmingFortuneDisplay.reforgeFortune] ?: return
list.add(
FortuneUpgrade(
"§7Reforge your ${item.displayName} §7to ${reforge.reforgeName}",
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 25d5f9df4..e1115355f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -153,7 +153,7 @@ object ItemUtils {
return nbt.getCompoundTag("SkullOwner").getString("Id")
}
- fun ItemStack.getItemRarity() = getItemRarityOrNull() ?: error("item rarity not detected for item '$name'")
+ fun ItemStack.getItemRarityOrCommon() = getItemRarityOrNull() ?: LorenzRarity.COMMON
fun ItemStack.getItemRarityOrNull(): LorenzRarity? {
if (isPet(cleanName())) {