diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
2 files changed, 34 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java index fec747511..3f86dfefe 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/chocolatefactory/ChocolateFactoryConfig.java @@ -104,13 +104,19 @@ public class ChocolateFactoryConfig { public boolean showDuplicateTime = false; @Expose - @ConfigOption(name = "Time Tower Warning", desc = "Notification when you have a new time tower usage available and " + + @ConfigOption(name = "Time Tower Usage Warning", desc = "Notification when you have a new time tower usage available and " + "continuously warn when your time tower is full.") @ConfigEditorBoolean @FeatureToggle public boolean timeTowerWarning = false; @Expose + @ConfigOption(name = "Time Tower Reminder", desc = "Notification a minute before the time tower ends.") + @ConfigEditorBoolean + @FeatureToggle + public boolean timeTowerReminder = true; + + @Expose @ConfigOption(name = "Upgrade Warnings", desc = "") @Accordion public ChocolateUpgradeWarningsConfig chocolateUpgradeWarnings = new ChocolateUpgradeWarningsConfig(); diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt index cf67d91d3..695d1d480 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryTimeTowerManager.kt @@ -21,6 +21,7 @@ object ChocolateFactoryTimeTowerManager { private val profileStorage get() = ChocolateFactoryAPI.profileStorage private var lastTimeTowerWarning = SimpleTimeMark.farPast() + private var lastTimeTowerReminder = SimpleTimeMark.farPast() @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { @@ -33,6 +34,10 @@ object ChocolateFactoryTimeTowerManager { if (ChocolateFactoryAPI.inChocolateFactory) return + if (config.timeTowerReminder) { + timeTowerReminder() + } + val nextCharge = SimpleTimeMark(profileStorage.nextTimeTower) if (nextCharge.isInPast() && !nextCharge.isFarPast() && currentCharges() < maxCharges()) { @@ -92,11 +97,32 @@ object ChocolateFactoryTimeTowerManager { fun timeTowerActive(): Boolean { val currentTime = profileStorage?.lastDataSave ?: 0 - val endTime = profileStorage?.currentTimeTowerEnds ?: 0 + val endTime = timeTowerEnds() return endTime > currentTime } + private fun timeTowerEnds(): Long { + return profileStorage?.currentTimeTowerEnds ?: 0 + } + + private fun timeTowerReminder() { + if (lastTimeTowerReminder.passedSince() < 20.seconds) return + + val timeUntil = SimpleTimeMark(timeTowerEnds()).timeUntil() + if (timeUntil < 1.minutes && timeUntil.isPositive()) { + ChatUtils.clickableChat( + "§cYour Time Tower is about to end! " + + "Open the Chocolate Factory to avoid wasting the multiplier!", + onClick = { + HypixelCommands.chocolateFactory() + } + ) + SoundUtils.playBeepSound() + lastTimeTowerReminder = SimpleTimeMark.now() + } + } + fun timeTowerFullTimemark(): SimpleTimeMark { val profileStorage = profileStorage ?: return SimpleTimeMark.farPast() if (timeTowerFull()) return SimpleTimeMark.farPast() |