aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-02 16:26:46 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-02 16:26:46 +0100
commit0c510cb4e246897d53b98589ffe3f690127df625 (patch)
treeb7c56faeb661437e5cd38d704c462b6e97cb8678 /src/main/java/at/hannibal2/skyhanni/data
parentb07775e4b9e7d66c9d39c78093e7a11971b4e351 (diff)
downloadskyhanni-0c510cb4e246897d53b98589ffe3f690127df625.tar.gz
skyhanni-0c510cb4e246897d53b98589ffe3f690127df625.tar.bz2
skyhanni-0c510cb4e246897d53b98589ffe3f690127df625.zip
Fixed check if on barn plot.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt17
2 files changed, 12 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
index 9d620f565..2893e67a4 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HyPixelData.kt
@@ -29,7 +29,7 @@ class HyPixelData {
var profile = ""
fun readSkyBlockArea(): String {
- return ScoreboardData.sidebarLinesFormatted()
+ return ScoreboardData.sidebarLinesFormatted
.firstOrNull { it.startsWith(" §7⏣ ") }
?.substring(5)?.removeColor()
?: "invalid"
@@ -101,7 +101,7 @@ class HyPixelData {
stranded = false
bingo = false
- for (line in ScoreboardData.sidebarLinesFormatted()) {
+ for (line in ScoreboardData.sidebarLinesFormatted) {
when (line) {
" §7Ⓑ §7Bingo", // No Rank
" §bⒷ §bBingo", // Rank 1
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 91cef39a9..6da73b554 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.data
-import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.client.Minecraft
import net.minecraft.scoreboard.Score
import net.minecraft.scoreboard.ScorePlayerTeam
@@ -28,9 +27,9 @@ class ScoreboardData {
"\uD83C\uDF82",
)
- fun sidebarLinesFormatted(): List<String> {
+ fun formatLines(rawList: List<String>): List<String> {
val list = mutableListOf<String>()
- for (line in sidebarLinesRaw) {
+ for (line in rawList) {
val seperator = splitIcons.find { line.contains(it) } ?: continue
val split = line.split(seperator)
val start = split[0]
@@ -46,6 +45,9 @@ class ScoreboardData {
return list
}
+ var sidebarLinesFormatted: List<String> = emptyList()
+
+ // TODO remove these two
var sidebarLines: List<String> = emptyList()
var sidebarLinesRaw: List<String> = emptyList()
}
@@ -54,13 +56,14 @@ class ScoreboardData {
fun onTick(event: TickEvent.ClientTickEvent) {
if (event.phase != TickEvent.Phase.START) return
- val list = fetchScoreboardLines()
- sidebarLines = list.map { cleanSB(it) }.reversed()
- sidebarLinesRaw = list.reversed()
+ val list = fetchScoreboardLines().reversed()
+ sidebarLines = list.map { cleanSB(it) }
+ sidebarLinesRaw = list
+ sidebarLinesFormatted = formatLines(list)
}
private fun cleanSB(scoreboard: String): String {
- return scoreboard.removeColor().toCharArray().filter { it.code in 21..126 }.joinToString(separator = "")
+ return scoreboard.toCharArray().filter { it.code in 21..126 || it.code == 167 }.joinToString(separator = "")
}
fun fetchScoreboardLines(): List<String> {