diff options
author | nea <romangraef@gmail.com> | 2022-03-19 23:17:20 +0100 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-03-19 23:17:20 +0100 |
commit | a61b3f9e2b8b2eeb9d556b5f477d2a479b9f7643 (patch) | |
tree | 9eab0af5f66ced5bda3130878bba81aa9501fc1c /ingame/src/main/kotlin/moe/nea89/sbdata/utils | |
parent | eb9a6a650ace04947815d29762c685670e5d610e (diff) | |
download | sbdata-a61b3f9e2b8b2eeb9d556b5f477d2a479b9f7643.tar.gz sbdata-a61b3f9e2b8b2eeb9d556b5f477d2a479b9f7643.tar.bz2 sbdata-a61b3f9e2b8b2eeb9d556b5f477d2a479b9f7643.zip |
dungeon map data collection
Diffstat (limited to 'ingame/src/main/kotlin/moe/nea89/sbdata/utils')
-rw-r--r-- | ingame/src/main/kotlin/moe/nea89/sbdata/utils/scoreboard.kt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ingame/src/main/kotlin/moe/nea89/sbdata/utils/scoreboard.kt b/ingame/src/main/kotlin/moe/nea89/sbdata/utils/scoreboard.kt new file mode 100644 index 0000000..ab53034 --- /dev/null +++ b/ingame/src/main/kotlin/moe/nea89/sbdata/utils/scoreboard.kt @@ -0,0 +1,11 @@ +package moe.nea89.sbdata.utils + +import net.minecraft.world.World + + +val controlcodeRegex = "ยง.".toRegex() +val String.withoutFormatting get() = this.replace(controlcodeRegex, "") +val World.scoreboardLines + get() = scoreboard + .getSortedScores(scoreboard.getObjectiveInDisplaySlot(1)) + .mapNotNull { scoreboard.getPlayersTeam(it.playerName)?.let { it.colorPrefix + it.colorSuffix }?.withoutFormatting } |