diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-06 10:39:10 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-01-06 10:39:10 +0100 |
commit | 3378a4127449f980b634b584cb67fc24821a8457 (patch) | |
tree | 748df44ed1956e857ca72b3036ec272273c3834e /src/main | |
parent | 98118ff20394311a8ad0f5259f13251ec726b5ed (diff) | |
download | skyhanni-3378a4127449f980b634b584cb67fc24821a8457.tar.gz skyhanni-3378a4127449f980b634b584cb67fc24821a8457.tar.bz2 skyhanni-3378a4127449f980b634b584cb67fc24821a8457.zip |
Show error message for the commands /shcropsin and /shcroptime if show money per hour display is not loaded.
Diffstat (limited to 'src/main')
-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)) { |