aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/mixins/hooks
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-26 17:08:23 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-26 17:08:23 +0100
commitec40d26903ef256cea3175693038400e64981f1b (patch)
tree3a00756939bb528b4c13c9c6b3f6d880380229be /src/main/java/at/hannibal2/skyhanni/mixins/hooks
parent7a8e3bf8dbacdeaf3a584dfbac61adff005cf1c1 (diff)
downloadskyhanni-ec40d26903ef256cea3175693038400e64981f1b.tar.gz
skyhanni-ec40d26903ef256cea3175693038400e64981f1b.tar.bz2
skyhanni-ec40d26903ef256cea3175693038400e64981f1b.zip
more compact plot name in scoreboard
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt20
1 files changed, 9 insertions, 11 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 c563008c4..d976eb056 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt
@@ -21,7 +21,7 @@ fun drawString(
instance.drawString(it, x, y, color)
} ?: 0
-private fun replaceString(text: String, ): String? {
+private fun replaceString(text: String): String? {
if (SkyHanniMod.feature.misc.hideScoreboardNumbers && text.startsWith("§c") && text.length <= 4) {
return null
}
@@ -35,18 +35,16 @@ private fun replaceString(text: String, ): String? {
if (SkyHanniMod.feature.garden.plotNameInScoreboard && GardenAPI.inGarden()) {
if (text.contains("⏣")) {
val plot = GardenPlotAPI.getCurrentPlot()
- val pests = if (text.contains("ൠ")) {
- text.last().digitToInt()
- } else 0
- var name = plot?.let {
+ val pestSuffix = if (text.contains("ൠ")) {
+ val pests = text.last().digitToInt()
+ " §7(§4${pests}ൠ§7)"
+ } else ""
+ val name = plot?.let {
if (it.isBarn()) {
- "§aGarden: The Barn"
- } else "§aPlot: §b" + it.name
+ "§aThe Barn"
+ } else "§b" + it.name
} ?: "§aGarden §cOutside"
- if (pests > 0) {
- name = "$name §7(§4${pests}ൠ§7)"
- }
- return " §7⏣ $name"
+ return " §7⏣ $name$pestSuffix"
}
}