From 015352cdc9913a60c544433df1992b5f0e7b7723 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sat, 12 Oct 2024 09:43:39 +0200 Subject: Fix: Guardian warn text (#2718) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../inventory/experimentationtable/ExperimentationTableAPI.kt | 5 ++++- .../features/inventory/experimentationtable/GuardianReminder.kt | 9 ++------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt index 4965a9883..be0f08a5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/ExperimentationTableAPI.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.inventory.experimentationtable import at.hannibal2.skyhanni.data.IslandType +import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.InventoryUpdatedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -169,8 +170,10 @@ object ExperimentationTableAPI { * REGEX-TEST: §dGuardian * REGEX-TEST: §9Guardian§e */ - val petNamePattern by patternGroup.pattern( + private val petNamePattern by patternGroup.pattern( "guardianpet", "§[956d]Guardian.*", ) + + fun hasGuardianPet(): Boolean = petNamePattern.matches(PetAPI.currentPet) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt index 32157adf7..03748c5d5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/experimentationtable/GuardianReminder.kt @@ -2,7 +2,6 @@ package at.hannibal2.skyhanni.features.inventory.experimentationtable import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator -import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -12,7 +11,6 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.HypixelCommands import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils @@ -31,7 +29,6 @@ object GuardianReminder { private val config get() = SkyHanniMod.feature.inventory.experimentationTable private var lastInventoryOpen = SimpleTimeMark.farPast() - private var lastWarn = SimpleTimeMark.farPast() private var lastErrorSound = SimpleTimeMark.farPast() @SubscribeEvent @@ -44,10 +41,7 @@ object GuardianReminder { } private fun warn() { - if (ExperimentationTableAPI.petNamePattern.matches(PetAPI.currentPet)) return - - if (lastWarn.passedSince() < 5.seconds) return - lastWarn = SimpleTimeMark.now() + if (ExperimentationTableAPI.hasGuardianPet()) return ChatUtils.clickToActionOrDisable( "Use a §9§lGuardian Pet §efor more Exp in the Experimentation Table.", @@ -62,6 +56,7 @@ object GuardianReminder { if (!isEnabled()) return if (InventoryUtils.openInventoryName() != "Experimentation Table") return if (lastInventoryOpen.passedSince() > 2.seconds) return + if (ExperimentationTableAPI.hasGuardianPet()) return val gui = Minecraft.getMinecraft().currentScreen as? GuiContainer ?: return sendTitle(gui.width, gui.height) -- cgit