diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index f35f08c96..e32f1d899 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -18,6 +18,7 @@ class ConfigManager { companion object { val gson = GsonBuilder().setPrettyPrinting() .excludeFieldsWithoutExposeAnnotation() + .serializeSpecialFloatingPointValues() .registerTypeAdapterFactory(PropertyTypeAdapterFactory()) .create() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index 0124d75ca..2ff5706b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -68,7 +68,7 @@ object GardenCropSpeed { if (blocksBroken == 0) { if (blocksSpeedList.size == 0) return - secondsStopped ++ + secondsStopped++ } else { if (secondsStopped >= config.blocksBrokenResetTime) { resetSpeed() @@ -82,7 +82,9 @@ object GardenCropSpeed { blocksSpeedList.removeFirst() blocksSpeedList.add(blocksBroken) } - averageBlocksPerSecond = blocksSpeedList.dropLast(1).average() + averageBlocksPerSecond = if (blocksSpeedList.size > 1) { + blocksSpeedList.dropLast(1).average() + } else 0.0 GardenAPI.getCurrentlyFarmedCrop()?.let { latestBlocksPerSecond[it] = averageBlocksPerSecond } |