diff options
Diffstat (limited to 'src/main')
3 files changed, 21 insertions, 16 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt index 7281da5a3..656df781f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventDisplay.kt @@ -77,10 +77,11 @@ object MiningEventDisplay { eventData.runningEvents.forEach { (islandType, events) -> when (islandType) { IslandType.DWARVEN_MINES -> dwarvenEvents = - (events.sortedBy { it.endsAt - it.event.defaultLength.inWholeMilliseconds }) + events.sortedBy { it.endsAt - it.event.defaultLength.inWholeMilliseconds } IslandType.CRYSTAL_HOLLOWS -> crystalEvents = - (events.sortedBy { it.endsAt - it.event.defaultLength.inWholeMilliseconds }) + events.filter { !it.event.dwarvenSpecific } + .sortedBy { it.endsAt - it.event.defaultLength.inWholeMilliseconds } else -> Unit } } 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 137aecec2..a3a9b979f 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 @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod 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 @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.APIUtil 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 @@ -63,7 +65,7 @@ class MiningEventTracker { @SubscribeEvent fun onBossbarChange(event: BossbarUpdateEvent) { if (!LorenzUtils.inAdvancedMiningIsland()) return - if (lastWorldSwitch.passedSince() < 2.seconds) return + if (lastWorldSwitch.passedSince() < 5.seconds) return if (!eventEndTime.isInPast()) { return } @@ -99,9 +101,7 @@ class MiningEventTracker { } private fun sendData(eventName: String, time: String?) { - val eventType = MiningEventType.fromBossbarName(eventName) - if (lastSentEvent == eventType) return - if (eventType == null) { + val eventType = MiningEventType.fromEventName(eventName) ?: run { if (!config.enabled) return ErrorManager.logErrorWithData( Exception("UnknownMiningEvent"), "Unknown mining event detected from string $eventName", @@ -112,6 +112,10 @@ class MiningEventTracker { ) return } + + if (IslandType.CRYSTAL_HOLLOWS.isInIsland() && eventType.dwarvenSpecific) return + + if (lastSentEvent == eventType) return lastSentEvent = eventType val timeRemaining = if (time == null) { @@ -121,8 +125,7 @@ class MiningEventTracker { } eventEndTime = SimpleTimeMark.now() + timeRemaining - val serverId = HypixelData.getCurrentServerId() - if (serverId == null) { + val serverId = HypixelData.getCurrentServerId() ?: run { ErrorManager.logErrorWithData( Exception("NoServerId"), "Could not find server id", "islandType" to LorenzUtils.skyBlockIsland, diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt index b8fb1d35a..b71f8431f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventType.kt @@ -10,14 +10,15 @@ enum class MiningEventType( val eventName: String, private val shortName: String, val defaultLength: Duration, - private val colourCode: Char + private val colourCode: Char, + val dwarvenSpecific: Boolean, ) { - GONE_WITH_THE_WIND("GONE WITH THE WIND", "Wind", 18.minutes, '9'), - DOUBLE_POWDER("2X POWDER", "2x", 15.minutes, 'b'), - GOBLIN_RAID("GOBLIN RAID", "Raid", 5.minutes, 'c'), - BETTER_TOGETHER("BETTER TOGETHER", "Better", 18.minutes, 'd'), - RAFFLE("RAFFLE", "Raffle", 160.seconds, '6'), - MITHRIL_GOURMAND("MITHRIL GOURMAND", "Gourmand", 10.minutes, 'b'), + GONE_WITH_THE_WIND("GONE WITH THE WIND", "Wind", 18.minutes, '9', false), + DOUBLE_POWDER("2X POWDER", "2x", 15.minutes, 'b', false), + GOBLIN_RAID("GOBLIN RAID", "Raid", 5.minutes, 'c', true), + BETTER_TOGETHER("BETTER TOGETHER", "Better", 18.minutes, 'd', false), + RAFFLE("RAFFLE", "Raffle", 160.seconds, '6', true), + MITHRIL_GOURMAND("MITHRIL GOURMAND", "Gourmand", 10.minutes, 'b', true), ; override fun toString() = @@ -29,7 +30,7 @@ enum class MiningEventType( companion object { private val config get() = SkyHanniMod.feature.mining.miningEvent - fun fromBossbarName(bossbarName: String): MiningEventType? { + fun fromEventName(bossbarName: String): MiningEventType? { return MiningEventType.entries.find { it.eventName == bossbarName.removeColor() } } } |