aboutsummaryrefslogtreecommitdiff
path: root/src/main
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
parent7a8e3bf8dbacdeaf3a584dfbac61adff005cf1c1 (diff)
downloadskyhanni-ec40d26903ef256cea3175693038400e64981f1b.tar.gz
skyhanni-ec40d26903ef256cea3175693038400e64981f1b.tar.bz2
skyhanni-ec40d26903ef256cea3175693038400e64981f1b.zip
more compact plot name in scoreboard
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt20
2 files changed, 10 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java
index b8351feeb..77e497b5e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/GardenConfig.java
@@ -214,7 +214,7 @@ public class GardenConfig {
public boolean plotBorders = true;
@Expose
- @ConfigOption(name = "Plot Name in Scoreboard", desc = "Showing a better plot name in scoreboard. Updates faster and doesnt hide when pests are spawned.")
+ @ConfigOption(name = "Plot Name in Scoreboard", desc = "Showing a more compact plot name in scoreboard. Updates faster and doesnt hide when pests are spawned.")
@ConfigEditorBoolean
@FeatureToggle
public boolean plotNameInScoreboard = true;
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"
}
}