From 3bc84f50fcb86abbe956c9ccbdf52cbdb563af47 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 26 Feb 2024 16:50:03 +0100 Subject: Added String.formatLongOrUserError() --- .../skyhanni/features/garden/GardenCropTimeCommand.kt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 217b01259..74269c52d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -7,7 +7,7 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.sorted import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.NumberUtil.formatLongOrUserError import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TimeUtils @@ -26,13 +26,7 @@ object GardenCropTimeCommand { return } - val rawAmount = args[0] - val amount = try { - rawAmount.formatNumber() - } catch (e: NumberFormatException) { - ChatUtils.userError("Not a valid number: '$rawAmount'") - return - } + val amount = args[0].formatLongOrUserError() ?: return val multipliers = CropMoneyDisplay.multipliers if (multipliers.isEmpty()) { ChatUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") -- cgit