aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-26 17:06:03 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-26 17:06:03 +0100
commit7a8e3bf8dbacdeaf3a584dfbac61adff005cf1c1 (patch)
tree84c9ecafcf3375fad1d2c87a0b2f97cd56863e5b
parent725f1f84dc791c3b31d3917bfe61c69a0b586448 (diff)
downloadskyhanni-7a8e3bf8dbacdeaf3a584dfbac61adff005cf1c1.tar.gz
skyhanni-7a8e3bf8dbacdeaf3a584dfbac61adff005cf1c1.tar.bz2
skyhanni-7a8e3bf8dbacdeaf3a584dfbac61adff005cf1c1.zip
code cleanup
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt
index eeae056b4..c563008c4 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt
@@ -17,14 +17,18 @@ fun drawString(
x: Int,
y: Int,
color: Int,
-): Int {
+) = replaceString(text)?.let {
+ instance.drawString(it, x, y, color)
+} ?: 0
+
+private fun replaceString(text: String, ): String? {
if (SkyHanniMod.feature.misc.hideScoreboardNumbers && text.startsWith("§c") && text.length <= 4) {
- return 0
+ return null
}
if (SkyHanniMod.feature.misc.hidePiggyScoreboard) {
piggyPattern.matchMatcher(text) {
val coins = group("coins")
- return instance.drawString("Purse: $coins", x, y, color)
+ return "Purse: $coins"
}
}
@@ -42,9 +46,9 @@ fun drawString(
if (pests > 0) {
name = "$name §7(§4${pests}ൠ§7)"
}
- return instance.drawString(" §7⏣ $name", x, y, color)
+ return " §7⏣ $name"
}
}
- return instance.drawString(text, x, y, color)
+ return text
}