diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-21 14:53:37 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-21 14:53:37 +0100 |
commit | 31f4c69a17f1f935c7cca11d8c3331b6cc4d7897 (patch) | |
tree | 2f53e084080245332bebc6029b00c01abc271b32 /src/main/java/at/hannibal2 | |
parent | d6942265ddfc2f116c39387095b004d4c8ba870a (diff) | |
download | skyhanni-31f4c69a17f1f935c7cca11d8c3331b6cc4d7897.tar.gz skyhanni-31f4c69a17f1f935c7cca11d8c3331b6cc4d7897.tar.bz2 skyhanni-31f4c69a17f1f935c7cca11d8c3331b6cc4d7897.zip |
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt | 28 |
1 files changed, 14 insertions, 14 deletions
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(?<amount>.*) Copper".toPattern() + private val copperPattern = "§c(?<amount>.*) Copper".toPattern() private var display = emptyList<List<Any>>() 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) } } |