Skip to content

Commit

Permalink
dont send repeating messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Oct 13, 2024
1 parent 3c5519c commit e07aa6c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ 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
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

Expand Down Expand Up @@ -50,7 +52,12 @@ object GriffinPetWarning {
}

private fun warn() {
ChatUtils.chat("Reminder to use a Griffin pet for Mythological Ritual!")
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)
Expand Down

0 comments on commit e07aa6c

Please sign in to comment.