1818package com.lambda.module
1919
2020import com.lambda.Lambda.mc
21- import com.lambda.Lambda
2221import com.lambda.command.LambdaCommand
2322import com.lambda.config.AbstractSetting
2423import com.lambda.config.Configurable
@@ -41,7 +40,6 @@ import com.lambda.sound.SoundManager.play
4140import com.lambda.util.KeyCode
4241import com.lambda.util.Mouse
4342import 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