Skip to content

Commit 668b540

Browse files
committed
merge fixes
1 parent 5694840 commit 668b540

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package com.lambda.module
1919

2020
import com.lambda.Lambda.mc
21-
import com.lambda.Lambda
2221
import com.lambda.command.LambdaCommand
2322
import com.lambda.config.AbstractSetting
2423
import com.lambda.config.Configurable
@@ -41,7 +40,6 @@ import com.lambda.sound.SoundManager.play
4140
import com.lambda.util.KeyCode
4241
import com.lambda.util.Mouse
4342
import com.lambda.util.Nameable
44-
import javax.swing.ActionMap
4543

4644
/**
4745
* A [Module] is a feature or tool for the utility mod.
@@ -143,7 +141,7 @@ abstract class Module(
143141
listen<MouseEvent.Click>(alwaysListen = true) { event ->
144142
val pressed = event.action == Mouse.Action.Click.ordinal
145143
val released = event.action == Mouse.Action.Release.ordinal
146-
onButtonPress(event.button, pressed, released, mouseButton = true)
144+
onButtonPress(event.button, pressed, released)
147145
}
148146

149147
onEnable { LambdaSound.MODULE_ON.play() }
@@ -157,12 +155,12 @@ abstract class Module(
157155
listen<ConnectionEvent.Disconnect> { if (autoDisable) disable() }
158156
}
159157

160-
private fun onButtonPress(code: Int, pressed: Boolean, released: Boolean, mouseButton: Boolean = false) {
158+
private fun onButtonPress(code: Int, pressed: Boolean, released: Boolean) {
161159
if (mc.options.commandKey.isPressed) return
162160
if (mc.currentScreen != null) return
163-
if (keybind.code == KeyCode.UNBOUND.code) return
164161
if (code != keybind.code) return
165-
toggle()
162+
if (pressed) toggle()
163+
else if (released && disableOnRelease) disable()
166164
}
167165

168166
fun enable() {

0 commit comments

Comments
 (0)