aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMTOnline69 <97001154+MTOnline69@users.noreply.github.com>2024-09-28 20:43:30 +0100
committerGitHub <noreply@github.com>2024-09-28 21:43:30 +0200
commita5354da4083b554009b900f73d502149db91cbfe (patch)
treebd398ee0497e4cb907e6a687e36b125567bc2032 /src
parentf4419b8c77926fd160a04e5b888864e91ee17b0d (diff)
downloadskyhanni-a5354da4083b554009b900f73d502149db91cbfe.tar.gz
skyhanni-a5354da4083b554009b900f73d502149db91cbfe.tar.bz2
skyhanni-a5354da4083b554009b900f73d502149db91cbfe.zip
Fix: Broodmother countdown when imminent (#2602)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt23
1 files changed, 13 insertions, 10 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 dd7c088b0..e98c75a0b 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
@@ -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()
@@ -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() {
@@ -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")
}
@@ -159,7 +162,7 @@ object BroodmotherFeatures {
if (!isCountdownEnabled()) return
if (broodmotherSpawnTime.isFarPast()) {
- if (lastStage != null && currentStage == StageEntry.ALIVE) {
+ if (currentStage == StageEntry.ALIVE) {
display = "§4Broodmother spawned!"
}
} else {