aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-16 11:17:23 +0200
committerGitHub <noreply@github.com>2024-08-16 11:17:23 +0200
commit27b8ca2f81a6f9b7f99980236209acb5985a23b3 (patch)
treedb960b2203c3eb5754997653f49bb38ab83aeb07 /src/main/java/at/hannibal2/skyhanni
parentd524fe113d707dd4c190215853bfba3a8569f18c (diff)
downloadskyhanni-27b8ca2f81a6f9b7f99980236209acb5985a23b3.tar.gz
skyhanni-27b8ca2f81a6f9b7f99980236209acb5985a23b3.tar.bz2
skyhanni-27b8ca2f81a6f9b7f99980236209acb5985a23b3.zip
Fix: Garden Guesting (#2355)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index a403db112..26915faf3 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -22,7 +22,13 @@ object ScoreboardData {
private var sidebarLines: List<String> = emptyList() // TODO rename to raw
var sidebarLinesRaw: List<String> = emptyList() // TODO delete
- var objectiveTitle = ""
+ val objectiveTitle: String get() = grabObjectiveTitle()
+
+ fun grabObjectiveTitle(): String {
+ val scoreboard = Minecraft.getMinecraft().theWorld?.scoreboard ?: return ""
+ val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return ""
+ return objective.displayName
+ }
private var dirty = false
@@ -90,7 +96,6 @@ object ScoreboardData {
private fun fetchScoreboardLines(): List<String> {
val scoreboard = Minecraft.getMinecraft().theWorld?.scoreboard ?: return emptyList()
val objective = scoreboard.getObjectiveInDisplaySlot(1) ?: return emptyList()
- objectiveTitle = objective.displayName
var scores = scoreboard.getSortedScores(objective)
val list = scores.filter { input: Score? ->
input != null && input.playerName != null && !input.playerName.startsWith("#")