From 58779ca1f8edb9de3d25c7a26b60b83f0ee1e498 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 27 Apr 2024 15:21:32 +0200 Subject: code cleanup --- .../at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') 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 } } } -- cgit