diff options
author | Lulonaut <lulonaut@tutanota.de> | 2023-01-25 19:34:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 19:34:16 +0100 |
commit | 9b3672d5446540b41eeb8f217cfc352dfb45c2d5 (patch) | |
tree | 9726838c632625ed0d4d55499ad5c7de1ae5caa1 /src/main | |
parent | d9f3fa267bbb4ab679f9c4c043ca98c911bdd86b (diff) | |
download | NotEnoughUpdates-9b3672d5446540b41eeb8f217cfc352dfb45c2d5.tar.gz NotEnoughUpdates-9b3672d5446540b41eeb8f217cfc352dfb45c2d5.tar.bz2 NotEnoughUpdates-9b3672d5446540b41eeb8f217cfc352dfb45c2d5.zip |
Cancel wardrobe hotkey inputs (#563)
Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Co-authored-by: Roman / Linnea Gräf <roman.graef@gmail.com>
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt index 4e99f5a7..d34f3b5e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 NotEnoughUpdates contributors + * Copyright (C) 2022-2023 NotEnoughUpdates contributors * * This file is part of NotEnoughUpdates. * @@ -41,8 +41,17 @@ class WardrobeMouseButtons { private var lastClick = -1L @SubscribeEvent - fun onGui(event: GuiScreenEvent) { - if (!NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.enableWardrobeKeybinds) return + fun onGuiKeyboardInput(event: GuiScreenEvent.KeyboardInputEvent.Pre) { + checkKeybinds(event) + } + + @SubscribeEvent + fun onGuiMouseInput(event: GuiScreenEvent.MouseInputEvent.Pre) { + checkKeybinds(event) + } + + private fun checkKeybinds(event: GuiScreenEvent) { + if (!NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.enableWardrobeKeybinds || !NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return val gui = event.gui as? GuiChest ?: return if (!Utils.getOpenChestName().contains("Wardrobe")) return @@ -51,9 +60,11 @@ class WardrobeMouseButtons { if (System.currentTimeMillis() - lastClick > 300) { Utils.sendLeftMouseClick(gui.inventorySlots.windowId, 36 + i) lastClick = System.currentTimeMillis() + event.isCanceled = true } break } } } + } |