From 31f4c69a17f1f935c7cca11d8c3331b6cc4d7897 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:53:37 +0100 Subject: code cleanup --- .../garden/inventory/SkyMartCopperPrice.kt | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/main/java/at/hannibal2') 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 e2b15c49c..a2e6a91c7 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 @@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SkyMartCopperPrice { - private val pattern = "§c(?.*) Copper".toPattern() + private val copperPattern = "§c(?.*) Copper".toPattern() private var display = emptyList>() private val config get() = GardenAPI.config.skyMart @@ -38,20 +38,20 @@ class SkyMartCopperPrice { val internalName = stack.getInternalName() val lowestBin = internalName.getPriceOrNull() ?: continue - pattern.matchMatcher(line) { - val amount = group("amount").replace(",", "").toInt() - val factor = lowestBin / amount - val perFormat = NumberUtil.format(factor) - val priceFormat = NumberUtil.format(lowestBin) - val amountFormat = NumberUtil.format(amount) + val amount = copperPattern.matchMatcher(line) { + group("amount").replace(",", "").toInt() + } ?: continue + val factor = lowestBin / amount + val perFormat = NumberUtil.format(factor) + val priceFormat = NumberUtil.format(lowestBin) + val amountFormat = NumberUtil.format(amount) - val name = stack.nameWithEnchantment!! - val advancedStats = if (config.copperPriceAdvancedStats) { - " §7(§6$priceFormat §7/ §c$amountFormat Copper§7)" - } else "" - val pair = Pair("$name§f:", "§6§l$perFormat$advancedStats") - table[pair] = Pair(factor, internalName) - } + val name = stack.nameWithEnchantment!! + val advancedStats = if (config.copperPriceAdvancedStats) { + " §7(§6$priceFormat §7/ §c$amountFormat Copper§7)" + } else "" + val pair = Pair("$name§f:", "§6§l$perFormat$advancedStats") + table[pair] = Pair(factor, internalName) } } -- cgit