diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-09-21 23:14:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-21 23:14:34 +0200 |
commit | 1ae2d448cc34c20c34c0aee1a97bdd01801a6b66 (patch) | |
tree | 13f5b796e3abab068fca4ade29455e35f834a034 /src/main/java/at/hannibal2/skyhanni/data | |
parent | d2072b83949b90bd7c2f5bfa6bd0c08941953879 (diff) | |
download | skyhanni-1ae2d448cc34c20c34c0aee1a97bdd01801a6b66.tar.gz skyhanni-1ae2d448cc34c20c34c0aee1a97bdd01801a6b66.tar.bz2 skyhanni-1ae2d448cc34c20c34c0aee1a97bdd01801a6b66.zip |
Fix: ReforgeAPI fix hard crash for unkown stat (#2562)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt index 182309634..f31c95958 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt @@ -53,6 +53,8 @@ enum class SkyblockStat(val icon: String) { FEAR("§a☠"), HEAT_RESISTANCE("§c♨"), + + UNKNOWN("§c?") ; val capitalizedName = name.lowercase().allLettersFirstUppercase() @@ -65,6 +67,10 @@ enum class SkyblockStat(val icon: String) { val fontSizeOfLargestIcon by lazy { entries.maxOf { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it.icon) } + 1 } + + fun getValueOrNull(string: String): SkyblockStat? = entries.firstOrNull { it.name == string } + + fun getValue(string: String): SkyblockStat = getValueOrNull(string) ?: UNKNOWN } } |