aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 {