aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-23 22:26:24 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-23 22:26:24 +0100
commitadc931b07ea4fa0958a90cea3145dc175881e282 (patch)
tree5a00979ce7edff3fb70f65ec1ad600ba330e5da5 /src/main
parent785a01c9dfd4576621d48bab046d1bd991d039b3 (diff)
downloadskyhanni-adc931b07ea4fa0958a90cea3145dc175881e282.tar.gz
skyhanni-adc931b07ea4fa0958a90cea3145dc175881e282.tar.bz2
skyhanni-adc931b07ea4fa0958a90cea3145dc175881e282.zip
Added workaround for crop speed error
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt11
1 files changed, 10 insertions, 1 deletions
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