diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-10-12 09:43:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-12 09:43:39 +0200 |
commit | 015352cdc9913a60c544433df1992b5f0e7b7723 (patch) | |
tree | 5cf2f53b02f0cafb7d1e6630e892202deb848ce7 /src/main/java/at | |
parent | ee5b8b22c04e85e8eca2354b27ad979b26a4ad0f (diff) | |
download | skyhanni-015352cdc9913a60c544433df1992b5f0e7b7723.tar.gz skyhanni-015352cdc9913a60c544433df1992b5f0e7b7723.tar.bz2 skyhanni-015352cdc9913a60c544433df1992b5f0e7b7723.zip |
Fix: Guardian warn text (#2718)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
2 files changed, 6 insertions, 8 deletions
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) |