From 0dc938ae2b9c7f47cfa4d458f16da820c1b06af6 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Thu, 16 May 2024 10:40:01 +0200 Subject: Fix: Hoppity Egg warnings (#1796) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/event/hoppity/HoppityEggsManager.kt | 28 ++++++++++++---------- .../ChocolateFactoryCustomReminder.kt | 8 ++++++- 2 files changed, 23 insertions(+), 13 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt index 366f8d9dc..8ee19dda8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsManager.kt @@ -75,6 +75,19 @@ object HoppityEggsManager { fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return + hoppityEventNotOn.matchMatcher(event.message) { + val currentYear = SkyBlockTime.now().year + + if (config.timeInChat) { + val timeUntil = SkyBlockTime(currentYear + 1).asTimeMark().timeUntil() + ChatUtils.chat("§eHoppity's Hunt is not active. The next Hoppity's Hunt is in §b${timeUntil.format()}§e.") + event.blockedReason = "hoppity_egg" + } + return + } + + if (!ChocolateFactoryAPI.isHoppityEvent()) return + eggFoundPattern.matchMatcher(event.message) { HoppityEggLocator.eggFound() val meal = getEggType(event) @@ -110,17 +123,6 @@ object HoppityEggsManager { getEggType(event).markSpawned() return } - - hoppityEventNotOn.matchMatcher(event.message) { - val currentYear = SkyBlockTime.now().year - - if (config.timeInChat) { - val timeUntil = SkyBlockTime(currentYear + 1).asTimeMark().timeUntil() - ChatUtils.chat("§eHoppity's Hunt is not active. The next Hoppity's Hunt is in §b${timeUntil.format()}§e.") - event.blockedReason = "hoppity_egg" - } - return - } } internal fun Matcher.getEggType(event: LorenzChatEvent): HoppityEggType = @@ -151,7 +153,7 @@ object HoppityEggsManager { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { - if (!LorenzUtils.inSkyBlock) return + if (!isActive()) return if (!config.showClaimedEggs) return if (isBuzy()) return if (!ChocolateFactoryAPI.isHoppityEvent()) return @@ -167,6 +169,7 @@ object HoppityEggsManager { @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { + if (!isActive()) return HoppityEggType.checkClaimed() checkWarn() } @@ -214,4 +217,5 @@ object HoppityEggsManager { event.move(44, "event.chocolateFactory.hoppityEggs", "event.hoppityEggs") } + fun isActive() = LorenzUtils.inSkyBlock && ChocolateFactoryAPI.isHoppityEvent() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt index c2cabf08e..cc7731f80 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryCustomReminder.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -76,6 +77,7 @@ object ChocolateFactoryCustomReminder { fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { if (!isEnabled()) return if (!inChocolateMenu()) return + if (ReminderUtils.isBusy()) return configReminder.position.renderRenderables(display, posLabel = "Chocolate Factory Custom Reminder") } @@ -85,6 +87,7 @@ object ChocolateFactoryCustomReminder { if (!isEnabled()) return if (!configReminder.always) return if (Minecraft.getMinecraft().currentScreen is GuiChest) return + if (ReminderUtils.isBusy()) return configReminder.position.renderRenderables(display, posLabel = "Chocolate Factory Custom Reminder") } @@ -133,7 +136,10 @@ object ChocolateFactoryCustomReminder { if (configUpgradeWarnings.upgradeWarningSound) { SoundUtils.playBeepSound() } - ChatUtils.chat("You can now purchase §f$targetName §ein Chocolate factory!") + ChatUtils.clickableChat("You can now purchase §f$targetName §ein Chocolate factory!", + onClick = { + HypixelCommands.chocolateFactory() + }) } private fun reset() { -- cgit