diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt | 8 |
2 files changed, 12 insertions, 3 deletions
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 9739ece50..6629f1b00 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -32,12 +32,17 @@ object GardenCropTimeCommand { LorenzUtils.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.") + return + } val rawSearchName = args.toMutableList().drop(1).joinToString(" ") val searchName = rawSearchName.lowercase() val map = mutableMapOf<String, Long>() - for (entry in CropMoneyDisplay.multipliers) { + for (entry in multipliers) { val internalName = entry.key val itemName = internalName.getItemName() if (itemName.removeColor().lowercase().contains(searchName)) { 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 a059e65f1..768dcbc49 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt @@ -10,7 +10,6 @@ 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 @@ -32,12 +31,17 @@ object GardenCropsInCommand { LorenzUtils.userError("Not a valid time: '$rawTime'") return } + val multipliers = CropMoneyDisplay.multipliers + if (multipliers.isEmpty()) { + LorenzUtils.userError("Data not loaded yet. Join the garden and display the money per hour display.") + return + } val rawSearchName = args.toMutableList().drop(1).joinToString(" ") val searchName = rawSearchName.lowercase() val map = mutableMapOf<String, Long>() - for (entry in CropMoneyDisplay.multipliers) { + for (entry in multipliers) { val internalName = entry.key val itemName = internalName.getItemName() if (itemName.removeColor().lowercase().contains(searchName)) { |