aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-03-23 17:12:12 +0100
committerGitHub <noreply@github.com>2024-03-23 17:12:12 +0100
commitc03d6b26f0d5a8e1d99b5e8f49de0d3aa87969a9 (patch)
treebca33db37b38bf693c384fe7c1ae6e89d7d814f4 /src/main/java/at
parentf43775c7e097cdbc5ec2a63fb2edfc231922eefa (diff)
downloadskyhanni-c03d6b26f0d5a8e1d99b5e8f49de0d3aa87969a9.tar.gz
skyhanni-c03d6b26f0d5a8e1d99b5e8f49de0d3aa87969a9.tar.bz2
skyhanni-c03d6b26f0d5a8e1d99b5e8f49de0d3aa87969a9.zip
Backend: Fixed usage of checkCurrentServerId() (#1177)
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt12
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,