aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils/ScoreBoardUtils.kt
blob: 7b6c96da107373172c7e456a0d7692c7e3db7e35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package dulkirmod.utils

import dulkirmod.DulkirMod
import net.minecraft.scoreboard.Score
import net.minecraft.scoreboard.ScorePlayerTeam

object ScoreBoardUtils {
    fun getLines() : MutableList<String> {
        val scoreboard = DulkirMod.mc.thePlayer.worldScoreboard
        val sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1)
        val scores: List<Score> = ArrayList(scoreboard.getSortedScores(sidebarObjective))
        val lines: MutableList<String> = ArrayList()
        for (i in scores.indices.reversed()) {
            val score = scores[i]
            val scoreplayerteam1 = scoreboard.getPlayersTeam(score.playerName)
            val line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.playerName)
            lines.add(line)
        }
        return lines
    }
}