From 17a855a4bdfcca00b29f85981d8fb86968d9038c Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 11 Mar 2025 12:44:59 +0100 Subject: feat: add SBItemData implementation --- src/main/kotlin/util/skyblock/Rarity.kt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/kotlin/util/skyblock/Rarity.kt') diff --git a/src/main/kotlin/util/skyblock/Rarity.kt b/src/main/kotlin/util/skyblock/Rarity.kt index b19f371..f244ef6 100644 --- a/src/main/kotlin/util/skyblock/Rarity.kt +++ b/src/main/kotlin/util/skyblock/Rarity.kt @@ -15,6 +15,7 @@ import moe.nea.firmament.util.StringUtil.words import moe.nea.firmament.util.collections.lastNotNullOfOrNull import moe.nea.firmament.util.mc.loreAccordingToNbt import moe.nea.firmament.util.petData +import moe.nea.firmament.util.removeColorCodes import moe.nea.firmament.util.unformattedString typealias RepoRarity = io.github.moulberry.repo.data.Rarity @@ -87,6 +88,12 @@ enum class Rarity(vararg altNames: String) { fun fromPetItem(itemStack: ItemStack): Rarity? = itemStack.petData?.tier?.let(::fromNeuRepo) + fun fromStringLore(lore: List): Rarity? { + return lore.lastNotNullOfOrNull { + it.removeColorCodes().words().firstNotNullOfOrNull(::fromString) + } + } + fun fromLore(lore: List): Rarity? = lore.lastNotNullOfOrNull { it.unformattedString.words() -- cgit