From adc931b07ea4fa0958a90cea3145dc175881e282 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 23 Mar 2023 22:26:24 +0100 Subject: Added workaround for crop speed error --- .../java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main') 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 8c18659d0..c12710a4b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -101,7 +101,16 @@ class GardenAPI { return -1 } - fun CropType.getSpeed() = cropsPerSecond[this]!! + fun CropType.getSpeed(): Int { + val speed = cropsPerSecond[this] + if (speed != null) return speed + + val message = "Set speed for $this to -1!" + println(message) + LorenzUtils.debug(message) + setSpeed(-1) + return -1 + } fun CropType.setSpeed(speed: Int) { cropsPerSecond[this] = speed -- cgit