diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 15 |
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 |