File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
common/src/main/kotlin/com/lambda
gui/impl/clickgui/buttons Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -174,12 +174,11 @@ class ModuleButton(
174174 }
175175
176176 override fun performClickAction (e : GuiEvent .MouseClick ) {
177- val sound = when (e.button) {
177+ when (e.button) {
178178 Mouse .Button .Left -> {
179179 module.toggle()
180- if (module.isEnabled) LambdaSound .MODULE_ON else LambdaSound .MODULE_OFF
181- }
182180
181+ }
183182 Mouse .Button .Right -> {
184183 // Don't let user spam
185184 val targetHeight = if (isOpen) settingsHeight else 0.0
@@ -189,13 +188,10 @@ class ModuleButton(
189188 if (isOpen) settingsLayer.onEvent(GuiEvent .Show ())
190189 updateHeight()
191190
192- if (isOpen) LambdaSound .SETTINGS_OPEN else LambdaSound .SETTINGS_CLOSE
191+ val sound = if (isOpen) LambdaSound .SETTINGS_OPEN else LambdaSound .SETTINGS_CLOSE
192+ playSoundRandomly(sound.event)
193193 }
194-
195- else -> return
196194 }
197-
198- playSoundRandomly(sound.event)
199195 }
200196
201197 override fun equals (other : Any? ) =
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import com.lambda.gui.impl.clickgui.LambdaClickGui
1818import com.lambda.gui.impl.clickgui.buttons.ModuleButton
1919import com.lambda.module.modules.client.ClickGui
2020import com.lambda.module.tag.ModuleTag
21+ import com.lambda.sound.LambdaSound
22+ import com.lambda.sound.SoundManager.playSoundRandomly
2123import com.lambda.util.KeyCode
2224import com.lambda.util.Nameable
2325
@@ -119,6 +121,14 @@ abstract class Module(
119121 || screen is LambdaClickGui )
120122 ) toggle()
121123 }
124+
125+ onEnable {
126+ playSoundRandomly(LambdaSound .MODULE_ON .event)
127+ }
128+
129+ onDisable {
130+ playSoundRandomly(LambdaSound .MODULE_OFF .event)
131+ }
122132 }
123133
124134 fun enable () {
You can’t perform that action at this time.
0 commit comments