aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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("#")