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 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/event') 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() } -- cgit