diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index ece8bb32f..41d30a331 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -623,7 +623,15 @@ class DamageIndicatorManager { else -> 100 } val name = armorStandHits.name.removeColor() - val hits = name.between("Seraph ", " Hit").toInt() + + // TODO replace this super ugly workaround with regex + val text = name.between("Seraph ", " Hit") + val hits = try { + text.toInt() + } catch (e: NumberFormatException) { + text.substring(2).toInt() + } + return NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits" } |