diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt | 18 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt | 12 |
2 files changed, 12 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index eb38187ca..9eb2aa5e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -117,26 +117,30 @@ class HypixelData { val mode get() = locraw["mode"] ?: "" val map get() = locraw["map"] ?: "" - fun getCurrentServerId(): String? { - if (!LorenzUtils.inSkyBlock) return null - if (serverId != null) return serverId + fun checkCurrentServerId() { + if (!LorenzUtils.inSkyBlock) return ScoreboardData.sidebarLinesFormatted.forEach { serverIdScoreboardPattern.matchMatcher(it) { val serverType = if (group("servertype") == "M") "mega" else "mini" serverId = "$serverType${group("serverid")}" - return serverId + return } } TabListData.getTabList().forEach { serverIdTablistPattern.matchMatcher(it) { serverId = group("serverid") - return serverId + return } } - return serverId + ErrorManager.logErrorWithData( + Exception("NoServerId"), "Could not find server id", + "islandType" to LorenzUtils.skyBlockIsland, + "tablist" to TabListData.getTabList(), + "scoreboard" to ScoreboardData.sidebarLinesFormatted + ) } fun getPlayersOnCurrentServer(): Int { @@ -303,7 +307,7 @@ class HypixelData { if (inSkyBlock) { checkIsland() checkSidebar() - getCurrentServerId() + checkCurrentServerId() } if (inSkyBlock == skyBlock) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt index 019104aa8..4d4b59b6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.BossbarData import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.BossbarUpdateEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzTickEvent @@ -16,7 +15,6 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.fromJson import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -125,15 +123,7 @@ class MiningEventTracker { } eventEndTime = SimpleTimeMark.now() + timeRemaining - val serverId = HypixelData.getCurrentServerId() ?: run { - ErrorManager.logErrorWithData( - Exception("NoServerId"), "Could not find server id", - "islandType" to LorenzUtils.skyBlockIsland, - "tablist" to TabListData.getTabList(), - "scoreboard" to ScoreboardData.sidebarLinesFormatted - ) - return - } + val serverId = HypixelData.serverId ?: return val miningEventData = MiningEventDataSend( LorenzUtils.skyBlockIsland, |