From fe00857ce42a8b829d72b2515c4f940c68c67a19 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:01:53 +0100 Subject: code cleanup --- .../skyhanni/features/garden/GardenOptimalSpeed.kt | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt index a4a326ad2..c0ce6e821 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenOptimalSpeed.kt @@ -97,19 +97,20 @@ class GardenOptimalSpeed { private fun CropType.getOptimalSpeed() = getConfig().get().toInt() - private fun CropType.getConfig(): Property = - when (this) { - CropType.WHEAT -> configCustomSpeed.wheat - CropType.CARROT -> configCustomSpeed.carrot - CropType.POTATO -> configCustomSpeed.potato - CropType.NETHER_WART -> configCustomSpeed.netherWart - CropType.PUMPKIN -> configCustomSpeed.pumpkin - CropType.MELON -> configCustomSpeed.melon - CropType.COCOA_BEANS -> configCustomSpeed.cocoaBeans - CropType.SUGAR_CANE -> configCustomSpeed.sugarCane - CropType.CACTUS -> configCustomSpeed.cactus - CropType.MUSHROOM -> configCustomSpeed.mushroom + private fun CropType.getConfig(): Property = with(configCustomSpeed) { + when (this@getConfig) { + CropType.WHEAT -> wheat + CropType.CARROT -> carrot + CropType.POTATO -> potato + CropType.NETHER_WART -> netherWart + CropType.PUMPKIN -> pumpkin + CropType.MELON -> melon + CropType.COCOA_BEANS -> cocoaBeans + CropType.SUGAR_CANE -> sugarCane + CropType.CACTUS -> cactus + CropType.MUSHROOM -> mushroom } + } @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { -- cgit