diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-10-13 22:45:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-13 22:45:51 +0200 |
commit | 0561f4bd6da6fd454f19d23c1b7599a3d9f0ff8f (patch) | |
tree | 2345ec5259babbcc18c2812c2724b4d830b011d8 /src/main/java | |
parent | 52e061ef07bd982da3fff09e7d90c99261f108e2 (diff) | |
download | skyhanni-0561f4bd6da6fd454f19d23c1b7599a3d9f0ff8f.tar.gz skyhanni-0561f4bd6da6fd454f19d23c1b7599a3d9f0ff8f.tar.bz2 skyhanni-0561f4bd6da6fd454f19d23c1b7599a3d9f0ff8f.zip |
Fix: Griffin Pet warning Autopet (#2722)
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/event/diana/GriffinPetWarning.kt | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt index f52c34320..f5ce6675b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -1,9 +1,13 @@ package at.hannibal2.skyhanni.features.event.diana import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.BurrowDugEvent +import at.hannibal2.skyhanni.events.IslandChangeEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.DelayedRun +import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -11,20 +15,52 @@ import kotlin.time.Duration.Companion.seconds @SkyHanniModule object GriffinPetWarning { - + private val config get() = SkyHanniMod.feature.event.diana + private var wasCorrectPetAlready = false private var lastWarnTime = SimpleTimeMark.farPast() @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!event.isMod(10)) return - if (!SkyHanniMod.feature.event.diana.petWarning) return + if (!config.petWarning) return if (!DianaAPI.isDoingDiana()) return if (!DianaAPI.hasSpadeInHand()) return - if (!DianaAPI.hasGriffinPet() && lastWarnTime.passedSince() > 30.seconds) { + val hasGriffinPet = DianaAPI.hasGriffinPet() + if (hasGriffinPet) { + wasCorrectPetAlready = true + return + } + + if (wasCorrectPetAlready) return + + warn() + } + + @SubscribeEvent + fun onBurrowDug(event: BurrowDugEvent) { + DelayedRun.runDelayed(2.seconds) { + wasCorrectPetAlready = false + } + } + + @SubscribeEvent + fun onIslandChange(event: IslandChangeEvent) { + DelayedRun.runDelayed(5.seconds) { + wasCorrectPetAlready = false + } + } + + private fun warn() { + ChatUtils.clickToActionOrDisable( + "Reminder to use a Griffin pet for Mythological Ritual!", + config::petWarning, + actionName = "open pets menu", + action = { HypixelCommands.pet() }, + ) + if (lastWarnTime.passedSince() > 30.seconds) { lastWarnTime = SimpleTimeMark.now() LorenzUtils.sendTitle("§cGriffin Pet!", 3.seconds) - ChatUtils.chat("Reminder to use a Griffin pet for Mythological Ritual!") } } } |