aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorVixid <52578495+VixidDev@users.noreply.github.com>2024-08-10 08:49:27 +0100
committerGitHub <noreply@github.com>2024-08-10 09:49:27 +0200
commit940f557330e3696391a5fb2e59d67dddc1d288fb (patch)
treef4e9a48903277c5c9a095bf66face4bf3c0fb834 /src/main
parenta2466409114bc570e8e8ab92e30be8c24794441f (diff)
downloadskyhanni-940f557330e3696391a5fb2e59d67dddc1d288fb.tar.gz
skyhanni-940f557330e3696391a5fb2e59d67dddc1d288fb.tar.bz2
skyhanni-940f557330e3696391a5fb2e59d67dddc1d288fb.zip
Fix: Lore on books with Compressed format + Regex Fix (#2301)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt
index 530cd4886..a1aacfb0c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt
@@ -38,7 +38,7 @@ object EnchantParser {
val patternGroup = RepoPattern.group("misc.items.enchantparsing")
val enchantmentPattern by patternGroup.pattern(
- "enchants", "(?<enchant>[A-Za-z][A-Za-z -]+) (?<levelNumeral>[IVXLCDM]+)(?<stacking>, |\$| \\d{1,3}(,\\d{3})*)"
+ "enchants", "(?<enchant>[A-Za-z][A-Za-z '-]+) (?<levelNumeral>[IVXLCDM]+)(?<stacking>, |\$| \\d{1,3}(,\\d{3})*)"
)
private val grayEnchantPattern by patternGroup.pattern(
"grayenchants", "^(Respiration|Aqua Affinity|Depth Strider|Efficiency).*"
@@ -315,11 +315,18 @@ object EnchantParser {
val comma = if (commaFormat == CommaFormat.COPY_ENCHANT) ", " else "ยง9, "
builder.append(orderedEnchant.getFormattedString())
- if (i % 3 != 2) {
- builder.append(comma)
- } else {
+
+ if (itemIsBook() && maxEnchantsPerLine == 1) {
insertEnchants.add(builder.toString())
+ insertEnchants.addAll(orderedEnchant.getLore())
builder = StringBuilder()
+ } else {
+ if (i % 3 != 2) {
+ builder.append(comma)
+ } else {
+ insertEnchants.add(builder.toString())
+ builder = StringBuilder()
+ }
}
}