From 20e5dc5bc8a82bb9d65129ae4c524ff3e26846d9 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 30 Oct 2023 22:02:36 +0100 Subject: code cleanup --- .../garden/fortuneguide/CaptureFarmingGear.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 97926b7e7..3a4844f2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -20,10 +20,12 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.math.round +import kotlin.time.Duration.Companion.days class CaptureFarmingGear { private val farmingItems get() = GardenAPI.config?.fortune?.farmingItems private val outdatedItems get() = GardenAPI.config?.fortune?.outdatedItems + // TODO USE SH-REPO private val farmingLevelUpPattern = "SKILL LEVEL UP Farming .*➜(?.*)".toPattern() private val fortuneUpgradePattern = "You claimed the Garden Farming Fortune (?.*) upgrade!".toPattern() @@ -37,8 +39,10 @@ class CaptureFarmingGear { companion object { private val strengthPattern = " Strength: §r§c❁(?.*)".toPattern() - private val farmingSets = arrayListOf("FERMENTO", "SQUASH", "CROPIE", "MELON", "FARM", - "RANCHERS", "FARMER", "RABBIT") + private val farmingSets = arrayListOf( + "FERMENTO", "SQUASH", "CROPIE", "MELON", "FARM", + "RANCHERS", "FARMER", "RABBIT" + ) private val farmingItems get() = GardenAPI.config?.fortune?.farmingItems fun captureFarmingGear() { @@ -106,7 +110,8 @@ class CaptureFarmingGear { FarmingFortuneDisplay.loadFortuneLineData(slot, 0.0) val enchantments = slot.getEnchantments() ?: emptyMap() val greenThumbLvl = (enchantments["green_thumb"] ?: continue) - GardenAPI.config?.uniqueVisitors = round(FarmingFortuneDisplay.greenThumbFortune / (greenThumbLvl * 0.05)).toInt() + val visitors = FarmingFortuneDisplay.greenThumbFortune / (greenThumbLvl * 0.05) + GardenAPI.config?.uniqueVisitors = round(visitors).toInt() } } } @@ -149,9 +154,9 @@ class CaptureFarmingGear { highestRabbitRarity = split.last().toInt() } if (split.first() == "BEE" && split.last().toInt() > highestBeeRarity) { - farmingItems[FarmingItems.BEE] = item - outdatedItems[FarmingItems.BEE] = false - highestBeeRarity = split.last().toInt() + farmingItems[FarmingItems.BEE] = item + outdatedItems[FarmingItems.BEE] = false + highestBeeRarity = split.last().toInt() } } } @@ -237,7 +242,7 @@ class CaptureFarmingGear { } } cakePattern.matchMatcher(msg) { - hidden.cakeExpiring = System.currentTimeMillis() + 172800000 + hidden.cakeExpiring = System.currentTimeMillis() + 2.days.inWholeMilliseconds } if (msg == "CARROTS EXPORTATION COMPLETE!") { hidden.carrotFortune = true -- cgit