diff options
author | MTOnline69 <97001154+MTOnline69@users.noreply.github.com> | 2024-09-15 11:01:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-15 12:01:03 +0200 |
commit | 67e09820b733caee179ea3c8808aa358cdcff94d (patch) | |
tree | db15e6a050d42524576067bc49fc1c3c5f86874f /src/main/java | |
parent | 3e2cd8ee29ce571286d5cc2ccdc7ed74a9fffcbe (diff) | |
download | skyhanni-67e09820b733caee179ea3c8808aa358cdcff94d.tar.gz skyhanni-67e09820b733caee179ea3c8808aa358cdcff94d.tar.bz2 skyhanni-67e09820b733caee179ea3c8808aa358cdcff94d.zip |
Fix: Broodmother countdown wrong in singular case (#2513)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt | 32 |
1 files changed, 15 insertions, 17 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 e087fdd19..dd7c088b0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BroodmotherFeatures.kt @@ -60,9 +60,7 @@ object BroodmotherFeatures { private fun onStageUpdate() { ChatUtils.debug("New Broodmother stage: $currentStage") - if (lastStage == null) { - if (onServerJoin()) return - } + if (lastStage == null && 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 @@ -72,23 +70,23 @@ object BroodmotherFeatures { return } - val timeUntilSpawn = currentStage?.minutes?.minutes - broodmotherSpawnTime = SimpleTimeMark.now() + timeUntilSpawn!! - if (currentStage == StageEntry.IMMINENT && config.imminentWarning) { playImminentWarning() return } - if (config.stages.contains(currentStage) && lastStage != null) { - if (currentStage == StageEntry.SLAIN) { - onBroodmotherSlain() - } else { - val pluralize = StringUtils.pluralize(timeUntilSpawn.toInt(DurationUnit.MINUTES), "minute") - ChatUtils.chat( - "Broodmother: $lastStage §e-> $currentStage§e. §b${timeUntilSpawn.inWholeMinutes} $pluralize §euntil it spawns!" - ) - } + 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() + } else { + val pluralize = StringUtils.pluralize(timeUntilSpawn.toInt(DurationUnit.MINUTES), "minute") + ChatUtils.chat( + "Broodmother: $lastStage §e-> $currentStage§e. §b${timeUntilSpawn.inWholeMinutes} $pluralize §euntil it spawns!" + ) } } @@ -99,7 +97,7 @@ object BroodmotherFeatures { 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) { - message += " It will spawn within §b${currentStage?.minutes} $pluralize§e." + message += " It will spawn §bwithin ${currentStage?.minutes} $pluralize§e." } ChatUtils.chat(message) return true @@ -161,7 +159,7 @@ object BroodmotherFeatures { if (!isCountdownEnabled()) return if (broodmotherSpawnTime.isFarPast()) { - if (lastStage != null) { + if (lastStage != null && currentStage == StageEntry.ALIVE) { display = "§4Broodmother spawned!" } } else { |