Skip to content

Commit 8bb124a

Browse files
committed
Fix ClickGUI keybind again
1 parent 243a526 commit 8bb124a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

common/src/main/kotlin/com/lambda/module/Module.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import com.lambda.event.listener.Listener
1414
import com.lambda.event.listener.SafeListener
1515
import com.lambda.event.listener.SafeListener.Companion.listener
1616
import com.lambda.event.listener.UnsafeListener
17-
import com.lambda.gui.api.LambdaGui
1817
import com.lambda.gui.impl.clickgui.buttons.ModuleButton
1918
import com.lambda.module.modules.client.ClickGui
2019
import com.lambda.module.tag.ModuleTag
@@ -116,9 +115,9 @@ abstract class Module(
116115
if (mc.options.commandKey.isPressed) return@listener
117116
if (keybind == KeyCode.UNBOUND) return@listener
118117
if (event.translated != keybind) return@listener
119-
if (mc.currentScreen is ChatScreen) return@listener
118+
if (mc.currentScreen != null) return@listener
120119

121-
if (mc.currentScreen == null || this@Module is ClickGui) toggle()
120+
toggle()
122121
}
123122

124123
onEnable {

common/src/main/kotlin/com/lambda/module/modules/client/ClickGui.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.lambda.module.modules.client
22

33
import com.lambda.event.events.ClientEvent
4+
import com.lambda.event.events.KeyPressEvent
5+
import com.lambda.event.events.TickEvent
6+
import com.lambda.event.listener.SafeListener.Companion.listener
47
import com.lambda.event.listener.UnsafeListener.Companion.unsafeListener
58
import com.lambda.gui.impl.clickgui.LambdaClickGui
69
import com.lambda.gui.impl.hudgui.LambdaHudGui
@@ -43,6 +46,14 @@ object ClickGui : Module(
4346
LambdaHudGui.close()
4447
}
4548

49+
listener<KeyPressEvent> { event ->
50+
if (mc.options.commandKey.isPressed) return@listener
51+
if (keybind == KeyCode.UNBOUND) return@listener
52+
if (event.translated != keybind) return@listener
53+
// ToDo: Exception for ui text input
54+
toggle()
55+
}
56+
4657
unsafeListener<ClientEvent.Shutdown> {
4758
disable()
4859
}

0 commit comments

Comments
 (0)