From 423b78168b7c487f14c92bf3cd083d9db2a5fd09 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 8 May 2024 13:39:12 +0200 Subject: code cleanup --- .../features/garden/visitor/GardenVisitorSupercraft.kt | 13 ++++++------- .../features/garden/visitor/VisitorRewardWarning.kt | 2 +- .../inventory/chocolatefactory/ChocolateFactoryShortcut.kt | 13 ++++++------- 3 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt index 33643a172..e64e0c76b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorSupercraft.kt @@ -101,15 +101,14 @@ class GardenVisitorSupercraft { } @SubscribeEvent(priority = EventPriority.HIGH) - fun onStackClick(event: GuiContainerEvent.SlotClickEvent) { + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (!hasIngredients) return - if (event.slotId == 31) { - event.isCanceled = true - if (lastClick.passedSince() > 0.3.seconds) { - ChatUtils.sendCommandToServer("recipe $lastSuperCraftMaterial") - lastClick = SimpleTimeMark.now() - } + if (event.slotId != 31) return + event.isCanceled = true + if (lastClick.passedSince() > 0.3.seconds) { + ChatUtils.sendCommandToServer("recipe $lastSuperCraftMaterial") + lastClick = SimpleTimeMark.now() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt index 883562a0b..75d0af8bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt @@ -52,7 +52,7 @@ class VisitorRewardWarning { } @SubscribeEvent(priority = EventPriority.HIGH) - fun onStackClick(event: GuiContainerEvent.SlotClickEvent) { + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { if (!VisitorAPI.inInventory) return val stack = event.slot?.stack ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt index a1a62c727..d3bb031b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateFactoryShortcut.kt @@ -59,13 +59,12 @@ class ChocolateFactoryShortcut { } @SubscribeEvent(priority = EventPriority.HIGH) - fun onStackClick(event: GuiContainerEvent.SlotClickEvent) { - if (showItem && event.slotId == 15) { - event.cancel() - if (lastClick.passedSince() > 2.seconds) { - HypixelCommands.chocolateFactory() - lastClick = SimpleTimeMark.now() - } + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + if (!showItem || event.slotId != 15) return + event.cancel() + if (lastClick.passedSince() > 2.seconds) { + HypixelCommands.chocolateFactory() + lastClick = SimpleTimeMark.now() } } } -- cgit