From a9dc2016ba383660e37cf88d022851ae334791c1 Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Thu, 26 Sep 2024 19:33:19 +0100 Subject: [PATCH 1/4] fix imminent stage not updating countdown --- .../features/combat/BroodmotherFeatures.kt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt index dd7c088b0b7e..a2d6e191f8e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt @@ -70,15 +70,15 @@ object BroodmotherFeatures { return } + val lastStage = lastStage ?: return + val timeUntilSpawn = currentStage?.minutes?.minutes ?: return + broodmotherSpawnTime = SimpleTimeMark.now() + timeUntilSpawn + if (currentStage == StageEntry.IMMINENT && config.imminentWarning) { playImminentWarning() return } - val lastStage = lastStage ?: return - val timeUntilSpawn = currentStage?.minutes?.minutes ?: return - broodmotherSpawnTime = SimpleTimeMark.now() + timeUntilSpawn - if (currentStage !in config.stages) return if (currentStage == StageEntry.SLAIN) { onBroodmotherSlain() @@ -158,10 +158,8 @@ object BroodmotherFeatures { fun onSecondPassed(event: SecondPassedEvent) { if (!isCountdownEnabled()) return - if (broodmotherSpawnTime.isFarPast()) { - if (lastStage != null && currentStage == StageEntry.ALIVE) { - display = "§4Broodmother spawned!" - } + if (broodmotherSpawnTime.isFarPast() && currentStage == StageEntry.ALIVE) { + display = "§4Broodmother spawned!" } else { val countdown = broodmotherSpawnTime.timeUntil().format() display = "§4Broodmother spawning in §b$countdown" From 4c6eb617b055284d940a071f4aa399f80169bf50 Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Thu, 26 Sep 2024 19:48:26 +0100 Subject: [PATCH 2/4] improve some logic with onServerJoin() --- .../skyhanni/features/combat/BroodmotherFeatures.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt index a2d6e191f8e7..1225623e7861 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt @@ -50,7 +50,7 @@ object BroodmotherFeatures { fun onTabListUpdate(event: WidgetUpdateEvent) { if (!event.isWidget(TabWidget.BROODMOTHER)) return val newStage = event.widget.matchMatcherFirstLine { group("stage") } ?: "" - if (newStage.isNotEmpty()) { + if (newStage.isNotEmpty() && newStage != lastStage.toString()) { lastStage = currentStage currentStage = StageEntry.valueOf(newStage.replace("!", "").uppercase()) onStageUpdate() @@ -60,7 +60,7 @@ object BroodmotherFeatures { private fun onStageUpdate() { ChatUtils.debug("New Broodmother stage: $currentStage") - if (lastStage == null && onServerJoin()) return + if (onServerJoin()) return // ignore Hypixel bug where the stage may temporarily revert to Imminent after the Broodmother's death if (currentStage == StageEntry.IMMINENT && lastStage == StageEntry.ALIVE) return @@ -91,9 +91,10 @@ object BroodmotherFeatures { } private fun onServerJoin(): Boolean { + if (lastStage != null || !config.stageOnJoin) return false // don't send if user has config enabled for either of the alive messages // this is so that two messages aren't immediately sent upon joining a server - if (config.stageOnJoin && !(currentStage == StageEntry.ALIVE && isAliveMessageEnabled())) { + if (!(currentStage == StageEntry.ALIVE && isAliveMessageEnabled())) { val pluralize = StringUtils.pluralize(currentStage?.minutes ?: 0, "minute") var message = "The Broodmother's current stage in this server is ${currentStage.toString().replace("!", "")}§e." if (currentStage?.minutes != 0) { @@ -101,9 +102,8 @@ object BroodmotherFeatures { } ChatUtils.chat(message) return true - } else { - return false } + return false } private fun onBroodmotherSpawn() { From f1a9cb430a3b917441a127cd9ed13c4406c2084f Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Thu, 26 Sep 2024 20:01:24 +0100 Subject: [PATCH 3/4] silly mistake --- .../skyhanni/features/combat/BroodmotherFeatures.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt index 1225623e7861..b616eaf2c307 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt @@ -158,8 +158,10 @@ object BroodmotherFeatures { fun onSecondPassed(event: SecondPassedEvent) { if (!isCountdownEnabled()) return - if (broodmotherSpawnTime.isFarPast() && currentStage == StageEntry.ALIVE) { - display = "§4Broodmother spawned!" + if (broodmotherSpawnTime.isFarPast()) { + if (currentStage == StageEntry.ALIVE) { + display = "§4Broodmother spawned!" + } } else { val countdown = broodmotherSpawnTime.timeUntil().format() display = "§4Broodmother spawning in §b$countdown" From a0cfef2b29a4afacf5f9b6f6b592e4c544ebd0e6 Mon Sep 17 00:00:00 2001 From: MTOnline69 <97001154+MTOnline69@users.noreply.github.com> Date: Thu, 26 Sep 2024 21:02:51 +0100 Subject: [PATCH 4/4] stop seeing negative seconds on countdown --- .../hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt index b616eaf2c307..e98c75a0bc8f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt @@ -150,6 +150,9 @@ object BroodmotherFeatures { fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!isCountdownEnabled()) return if (display.isEmpty()) return + if (broodmotherSpawnTime.isInPast() && !broodmotherSpawnTime.isFarPast()) { + display = "§4Broodmother spawning now!" + } config.countdownPosition.renderString(display, posLabel = "Broodmother Countdown") }