From 4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sat, 10 Feb 2024 00:24:52 +0100 Subject: Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978 --- .../skyhanni/features/garden/AnitaMedalProfit.kt | 7 ++-- .../features/garden/AtmosphericFilterDisplay.kt | 1 - .../skyhanni/features/garden/CropAccessory.kt | 6 ++-- .../hannibal2/skyhanni/features/garden/CropType.kt | 32 +++++++++++------ .../features/garden/FarmingFortuneDisplay.kt | 6 ++-- .../features/garden/FarmingMilestoneCommand.kt | 14 ++++---- .../skyhanni/features/garden/GardenAPI.kt | 5 +-- .../features/garden/GardenCropMilestoneFix.kt | 9 ++--- .../features/garden/GardenCropTimeCommand.kt | 17 ++++----- .../features/garden/GardenCropsInCommand.kt | 19 +++++----- .../skyhanni/features/garden/GardenLevelDisplay.kt | 19 +++++++--- .../features/garden/GardenNextJacobContest.kt | 24 +++++++------ .../skyhanni/features/garden/GardenOptimalSpeed.kt | 7 ++-- .../skyhanni/features/garden/GardenPlotAPI.kt | 9 +++-- .../skyhanni/features/garden/GardenWarpCommands.kt | 4 ++- .../skyhanni/features/garden/GardenYawAndPitch.kt | 1 + .../skyhanni/features/garden/SensitivityReducer.kt | 5 ++- .../skyhanni/features/garden/ToolTooltipTweaks.kt | 2 +- .../features/garden/composter/ComposterAPI.kt | 5 +-- .../features/garden/composter/ComposterDisplay.kt | 10 +++--- .../garden/composter/ComposterInventoryNumbers.kt | 2 +- .../features/garden/composter/ComposterOverlay.kt | 40 +++++++++++++--------- .../composter/GardenComposterInventoryFeatures.kt | 6 ++-- .../features/garden/contest/FarmingContestAPI.kt | 7 ++-- .../garden/contest/JacobContestFFNeededDisplay.kt | 6 ++-- .../garden/contest/JacobContestStatsSummary.kt | 15 ++++---- .../garden/contest/JacobContestTimeNeeded.kt | 11 +++--- .../contest/JacobFarmingContestsInventory.kt | 1 + .../features/garden/farming/ArmorDropTracker.kt | 7 ++-- .../features/garden/farming/CropMoneyDisplay.kt | 13 +++---- .../features/garden/farming/CropSpeedMeter.kt | 7 ++-- .../features/garden/farming/DicerRngDropTracker.kt | 8 +++-- .../garden/farming/FarmingWeightDisplay.kt | 20 ++++++----- .../features/garden/farming/GardenBestCropTime.kt | 7 ++-- .../garden/farming/GardenCropMilestoneDisplay.kt | 6 ++-- .../features/garden/farming/GardenCropSpeed.kt | 7 ++-- .../garden/farming/GardenCustomKeybinds.kt | 1 + .../features/garden/farming/GardenStartLocation.kt | 15 ++++---- .../farming/WildStrawberryDyeNotification.kt | 4 ++- .../garden/farming/WrongFungiCutterWarning.kt | 2 ++ .../garden/fortuneguide/CaptureFarmingGear.kt | 25 ++++++++------ .../features/garden/fortuneguide/FFGuideGUI.kt | 4 ++- .../features/garden/fortuneguide/FFStats.kt | 1 + .../garden/fortuneguide/FarmingReforges.kt | 4 +-- .../features/garden/fortuneguide/FarmingSets.kt | 5 +-- .../features/garden/fortuneguide/FortuneStats.kt | 2 +- .../features/garden/fortuneguide/FortuneUpgrade.kt | 4 +-- .../garden/fortuneguide/FortuneUpgrades.kt | 17 ++++----- .../garden/fortuneguide/pages/OverviewPage.kt | 4 ++- .../garden/fortuneguide/pages/UpgradePage.kt | 1 + .../garden/inventory/AnitaExtraFarmingFortune.kt | 3 +- .../inventory/GardenCropMilestoneInventory.kt | 3 +- .../garden/inventory/GardenInventoryNumbers.kt | 2 +- .../garden/inventory/GardenNextPlotPrice.kt | 4 +-- .../features/garden/inventory/GardenPlotIcon.kt | 4 +-- .../garden/inventory/SkyMartCopperPrice.kt | 4 ++- .../skyhanni/features/garden/pests/PestAPI.kt | 1 + .../skyhanni/features/garden/pests/PestFinder.kt | 14 ++++---- .../skyhanni/features/garden/pests/PestSpawn.kt | 4 ++- .../features/garden/pests/PestSpawnTimer.kt | 1 + .../skyhanni/features/garden/pests/SprayDisplay.kt | 5 +-- .../features/garden/pests/SprayFeatures.kt | 2 +- .../skyhanni/features/garden/pests/SprayType.kt | 3 +- .../garden/visitor/GardenVisitorColorNames.kt | 1 + .../garden/visitor/GardenVisitorDropStatistics.kt | 7 ++-- .../garden/visitor/GardenVisitorFeatures.kt | 15 ++++---- .../features/garden/visitor/GardenVisitorTimer.kt | 4 ++- .../visitor/HighlightVisitorsOutsideOfGarden.kt | 4 ++- .../features/garden/visitor/NPCVisitorFix.kt | 5 +-- .../skyhanni/features/garden/visitor/VisitorAPI.kt | 11 +++--- .../features/garden/visitor/VisitorListener.kt | 9 +++-- .../features/garden/visitor/VisitorReward.kt | 8 ++++- .../garden/visitor/VisitorTooltipParser.kt | 2 +- 73 files changed, 344 insertions(+), 226 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index e92fda526..19d658c2a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -6,13 +6,14 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.test.command.ErrorManager +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.nameWithEnchantment import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems @@ -23,10 +24,12 @@ import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AnitaMedalProfit { + private val config get() = GardenAPI.config.anitaShop private var display = emptyList>() companion object { + var inInventory = false } @@ -104,7 +107,7 @@ class AnitaMedalProfit { for (rawItemName in requiredItems) { val pair = ItemUtils.readItemAmount(rawItemName) if (pair == null) { - LorenzUtils.error("Could not read item '$rawItemName'") + ChatUtils.error("Could not read item '$rawItemName'") continue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt index 73fd9804c..9fddb9fc6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AtmosphericFilterDisplay.kt @@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.Season -import io.github.moulberry.notenoughupdates.util.SkyBlockTime import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class AtmosphericFilterDisplay { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt index 22d553ea4..c11c2640d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropAccessory.kt @@ -7,8 +7,9 @@ enum class CropAccessory( val internalName: NEUInternalName?, private val affectedCrops: Set, private val fortune: Double, - val upgradeCost: Pair? + val upgradeCost: Pair?, ) { + NONE(null, emptySet(), 0.0, null), CROPIE( "CROPIE_TALISMAN".asInternalName(), @@ -29,6 +30,7 @@ enum class CropAccessory( } companion object { + fun getByName(internalName: NEUInternalName) = entries.firstOrNull { internalName == it.internalName } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt index 3a7226cc4..968fb1b29 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropType.kt @@ -15,34 +15,45 @@ enum class CropType( val simpleName: String, val replenish: Boolean = false, ) { - WHEAT("Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0, + + WHEAT( + "Wheat", "THEORETICAL_HOE_WHEAT", "CROPIE", 1.0, { ItemStack(Items.wheat) }, "wheat" ), - CARROT("Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0, + CARROT( + "Carrot", "THEORETICAL_HOE_CARROT", "CROPIE", 3.0, { ItemStack(Items.carrot) }, "carrot", replenish = true ), - POTATO("Potato", "THEORETICAL_HOE_POTATO", "CROPIE", 3.0, + POTATO( + "Potato", "THEORETICAL_HOE_POTATO", "CROPIE", 3.0, { ItemStack(Items.potato) }, "potato", replenish = true ), - NETHER_WART("Nether Wart", "THEORETICAL_HOE_WARTS", "FERMENTO", 2.5, + NETHER_WART( + "Nether Wart", "THEORETICAL_HOE_WARTS", "FERMENTO", 2.5, { ItemStack(Items.nether_wart) }, "wart", replenish = true ), - PUMPKIN("Pumpkin", "PUMPKIN_DICER", "SQUASH", 1.0, + PUMPKIN( + "Pumpkin", "PUMPKIN_DICER", "SQUASH", 1.0, { ItemStack(Blocks.pumpkin) }, "pumpkin" ), - MELON("Melon", "MELON_DICER", "SQUASH", 5.0, + MELON( + "Melon", "MELON_DICER", "SQUASH", 5.0, { ItemStack(Items.melon) }, "melon" ), - COCOA_BEANS("Cocoa Beans", "COCO_CHOPPER", "SQUASH", 3.0, + COCOA_BEANS( + "Cocoa Beans", "COCO_CHOPPER", "SQUASH", 3.0, { ItemStack(Items.dye, 1, EnumDyeColor.BROWN.dyeDamage) }, "cocoa", replenish = true ), - SUGAR_CANE("Sugar Cane", "THEORETICAL_HOE_CANE", "FERMENTO", 2.0, + SUGAR_CANE( + "Sugar Cane", "THEORETICAL_HOE_CANE", "FERMENTO", 2.0, { ItemStack(Items.reeds) }, "cane" ), - CACTUS("Cactus", "CACTUS_KNIFE", "FERMENTO", 2.0, + CACTUS( + "Cactus", "CACTUS_KNIFE", "FERMENTO", 2.0, { ItemStack(Blocks.cactus) }, "cactus" ), - MUSHROOM("Mushroom", "FUNGI_CUTTER", "FERMENTO", 1.0, + MUSHROOM( + "Mushroom", "FUNGI_CUTTER", "FERMENTO", 1.0, { ItemStack(Blocks.red_mushroom_block) }, "mushroom" ), ; @@ -54,6 +65,7 @@ enum class CropType( override fun toString(): String = cropName companion object { + fun getByNameOrNull(itemName: String): CropType? { if (itemName == "Red Mushroom" || itemName == "Brown Mushroom") return MUSHROOM if (itemName == "Seeds") return WHEAT diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index c7f05d807..5b066b142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -14,11 +14,11 @@ import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.CropType.Companion.getTurboCrop import at.hannibal2.skyhanni.features.garden.GardenAPI.addCropIcon import at.hannibal2.skyhanni.features.garden.pests.PestAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList +import at.hannibal2.skyhanni.utils.CollectionUtils.nextAfter import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList -import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString @@ -36,6 +36,7 @@ import kotlin.math.log10 import kotlin.time.Duration.Companion.seconds class FarmingFortuneDisplay { + private val tabFortuneUniversalPattern = " Farming Fortune: §r§6☘(?\\d+)".toPattern() private val tabFortuneCropPattern = " (?Wheat|Carrot|Potato|Pumpkin|Sugar Cane|Melon|Cactus|Cocoa Beans|Mushroom|Nether Wart) Fortune: §r§6☘(?\\d+)".toPattern() @@ -170,6 +171,7 @@ class FarmingFortuneDisplay { } companion object { + private val config get() = GardenAPI.config.farmingFortunes private val latestFF: MutableMap? get() = GardenAPI.storage?.latestTrueFarmingFortune diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt index 7f7832ff1..61e3d1caa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingMilestoneCommand.kt @@ -3,7 +3,7 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.GardenCropMilestones.getCounter import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.TimeUtils import net.minecraft.command.CommandBase @@ -12,12 +12,12 @@ object FarmingMilestoneCommand { fun onCommand(crop: String?, current: String?, target: String?, needsTime: Boolean) { if (crop == null) { - LorenzUtils.userError("No crop type entered") + ChatUtils.userError("No crop type entered") return } val enteredCrop = CropType.entries.firstOrNull { it.simpleName == crop.lowercase() } ?: run { - LorenzUtils.userError("Invalid crop type entered") + ChatUtils.userError("Invalid crop type entered") return } @@ -30,7 +30,7 @@ object FarmingMilestoneCommand { val cropsForTier = GardenCropMilestones.getCropsForTier(currentCropMilestone, enteredCrop) val output = (cropsForTier - currentProgress).formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed to reach the next milestone") + ChatUtils.chat("§7$output needed to reach the next milestone") return } @@ -38,11 +38,11 @@ object FarmingMilestoneCommand { val cropsForTier = GardenCropMilestones.getCropsForTier(currentMilestone, enteredCrop) val output = cropsForTier.formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed for milestone §7$currentMilestone") + ChatUtils.chat("§7$output needed for milestone §7$currentMilestone") return } if (currentMilestone >= targetMilestone) { - LorenzUtils.userError("Entered milestone is greater than or the same as target milestone") + ChatUtils.userError("Entered milestone is greater than or the same as target milestone") return } @@ -50,7 +50,7 @@ object FarmingMilestoneCommand { val targetAmount = GardenCropMilestones.getCropsForTier(targetMilestone, enteredCrop) val output = (targetAmount - currentAmount).formatOutput(needsTime, enteredCrop) - LorenzUtils.chat("§7$output needed for milestone §7$currentMilestone §a-> §7$targetMilestone") + ChatUtils.chat("§7$output needed for milestone §7$currentMilestone §a-> §7$targetMilestone") } fun onComplete(strings: Array): List { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index dffb6f0ef..cf9fbea6f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -24,13 +24,13 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FarmingItems import at.hannibal2.skyhanni.features.garden.inventory.SkyMartCopperPrice import at.hannibal2.skyhanni.features.garden.visitor.VisitorAPI import at.hannibal2.skyhanni.utils.BlockUtils.isBabyCrop +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside import at.hannibal2.skyhanni.utils.LorenzRarity -import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName @@ -45,6 +45,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import kotlin.time.Duration.Companion.seconds object GardenAPI { + var toolInHand: String? = null var itemInHand: ItemStack? = null var cropInHand: CropType? = null @@ -159,7 +160,7 @@ object GardenAPI { storage?.cropsPerSecond?.clear() GardenBestCropTime.reset() updateGardenTool() - LorenzUtils.chat("Manually reset all crop speed data!") + ChatUtils.chat("Manually reset all crop speed data!") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index 495d82bb6..838b3f6ce 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -7,13 +7,14 @@ import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropMilestoneDisplay -import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class GardenCropMilestoneFix { + private val tabListPattern = " Milestone: §r§a(?.*) (?.*): §r§3(?.*)%".toPattern() private val levelUpPattern = " {2}§r§b§lGARDEN MILESTONE §3(?.*) §8.*➜§3(?.*)".toPattern() @@ -51,7 +52,7 @@ class GardenCropMilestoneFix { val crop = CropType.getByNameOrNull(cropName) if (crop == null) { - LorenzUtils.debug("GardenCropMilestoneFix: crop is null: '$cropName'") + ChatUtils.debug("GardenCropMilestoneFix: crop is null: '$cropName'") return } @@ -81,11 +82,11 @@ class GardenCropMilestoneFix { crop.setCounter(tabListValue) GardenCropMilestoneDisplay.update() if (!loadedCrops.contains(crop)) { - LorenzUtils.chat("Loaded ${crop.cropName} milestone data from $source!") + ChatUtils.chat("Loaded ${crop.cropName} milestone data from $source!") loadedCrops.add(crop) } } else if (diff >= minDiff) { - LorenzUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}") + ChatUtils.debug("Fixed wrong ${crop.cropName} milestone data from $source: ${diff.addSeparators()}") crop.setCounter(tabListValue) GardenCropMilestoneDisplay.update() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt index 6629f1b00..42d417a5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber @@ -12,16 +12,17 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropTimeCommand { + private val config get() = GardenAPI.config.moneyPerHours fun onCommand(args: Array) { if (!config.display) { - LorenzUtils.userError("shcroptime requires 'Show money per Hour' feature to be enabled to work!") + ChatUtils.userError("shcroptime requires 'Show money per Hour' feature to be enabled to work!") return } if (args.size < 2) { - LorenzUtils.userError("Usage: /shcroptime ") + ChatUtils.userError("Usage: /shcroptime ") return } @@ -29,12 +30,12 @@ object GardenCropTimeCommand { val amount = try { rawAmount.formatNumber() } catch (e: NumberFormatException) { - LorenzUtils.userError("Not a valid number: '$rawAmount'") + ChatUtils.userError("Not a valid number: '$rawAmount'") return } val multipliers = CropMoneyDisplay.multipliers if (multipliers.isEmpty()) { - LorenzUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") + ChatUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") return } @@ -69,10 +70,10 @@ object GardenCropTimeCommand { } if (map.isEmpty()) { - LorenzUtils.userError("No crop item found for '$rawSearchName'.") + ChatUtils.userError("No crop item found for '$rawSearchName'.") return } - LorenzUtils.chat("Crop Speed for ${map.size} items:\n" + map.sorted().keys.joinToString("\n")) + ChatUtils.chat("Crop Speed for ${map.size} items:\n" + map.sorted().keys.joinToString("\n")) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt index 768dcbc49..4bf34a5ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt @@ -2,25 +2,26 @@ package at.hannibal2.skyhanni.features.garden import at.hannibal2.skyhanni.features.garden.farming.CropMoneyDisplay import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.getItemName -import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.LorenzUtils.sorted import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils object GardenCropsInCommand { + private val config get() = GardenAPI.config.moneyPerHours fun onCommand(args: Array) { if (!config.display) { - LorenzUtils.userError("shcropsin requires 'Show money per Hour' feature to be enabled to work!") + ChatUtils.userError("shcropsin requires 'Show money per Hour' feature to be enabled to work!") return } if (args.size < 2) { - LorenzUtils.userError("Usage: /shcropsin