diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-02-16 21:21:43 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-16 11:21:43 +0100 |
commit | f91973d60948d449cc45a4add901e6fe43aebd62 (patch) | |
tree | 4c8c77ec4a9585a821651a034ebe5bed3308a6af /src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt | |
parent | 26fe548fa9a5cfe29b130a0a5585278df3429ee9 (diff) | |
download | skyhanni-f91973d60948d449cc45a4add901e6fe43aebd62.tar.gz skyhanni-f91973d60948d449cc45a4add901e6fe43aebd62.tar.bz2 skyhanni-f91973d60948d449cc45a4add901e6fe43aebd62.zip |
Moved many regex patterns in the repo and code cleanup. #871
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt index e418f6043..348d05cb2 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt @@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import com.google.gson.GsonBuilder import com.google.gson.annotations.Expose import net.minecraft.item.ItemStack @@ -41,7 +42,10 @@ object TestCopyBestiaryValues { var bracket: Int = 0 } - val pattern = "\\[Lv(?<lvl>.*)] (?<text>.*)".toPattern() + private val bestiaryTypePattern by RepoPattern.pattern( + "test.bestiary.type", + "\\[Lv(?<lvl>.*)] (?<text>.*)" + ) @SubscribeEvent(priority = EventPriority.LOW) fun onLateInventoryOpen(event: InventoryUpdatedEvent) { @@ -85,7 +89,7 @@ object TestCopyBestiaryValues { for (i in 10..43) { val stack = inventoryItems[i] ?: continue val stackName = stack.name ?: continue - pattern.matchMatcher(stackName.removeColor()) { + bestiaryTypePattern.matchMatcher(stackName.removeColor()) { val lvl = group("lvl").toInt() var text = group("text").lowercase().replace(" ", "_") |