diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-27 15:21:32 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-04-27 15:21:32 +0200 |
commit | 58779ca1f8edb9de3d25c7a26b60b83f0ee1e498 (patch) | |
tree | 408d9e937e12df3482464c9badf8e3210cb95756 | |
parent | e900cd8312c15e0b9f2fe55a668bd9b9de51ec3a (diff) | |
download | skyhanni-58779ca1f8edb9de3d25c7a26b60b83f0ee1e498.tar.gz skyhanni-58779ca1f8edb9de3d25c7a26b60b83f0ee1e498.tar.bz2 skyhanni-58779ca1f8edb9de3d25c7a26b60b83f0ee1e498.zip |
code cleanup
-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 } } } |