diff options
author | Walker Selby <git@walkerselby.com> | 2023-12-03 19:18:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-04 04:18:06 +0100 |
commit | 1cf1f68672d07767ed93150dd32094234eddd70c (patch) | |
tree | 6a57fdedca12fc61f688d4f1aa96e120866dc6ad /src/main/java/at/hannibal2/skyhanni/features/slayer | |
parent | 66fc6034b563b30854de121385d67140f605004e (diff) | |
download | skyhanni-1cf1f68672d07767ed93150dd32094234eddd70c.tar.gz skyhanni-1cf1f68672d07767ed93150dd32094234eddd70c.tar.bz2 skyhanni-1cf1f68672d07767ed93150dd32094234eddd70c.zip |
Internal Change: Remove String.matchRegex() function Usages (#641)
Code cleanup and removed .matchRegex() #641
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/slayer')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt | 13 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index df8c47740..52eb9f806 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.StringUtils.matchRegex +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.entity.EntityLivingBase @@ -18,6 +18,7 @@ import kotlin.time.Duration.Companion.seconds class SlayerQuestWarning { private val config get() = SkyHanniMod.feature.slayer + private val talkToMaddoxPattern = " {3}§r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!".toPattern() private var needSlayerQuest = false private var lastWarning = 0L private var currentReason = "" @@ -43,7 +44,7 @@ class SlayerQuestWarning { } //no auto slayer - if (message.matchRegex(" {3}§r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!")) { + talkToMaddoxPattern.matchMatcher(message) { needNewQuest("You have no Auto-Slayer active!") } if (message == " §r§a§lSLAYER QUEST COMPLETE!") { diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt index 0e9b9f8ae..260d7d4d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString -import at.hannibal2.skyhanni.utils.StringUtils.matchRegex +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.getLorenzVec import net.minecraft.client.Minecraft import net.minecraft.item.ItemStack @@ -22,6 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class BlazeSlayerDaggerHelper { private val config get() = SkyHanniMod.feature.slayer.blazes.hellion + private val attunementPattern = "§cStrike using the §r(.+) §r§cattunement on your dagger!".toPattern() private var clientSideClicked = false private var textTop = "" @@ -34,12 +35,10 @@ class BlazeSlayerDaggerHelper { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - if (!SkyHanniMod.feature.slayer.blazes.hellion.hideDaggerWarning) return + if (!config.hideDaggerWarning) return val message = event.message - if (message.matchRegex("§cStrike using the §r(.+) §r§cattunement on your dagger!") || - message == "§cYour hit was reduced by Hellion Shield!" - ) { + if (attunementPattern.matches(message) || message == "§cYour hit was reduced by Hellion Shield!") { event.blockedReason = "blaze_slayer_dagger" } } @@ -63,7 +62,7 @@ class BlazeSlayerDaggerHelper { checkActiveDagger() lastNearest = findNearest() - val first = Dagger.entries[SkyHanniMod.feature.slayer.blazes.hellion.firstDagger] + val first = Dagger.entries[config.firstDagger] val second = first.other() textTop = format(holding, true, first) + " " + format(holding, true, second) @@ -71,7 +70,7 @@ class BlazeSlayerDaggerHelper { } private fun findNearest(): HellionShield? { - if (!SkyHanniMod.feature.slayer.blazes.hellion.markRightHellionShield) return null + if (!config.markRightHellionShield) return null if (lastNearestCheck + 100 > System.currentTimeMillis()) return lastNearest lastNearestCheck = System.currentTimeMillis() |