diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index d1f35447a..513be0c4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -316,14 +316,16 @@ object SkyBlockItemModifierUtils { COMBAT('4'), DEFENSIVE('a'), MINING('5'), - UNIVERSAL('f') + UNIVERSAL('f'), ; companion object { - fun getColorCode(name: String) = entries.stream().filter { - name.uppercase(Locale.ENGLISH).contains(it.name) - }.findFirst().get().colorCode + fun getByName(name: String): GemstoneSlotType = + entries.firstOrNull { name.uppercase(Locale.ENGLISH).contains(it.name) } + ?: error("Unknwon GemstoneSlotType: '$name'") + + fun getColorCode(name: String) = getByName(name).colorCode } } } |