aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-16 10:43:42 +0100
committerGitHub <noreply@github.com>2024-03-16 10:43:42 +0100
commit23278f006e47bf3d9287ad5b4ef3ec7d15c42ded (patch)
treeee0a8a016f168454e8b12e9ea077388d36b9d11c /src/main/java/at/hannibal2/skyhanni/data
parentbb9cef4d5b035a6722890018a27bb2502afa40bc (diff)
downloadskyhanni-23278f006e47bf3d9287ad5b4ef3ec7d15c42ded.tar.gz
skyhanni-23278f006e47bf3d9287ad5b4ef3ec7d15c42ded.tar.bz2
skyhanni-23278f006e47bf3d9287ad5b4ef3ec7d15c42ded.zip
Fix: Guesting Detection (#1188)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
index 9617d4e37..88c45566a 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt
@@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TabListData
import at.hannibal2.skyhanni.utils.UtilsPatterns
@@ -53,6 +54,10 @@ class HypixelData {
"lobbytype",
"(?<lobbyType>.*lobby)\\d+"
)
+ private val guestPattern by patternGroup.pattern(
+ "guesting.scoreboard",
+ "SKYBLOCK GUEST"
+ )
var hypixelLive = false
var hypixelAlpha = false
@@ -300,7 +305,6 @@ class HypixelData {
private fun checkIsland() {
var newIsland = ""
- var guesting = false
TabListData.fullyLoaded = false
for (line in TabListData.getTabList()) {
@@ -308,11 +312,10 @@ class HypixelData {
newIsland = group("island").removeColor()
TabListData.fullyLoaded = true
}
- if (line == " Status: §r§9Guest") {
- guesting = true
- }
}
+ // Can not use color coding, because of the color effect (§f§lSKYB§6§lL§e§lOCK§A§L GUEST)
+ val guesting = guestPattern.matches(ScoreboardData.objectiveTitle.removeColor())
val islandType = getIslandType(newIsland, guesting)
if (skyBlockIsland != islandType) {
IslandChangeEvent(islandType, skyBlockIsland).postAndCatch()
@@ -326,8 +329,8 @@ class HypixelData {
}
}
- private fun getIslandType(newIsland: String, guesting: Boolean): IslandType {
- val islandType = IslandType.getByNameOrUnknown(newIsland)
+ private fun getIslandType(name: String, guesting: Boolean): IslandType {
+ val islandType = IslandType.getByNameOrUnknown(name)
if (guesting) {
if (islandType == IslandType.PRIVATE_ISLAND) return IslandType.PRIVATE_ISLAND_GUEST
if (islandType == IslandType.GARDEN) return IslandType.GARDEN_GUEST