Skip to content

Commit

Permalink
Fix: Guardian warn text (#2718)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
hannibal002 and hannibal002 authored Oct 12, 2024
1 parent ee5b8b2 commit 015352c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.",
Expand All @@ -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)
Expand Down

0 comments on commit 015352c

Please sign in to comment.