aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-17 23:08:50 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-17 23:08:50 +0200
commita1e0e192ba5c7e12bf2edbfadefe286d7503f188 (patch)
tree5d1ad0a75706857d58eb7e61e68bb58ca902e8a0 /src/main/java/at/hannibal2/skyhanni
parent9991622e4407d05cc140d6f30ff55c073cbffaa8 (diff)
downloadskyhanni-a1e0e192ba5c7e12bf2edbfadefe286d7503f188.tar.gz
skyhanni-a1e0e192ba5c7e12bf2edbfadefe286d7503f188.tar.bz2
skyhanni-a1e0e192ba5c7e12bf2edbfadefe286d7503f188.zip
to Pattern
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt4
37 files changed, 64 insertions, 99 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
index c2782a3c1..074120d66 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
@@ -11,11 +11,10 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class CollectionAPI {
- private val counterPattern = Pattern.compile("(?:.*) §e(.*)§6\\/(?:.*)")
- private val singleCounterPattern = Pattern.compile("§7Total Collected: §e(.*)")
+ private val counterPattern = "(?:.*) §e(.*)§6\\/(?:.*)".toPattern()
+ private val singleCounterPattern = "§7Total Collected: §e(.*)".toPattern()
// private val hypixelApiHasWrongItems = listOf(
// "WOOL",
@@ -99,7 +98,7 @@ class CollectionAPI {
companion object {
private val collectionValue = mutableMapOf<String, Long>()
- private val collectionTier0Pattern = Pattern.compile("§7Progress to .* I: .*")
+ private val collectionTier0Pattern = "§7Progress to .* I: .*".toPattern()
fun isCollectionTier0(lore: List<String>) = lore.map { collectionTier0Pattern.matcher(it) }.any { it.matches() }
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt
index 5d9fb4713..251ec3ac2 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GardenCropMilestones.kt
@@ -7,11 +7,10 @@ import at.hannibal2.skyhanni.features.garden.CropType
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class GardenCropMilestones {
- private val cropPattern = Pattern.compile("§7Harvest §f(.*) §7on .*")
- private val totalPattern = Pattern.compile("§7Total: §a(.*)")
+ private val cropPattern = "§7Harvest §f(.*) §7on .*".toPattern()
+ private val totalPattern = "§7Total: §a(.*)".toPattern()
// Add when api support is there
// @SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
index d910a26bc..c6d540ecb 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
@@ -11,12 +11,11 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class SkillExperience {
- private val actionBarPattern = Pattern.compile("(?:.*)§3\\+(?:.*) (.*) \\((.*)\\/(.*)\\)(?:.*)")
- private val inventoryPattern = Pattern.compile("(?:.*) §e(.*)§6\\/(?:.*)")
+ private val actionBarPattern = "(?:.*)§3\\+(?:.*) (.*) \\((.*)\\/(.*)\\)(?:.*)".toPattern()
+ private val inventoryPattern = "(?:.*) §e(.*)§6\\/(?:.*)".toPattern()
@SubscribeEvent
fun onProfileDataLoad(event: ProfileApiDataLoadedEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
index c5fe44328..b7f343436 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarCancelledBuyOrderClipboard.kt
@@ -14,7 +14,7 @@ class BazaarCancelledBuyOrderClipboard {
private val patternLastAmount = Pattern.compile("§a(.*)§7x")
private val patternCancelledMessage =
- Pattern.compile("§6\\[Bazaar] §r§7§r§cCancelled! §r§7Refunded §r§6(.*) coins §r§7from cancelling Buy Order!")
+ "§6\\[Bazaar] §r§7§r§cCancelled! §r§7Refunded §r§6(.*) coins §r§7from cancelling Buy Order!".toPattern()
private var latestAmount: String? = null
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
index b00a7de19..cc4faeaeb 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
@@ -18,7 +18,6 @@ import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class BingoCardDisplay {
@@ -28,7 +27,7 @@ class BingoCardDisplay {
private var tick = 0
private var display = listOf<String>()
private val config get() = SkyHanniMod.feature.bingo
- private val goalCompletePattern = Pattern.compile("§6§lBINGO GOAL COMPLETE! §r§e(.*)")
+ private val goalCompletePattern = "§6§lBINGO GOAL COMPLETE! §r§e(.*)".toPattern()
init {
update()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
index 2423ed85d..28faaf877 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
@@ -14,7 +14,6 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class BingoNextStepHelper {
private var tick = 0
@@ -23,8 +22,9 @@ class BingoNextStepHelper {
private val itemIslandRequired = mutableMapOf<String, IslandVisitStep>()
private val itemRequired = mutableMapOf<String, NextStep>()
private val islands = mutableMapOf<IslandType, IslandVisitStep>()
- private val collectionPattern = Pattern.compile("Reach ([0-9]+(?:,\\d+)*) (.*) Collection\\.")
- private val crystalPattern = Pattern.compile("Obtain a (\\w+) Crystal in the Crystal Hollows\\.")
+ private val collectionPattern = "Reach ([0-9]+(?:,\\d+)*) (.*) Collection\\.".toPattern()
+ private val crystalPattern = "Obtain a (\\w+) Crystal in the Crystal Hollows\\.".toPattern()
+ private val skillPattern = "Obtain level (.*) in the (.*) Skill.".toPattern()
companion object {
private val finalSteps = mutableListOf<NextStep>()
@@ -251,8 +251,7 @@ class BingoNextStepHelper {
val crystal = crystalMatcher.group(1)
ChatMessageStep("Obtain a $crystal Crystal").apply { finalSteps.add(this) } requires IslandType.CRYSTAL_HOLLOWS.getStep()
}
- val pattern = Pattern.compile("Obtain level (.*) in the (.*) Skill.")
- val matcher = pattern.matcher(description)
+ val matcher = skillPattern.matcher(description)
if (matcher.matches()) {
val level = matcher.group(1).toInt()
val skillName = matcher.group(2)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
index 72251046b..6fb885ff2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
@@ -19,10 +19,9 @@ import net.minecraft.item.ItemStack
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class MinionCraftHelper {
- private var minionNamePattern = Pattern.compile("(.*) Minion (.*)")
+ private var minionNamePattern = "(.*) Minion (.*)".toPattern()
private var tick = 0
private var display = listOf<String>()
private var hasMinionInInventory = false
diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
index 3c2e7306d..1de8f09a2 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt
@@ -11,7 +11,6 @@ import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class PlayerDeathMessages {
@@ -19,7 +18,7 @@ class PlayerDeathMessages {
private val lastTimePlayerSeen = mutableMapOf<String, Long>()
//§c ☠ §r§7§r§bZeroHazel§r§7 was killed by §r§8§lAshfang§r§7§r§7.
- private val pattern = Pattern.compile("§c ☠ §r§7§r§.(.+)§r§7 (.+)")
+ private val pattern = "§c ☠ §r§7§r§.(.+)§r§7 (.+)".toPattern()
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
index 998106a48..ca053323f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt
@@ -34,7 +34,6 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import java.util.*
-import java.util.regex.Pattern
import kotlin.math.max
class DamageIndicatorManager {
@@ -45,7 +44,7 @@ class DamageIndicatorManager {
companion object {
private var data = mutableMapOf<UUID, EntityData>()
- private val damagePattern = Pattern.compile("[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)")
+ private val damagePattern = "[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)".toPattern()
fun isBoss(entity: EntityLivingBase): Boolean {
return data.values.any { it.entity == entity }
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt
index 9b5430b93..00db6d6b8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonData.kt
@@ -9,11 +9,10 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class DungeonData {
- private val pattern = Pattern.compile(" §7⏣ §cThe Catacombs §7\\((.*)\\)")
+ private val pattern = " §7⏣ §cThe Catacombs §7\\((.*)\\)".toPattern()
companion object {
var dungeonFloor: String? = null
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
index ff334737b..91b347145 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonLevelColor.kt
@@ -6,11 +6,10 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class DungeonLevelColor {
- private val pattern = Pattern.compile(" §.(.*)§f: §e(.*)§b \\(§e(.*)§b\\)")
+ private val pattern = " §.(.*)§f: §e(.*)§b \\(§e(.*)§b\\)".toPattern()
@SubscribeEvent
fun onItemTooltip(event: ItemTooltipEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
index 54dbb21a4..112ef5a1f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
@@ -12,20 +12,19 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
import kotlin.math.roundToInt
class GardenLevelDisplay {
private val config get() = SkyHanniMod.feature.garden
- private val overflowPattern = Pattern.compile("(?:.*) §e(.*)§6\\/(?:.*)")
- private val namePattern = Pattern.compile("Garden Level (.*)")
+ private val overflowPattern = "(?:.*) §e(.*)§6\\/(?:.*)".toPattern()
+ private val namePattern = "Garden Level (.*)".toPattern()
private var gardenExp
get() = SkyHanniMod.feature.hidden.gardenExp
set(value) {
SkyHanniMod.feature.hidden.gardenExp = value
}
private var display = ""
- private var visitorRewardPattern = Pattern.compile(" {4}§r§8\\+§r§2(.*) §r§7Garden Experience")
+ private var visitorRewardPattern = " {4}§r§8\\+§r§2(.*) §r§7Garden Experience".toPattern()
@SubscribeEvent
fun onProfileJoin(event: ProfileJoinEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
index 1fcb470b4..c5c5d6978 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -15,7 +15,6 @@ import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import java.time.Instant
-import java.util.regex.Pattern
class GardenNextJacobContest {
private var display = listOf<Any>()
@@ -23,9 +22,9 @@ class GardenNextJacobContest {
private var tick = 0
private var contests = mutableMapOf<Long, FarmingContest>()
private var inCalendar = false
- private val patternDay = Pattern.compile("§aDay (.*)")
- private val patternMonth = Pattern.compile("(.*), Year (.*)")
- private val patternCrop = Pattern.compile("§e○ §7(.*)")
+ private val patternDay = "§aDay (.*)".toPattern()
+ private val patternMonth = "(.*), Year (.*)".toPattern()
+ private val patternCrop = "§e○ §7(.*)".toPattern()
private val maxContestsPerYear = 124
private val contestDuration = 1_000 * 60 * 20
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
index cab83ecb3..d131aa91a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt
@@ -16,14 +16,13 @@ import net.minecraft.client.gui.inventory.GuiEditSign
import net.minecraftforge.client.event.GuiOpenEvent
import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class GardenOptimalSpeed {
private val config get() = SkyHanniMod.feature.garden
private val configCustomSpeed get() = config.optimalSpeedCustom
private var currentSpeed = 100
private var optimalSpeed = -1
- private val currentSpeedPattern = Pattern.compile(" Speed: §r§f✦(.*)")
+ private val currentSpeedPattern = " Speed: §r§f✦(.*)".toPattern()
private var lastWarnTime = 0L
private var cropInHand: CropType? = null
private var rancherOverlayList: List<List<Any?>> = emptyList()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt
index 95e50dff2..4dcd73745 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenTeleportPadCompactName.kt
@@ -6,11 +6,10 @@ import net.minecraft.entity.item.EntityArmorStand
import net.minecraftforge.client.event.RenderLivingEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class GardenTeleportPadCompactName {
- private val patternName = Pattern.compile("§.✦ §aWarp To (.*)")
- private val patternNoName = Pattern.compile("§.✦ §cNo Destination")
+ private val patternName = "§.✦ §aWarp To (.*)".toPattern()
+ private val patternNoName = "§.✦ §cNo Destination".toPattern()
@SubscribeEvent(priority = EventPriority.HIGH)
fun onRenderLivingB(event: RenderLivingEvent.Specials.Pre<EntityLivingBase>) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
index 9914f756f..ba9cbe9a1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt
@@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.TimeUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
import kotlin.time.Duration
import kotlin.time.DurationUnit
@@ -23,7 +22,7 @@ class ComposterDisplay {
private var tabListData by ComposterAPI::tabListData
- enum class DataType(val pattern: String, val icon: String) {
+ enum class DataType(rawPattern: String, val icon: String) {
ORGANIC_MATTER(" Organic Matter: §r(.*)", "WHEAT"),
FUEL(" Fuel: §r(.*)", "OIL_BARREL"),
TIME_LEFT(" Time Left: §r(.*)", "WATCH"),
@@ -33,6 +32,8 @@ class ComposterDisplay {
NEUItems.getItemStack(icon)
}
+ val pattern by lazy {rawPattern.toPattern()}
+
fun addToList(map: Map<DataType, String>): List<Any> {
return listOf(displayItem, map[this]!!)
}
@@ -114,8 +115,7 @@ class ComposterDisplay {
if (next) {
if (line == "") break
for (type in DataType.values()) {
- val pattern = Pattern.compile(type.pattern)
- val matcher = pattern.matcher(line)
+ val matcher = type.pattern.matcher(line)
if (matcher.matches()) {
newData[type] = matcher.group(1)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt
index 51e30ef16..1ebf0dfe3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt
@@ -7,11 +7,10 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class ComposterInventoryNumbers {
- private val valuePattern = Pattern.compile("(?:.*) §e(.*)§6\\/(.*)")
- private val compostsPattern = Pattern.compile("§7§7Compost Available: §a(.*)")
+ private val valuePattern = "(?:.*) §e(.*)§6\\/(.*)".toPattern()
+ private val compostsPattern = "§7§7Compost Available: §a(.*)".toPattern()
@SubscribeEvent
fun onRenderItemTip(event: RenderInventoryItemTipEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt
index 80b922af2..2423f1a62 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt
@@ -12,14 +12,13 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class FarmingArmorDrops {
private var display = listOf<String>()
private val drops = mutableMapOf<ArmorDropType, Int>()
private var hasArmor = false
private var tick = 0
- private val armorPattern = Pattern.compile("(FERMENTO|CROPIE|SQUASH|MELON)_(LEGGINGS|CHESTPLATE|BOOTS|HELMET)")
+ private val armorPattern = "(FERMENTO|CROPIE|SQUASH|MELON)_(LEGGINGS|CHESTPLATE|BOOTS|HELMET)".toPattern()
private val config get() = SkyHanniMod.feature.garden
enum class ArmorDropType(val dropName: String, val chatMessage: String) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt
index a68838876..c2003186a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt
@@ -9,11 +9,10 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class GardenInventoryNumbers {
- private var patternTierProgress = Pattern.compile("§7Progress to Tier (.*): §e(?:.*)")
- private var patternUpgradeTier = Pattern.compile("§7Current Tier: §[ea](.*)§7/§a.*")
+ private var patternTierProgress = "§7Progress to Tier (.*): §e(?:.*)".toPattern()
+ private var patternUpgradeTier = "§7Current Tier: §[ea](.*)§7/§a.*".toPattern()
@SubscribeEvent
fun onRenderItemTip(event: RenderItemTipEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt
index 4aa36fd23..3a83ff92b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt
@@ -14,10 +14,9 @@ import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class SkyMartCopperPrice {
- private val pattern = Pattern.compile("§c(.*) Copper")
+ private val pattern = "§c(.*) Copper".toPattern()
private var display = listOf<List<Any>>()
private val config get() = SkyHanniMod.feature.garden
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 0b86ac8cc..e5a113001 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
@@ -34,16 +34,15 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class GardenVisitorFeatures {
private val visitors = mutableMapOf<String, Visitor>()
private var display = listOf<List<Any>>()
private var lastClickedNpc = 0
private var tick = 0
- private val newVisitorArrivedMessage = Pattern.compile(".* §r§ehas arrived on your §r§bGarden§r§e!")
- private val copperPattern = Pattern.compile(" §8\\+§c(.*) Copper")
- private val gardenExperiencePattern = Pattern.compile(" §8\\+§2(.*) §7Garden Experience")
+ private val newVisitorArrivedMessage = ".* §r§ehas arrived on your §r§bGarden§r§e!".toPattern()
+ private val copperPattern = " §8\\+§c(.*) Copper".toPattern()
+ private val gardenExperiencePattern = " §8\\+§2(.*) §7Garden Experience".toPattern()
private val config get() = SkyHanniMod.feature.garden
companion object {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
index 9683dc8cc..8e2ba8f9f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt
@@ -11,12 +11,11 @@ import at.hannibal2.skyhanni.utils.TimeUtils
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
import kotlin.math.roundToLong
class GardenVisitorTimer {
- private val patternNextVisitor = Pattern.compile(" Next Visitor: §r§b(.*)")
- private val patternVisitors = Pattern.compile("§b§lVisitors: §r§f\\((\\d)\\)")
+ private val patternNextVisitor = " Next Visitor: §r§b(.*)".toPattern()
+ private val patternVisitors = "§b§lVisitors: §r§f\\((\\d)\\)".toPattern()
private var render = ""
private var lastMillis = 0L
private var lastVisitors: Int = -1
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
index d72877007..25a899942 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -15,12 +15,11 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNeeded
import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class ItemDisplayOverlayFeatures {
- private val wishingCompassPattern = Pattern.compile("§7Remaining Uses: §e(.*)§8/§e3")
- private val rangerBootsSpeedCapPattern = Pattern.compile("§7Current Speed Cap: §a(.*)")
+ private val wishingCompassPattern = "§7Remaining Uses: §e(.*)§8/§e3".toPattern()
+ private val rangerBootsSpeedCapPattern = "§7Current Speed Cap: §a(.*)".toPattern()
@SubscribeEvent
fun onRenderItemTip(event: RenderItemTipEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
index af27b8f45..845262e91 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt
@@ -8,13 +8,12 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class ItemStars {
private val armorNames = mutableListOf<String>()
private val tiers = mutableMapOf<String, Int>()
- private val STAR_FIND_PATCHER = Pattern.compile("(.*)§.✪(.*)")
+ private val STAR_FIND_PATCHER = "(.*)§.✪(.*)".toPattern()
private val armorParts = listOf("Helmet", "Chestplate", "Leggings", "Boots")
@SubscribeEvent(priority = EventPriority.LOW)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt
index f21bbbbb8..3eccc0cfe 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt
@@ -17,7 +17,6 @@ import net.minecraft.inventory.ContainerChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.text.SimpleDateFormat
import java.util.*
-import java.util.regex.Pattern
class JacobFarmingContestsInventory {
@@ -26,7 +25,7 @@ class JacobFarmingContestsInventory {
private val formatDay = SimpleDateFormat("dd MMMM yyyy", Locale.US)
private val formatTime = SimpleDateFormat("HH:mm", Locale.US)
- private val pattern = Pattern.compile("§a(.*) (.*)(?:rd|st|nd|th), Year (.*)")
+ private val pattern = "§a(.*) (.*)(?:rd|st|nd|th), Year (.*)".toPattern()
private val config get() = SkyHanniMod.feature.inventory
// Render the contests a tick delayed to feel smoother
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt
index dd17caf48..f3ec32f1e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt
@@ -11,11 +11,10 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class StatsTuning {
- private val patternStatPoints = Pattern.compile("§7Stat has: §e(\\d+) point(s)?")
+ private val patternStatPoints = "§7Stat has: §e(\\d+) point(s)?".toPattern()
@SubscribeEvent
fun onRenderItemTip(event: RenderInventoryItemTipEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index e17e54263..d04372b32 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -27,7 +27,6 @@ import net.minecraftforge.fml.common.gameevent.InputEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
import org.lwjgl.input.Mouse
import java.awt.Color
-import java.util.regex.Pattern
class MinionFeatures {
private val config get() = SkyHanniMod.feature.minions
@@ -40,7 +39,7 @@ class MinionFeatures {
private var lastMinionPickedUp = 0L
private val minions = mutableMapOf<LorenzVec, MinionData>()
private var coinsPerDay = ""
- private val minionUpgradePattern = Pattern.compile("§aYou have upgraded your Minion to Tier (.*)")
+ private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (.*)".toPattern()
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt
index c5e465b54..b5851136b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CompactSplashPotionMessage.kt
@@ -6,15 +6,14 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class CompactSplashPotionMessage {
private val POTION_EFFECT_PATTERN =
- Pattern.compile("§a§lBUFF! §fYou have gained §r(.*)§r§f! Press TAB or type /effects to view your active effects!")
+ "§a§lBUFF! §fYou have gained §r(.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern()
private val POTION_EFFECT_OTHERS_PATTERN =
- Pattern.compile("§a§lBUFF! §fYou were splashed by (.*) §fwith §r(.*)§r§f! Press TAB or type /effects to view your active effects!")
+ "§a§lBUFF! §fYou were splashed by (.*) §fwith §r(.*)§r§f! Press TAB or type /effects to view your active effects!".toPattern()
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
index 93b5f791e..4cdbffab5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
@@ -18,7 +18,6 @@ import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class NonGodPotEffectDisplay {
@@ -44,7 +43,7 @@ class NonGodPotEffectDisplay {
"GABAGOEY" to "§9Gabagoey Mixin",
)
- private var patternEffectsCount = Pattern.compile("§7You have §e(\\d+) §7non-god effects\\.")
+ private var patternEffectsCount = "§7You have §e(\\d+) §7non-god effects\\.".toPattern()
private var totalEffectsCount = 0
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
index e8d69aa38..c6bb2d7bc 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailykuudra/DailyKuudraBossHelper.kt
@@ -14,11 +14,10 @@ import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class DailyKuudraBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) {
val kuudraTiers = mutableListOf<KuudraTier>()
- private val pattern = Pattern.compile(" Kuudra's Hollow \\(T(.*)\\)")
+ private val pattern = " Kuudra's Hollow \\(T(.*)\\)".toPattern()
private var kuudraLocation: LorenzVec? = null
private var allKuudraDone = true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
index 2e0673746..23c704811 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt
@@ -16,7 +16,6 @@ import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import java.util.regex.Pattern
class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHelper) {
@@ -117,9 +116,9 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel
for ((displayName, extraData) in jsonElement.asJsonObject.entrySet()) {
val data = extraData.asJsonObject
val displayItem = data["item"]?.asString
- val patterns = " *§r§6§l${displayName.uppercase()} DOWN!"
+ val patterns = " *§r§6§l${displayName.uppercase()} DOWN!".toPattern()
val location = reputationHelper.readLocationData(data)
- miniBosses.add(CrimsonMiniBoss(displayName, displayItem, location, Pattern.compile(patterns)))
+ miniBosses.add(CrimsonMiniBoss(displayName, displayItem, location, patterns))
}
//Config
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt
index 2c0748962..5b2931c88 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/HideMobNames.kt
@@ -41,7 +41,7 @@ class HideMobNames {
}
private fun addMobToHide(bossName: String) {
- patterns.add(Pattern.compile("§8\\[§7Lv(\\d+)§8] §c$bossName§r §[ae](.+)§f/§a(.+)§c❤"))
+ patterns.add("§8\\[§7Lv(\\d+)§8] §c$bossName§r §[ae](.+)§f/§a(.+)§c❤".toPattern())
}
@SubscribeEvent(priority = EventPriority.HIGH)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
index 96b06377d..edb2bc2ac 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
@@ -14,7 +14,6 @@ import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
-import java.util.regex.Pattern
class SummoningMobManager {
@@ -26,14 +25,14 @@ class SummoningMobManager {
private var searchMobs = false
//§aYou have spawned your Tank Zombie §r§asoul! §r§d(249 Mana)
- private val spawnPatter = Pattern.compile("§aYou have spawned your (.+) §r§asoul! §r§d\\((\\d+) Mana\\)")
- private val despawnPatter = Pattern.compile("§cYou have despawned your (monster|monsters)!")
+ private val spawnPatter = "§aYou have spawned your (.+) §r§asoul! §r§d\\((\\d+) Mana\\)".toPattern()
+ private val despawnPatter = "§cYou have despawned your (monster|monsters)!".toPattern()
//§a§ohannibal2's Tank Zombie§r §a160k§c❤
- private val healthPattern = Pattern.compile("§a§o(.+)'s (.+)§r §[ae]([\\dkm]+)§c❤")
+ private val healthPattern = "§a§o(.+)'s (.+)§r §[ae]([\\dkm]+)§c❤".toPattern()
//§cThe Seraph recalled your 3 summoned allies!
- private val seraphRecallPattern = Pattern.compile("§cThe Seraph recalled your (\\d) summoned allies!")
+ private val seraphRecallPattern = "§cThe Seraph recalled your (\\d) summoned allies!".toPattern()
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 83f3bd060..7ed8e24fa 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -10,7 +10,6 @@ import net.minecraft.init.Items
import net.minecraft.item.ItemStack
import net.minecraftforge.common.util.Constants
import java.util.*
-import java.util.regex.Pattern
object ItemUtils {
@@ -152,8 +151,8 @@ object ItemUtils {
fun isSkyBlockMenuItem(stack: ItemStack?): Boolean = stack?.getInternalName() == "SKYBLOCK_MENU"
- private val patternInFront = Pattern.compile("(?: *§8(?<amount>[\\d,]+)x )?(?<name>.*)")
- private val patternBehind = Pattern.compile("(?<name>(?:['\\w-]+ ?)+)(?:§8x(?<amount>[\\d,]+))?")
+ private val patternInFront = "(?: *§8(?<amount>[\\d,]+)x )?(?<name>.*)".toPattern()
+ private val patternBehind = "(?<name>(?:['\\w-]+ ?)+)(?:§8x(?<amount>[\\d,]+))?".toPattern()
private val itemAmountCache = mutableMapOf<String, Pair<String, Int>>()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
index 1223b33c8..0b197e0d9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt
@@ -9,14 +9,13 @@ import org.apache.logging.log4j.core.LogEvent
import org.apache.logging.log4j.core.Logger
import org.apache.logging.log4j.core.LoggerContext
import org.apache.logging.log4j.message.Message
-import java.util.regex.Pattern
class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter {
private val loggerFiltered = LorenzLogger("debug/mc_console/filtered")
private val loggerUnfiltered = LorenzLogger("debug/mc_console/unfiltered")
- private val patternBiomeIdBounds = Pattern.compile("Biome ID is out of bounds: (\\d+), defaulting to 0 \\(Ocean\\)")
+ private val patternBiomeIdBounds = "Biome ID is out of bounds: (\\d+), defaulting to 0 \\(Ocean\\)".toPattern()
companion object {
fun initLogging() {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index 0d09ea81d..b776cb1dc 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -2,7 +2,6 @@ package at.hannibal2.skyhanni.utils
import java.text.NumberFormat
import java.util.*
-import java.util.regex.Pattern
import kotlin.math.pow
import kotlin.math.roundToInt
@@ -161,7 +160,7 @@ object NumberUtil {
}
}
- val pattern = Pattern.compile("^[0-9]*$")
+ val pattern = "^[0-9]*$".toPattern()
fun String.isInt(): Boolean {
return isNotEmpty() && pattern.matcher(this).matches()
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
index 4adec2c34..138c70804 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
@@ -1,11 +1,9 @@
package at.hannibal2.skyhanni.utils
-import java.util.regex.Pattern
-
object TimeUtils {
private val pattern =
- Pattern.compile("(?:(?<y>\\d+) ?y(?:\\w* ?)?)?(?:(?<d>\\d+) ?d(?:\\w* ?)?)?(?:(?<h>\\d+) ?h(?:\\w* ?)?)?(?:(?<m>\\d+) ?m(?:\\w* ?)?)?(?:(?<s>\\d+) ?s(?:\\w* ?)?)?")
+ "(?:(?<y>\\d+) ?y(?:\\w* ?)?)?(?:(?<d>\\d+) ?d(?:\\w* ?)?)?(?:(?<h>\\d+) ?h(?:\\w* ?)?)?(?:(?<m>\\d+) ?m(?:\\w* ?)?)?(?:(?<s>\\d+) ?s(?:\\w* ?)?)?".toPattern()
fun formatDuration(
millis: Long,