aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt2
3 files changed, 21 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index 3ea3a9008..fe5ca67b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -84,6 +84,15 @@ class HypixelData {
"SK[YI]BLOCK(?: CO-OP| GUEST)?"
)
+ /**
+ * REGEX-TEST: §7⏣ §bVillage
+ * REGEX-TEST: §5ф §dWizard Tower
+ */
+ private val skyblockAreaPattern by patternGroup.pattern(
+ "skyblock.area",
+ "\\s*§(?<symbol>7⏣|5ф) §(?<color>.)(?<area>.*)"
+ )
+
var hypixelLive = false
var hypixelAlpha = false
var inLobby = false
@@ -103,6 +112,7 @@ class HypixelData {
var joinedWorld = SimpleTimeMark.farPast()
var skyBlockArea = "?"
+ var skyBlockAreaWithSymbol = "?"
// Data from locraw
var locrawData: JsonObject? = null
@@ -155,7 +165,7 @@ class HypixelData {
playerAmountGuestingPattern
)
- out@for (pattern in playerPatternList) {
+ out@ for (pattern in playerPatternList) {
for (line in TabListData.getTabList()) {
pattern.matchMatcher(line) {
amount += group("amount").toInt()
@@ -282,11 +292,14 @@ class HypixelData {
}
if (LorenzUtils.inSkyBlock) {
- val originalLocation = ScoreboardData.sidebarLinesFormatted
- .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") }
- ?.substring(5)?.removeColor()
- ?: "?"
- skyBlockArea = LocationFixData.fixLocation(skyBlockIsland) ?: originalLocation
+ loop@ for (line in ScoreboardData.sidebarLinesFormatted) {
+ skyblockAreaPattern.matchMatcher(line) {
+ val originalLocation = group("area")
+ skyBlockArea = LocationFixData.fixLocation(skyBlockIsland) ?: originalLocation
+ skyBlockAreaWithSymbol = line.trim()
+ break@loop
+ }
+ }
checkProfileName()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
index d3e3b6c1c..65d8d880c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
@@ -482,13 +482,8 @@ private fun getEmptyLineDisplayPair() = listOf("<empty>" to HorizontalAlignment.
private fun getIslandDisplayPair() =
listOf("§7㋖ §a" + HypixelData.skyBlockIsland.displayName to HorizontalAlignment.LEFT)
-// TODO merge with LorenzUtils.skyBlockArea
private fun getLocationDisplayPair() = buildList {
- val location =
- getGroupFromPattern(ScoreboardData.sidebarLinesFormatted, ScoreboardPattern.locationPattern, "location").trim()
- if (location == "0") return@buildList
-
- add(location to HorizontalAlignment.LEFT)
+ add(HypixelData.skyBlockAreaWithSymbol to HorizontalAlignment.LEFT)
ScoreboardData.sidebarLinesFormatted.firstOrNull { ScoreboardPattern.plotPattern.matches(it) }
?.let { add(it to HorizontalAlignment.LEFT) }
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt
index 2e1259343..d04384ba0 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/repopatterns/RepoPattern.kt
@@ -63,7 +63,7 @@ interface RepoPattern : ReadOnlyProperty<Any?, Pattern> {
val defaultPattern: String
/**
- * Key for this pattern. Used as an identifier when loading from the repo. Should be consistent accross versions.
+ * Key for this pattern. Used as an identifier when loading from the repo. Should be consistent across versions.
*/
val key: String