|
1 | 1 | package com.lambda.client.gui.mc
|
2 | 2 |
|
3 |
| -import com.lambda.client.module.modules.combat.AutoLog |
| 3 | +import com.lambda.client.module.modules.combat.AutoDisconnect |
4 | 4 | import com.lambda.client.util.threads.mainScope
|
5 | 5 | import kotlinx.coroutines.delay
|
6 | 6 | import kotlinx.coroutines.launch
|
7 | 7 | import net.minecraft.client.gui.GuiButton
|
8 | 8 | import net.minecraft.client.gui.GuiScreen
|
9 | 9 | import java.time.LocalTime
|
10 | 10 |
|
11 |
| -class LambdaGuiDisconnected(private val reason: Array<String>, private val screen: GuiScreen, private val disable: Boolean, private val logoutTime: LocalTime) : GuiScreen() { |
| 11 | +class LambdaGuiDisconnected( |
| 12 | + private val reason: Array<String>, |
| 13 | + private val screen: GuiScreen, |
| 14 | + private val disable: Boolean, |
| 15 | + private val logoutTime: LocalTime |
| 16 | +) : GuiScreen() { |
12 | 17 |
|
13 | 18 | override fun initGui() {
|
14 | 19 | super.initGui()
|
15 | 20 |
|
16 | 21 | buttonList.add(GuiButton(0, width / 2 - 100, 200, "Okay"))
|
17 | 22 | if (!disable) {
|
18 |
| - buttonList.add(GuiButton(1, width / 2 - 100, 220, "Disable AutoLog")) |
| 23 | + buttonList.add(GuiButton(1, width / 2 - 100, 220, "Disable AutoDisconnect")) |
19 | 24 | } else {
|
20 | 25 | disable()
|
21 | 26 | }
|
22 | 27 | }
|
23 | 28 |
|
24 | 29 | override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
|
25 | 30 | drawBackground(0)
|
26 |
| - drawCenteredString(fontRenderer, "[AutoLog] Logged because:", width / 2, 80, 0x9B90FF) |
27 |
| - for ((index, reason) in reason.withIndex()) { |
| 31 | + drawCenteredString(fontRenderer, "[AutoDisconnect] Disconnected because:", width / 2, 80, 0x9B90FF) |
| 32 | + |
| 33 | + reason.forEachIndexed { index, reason -> |
28 | 34 | drawCenteredString(fontRenderer, reason, width / 2, 94 + (14 * index), 0xFFFFFF)
|
29 | 35 | }
|
30 | 36 |
|
31 | 37 | drawCenteredString(fontRenderer, "Logged out at: $logoutTime", width / 2, 140, 0xFFFFFFF)
|
32 | 38 |
|
33 |
| - if (!disable) drawCenteredString(fontRenderer, "Disabled AutoLog", width / 2, 224, 0xDE413C) |
| 39 | + if (!disable) drawCenteredString(fontRenderer, "Disabled AutoDisconnect", width / 2, 224, 0xDE413C) |
34 | 40 | super.drawScreen(mouseX, mouseY, partialTicks)
|
35 | 41 | }
|
36 | 42 |
|
37 | 43 | override fun keyTyped(typedChar: Char, keyCode: Int) {}
|
38 | 44 |
|
39 | 45 | override fun actionPerformed(button: GuiButton) {
|
40 |
| - if (button.id == 0) mc.displayGuiScreen(screen) |
41 |
| - if (button.id == 1) { |
42 |
| - disable() |
43 |
| - buttonList.remove(button) |
| 46 | + when (button.id) { |
| 47 | + 0 -> mc.displayGuiScreen(screen) |
| 48 | + 1 -> { |
| 49 | + disable() |
| 50 | + buttonList.remove(button) |
| 51 | + } |
44 | 52 | }
|
45 | 53 | }
|
46 | 54 |
|
47 | 55 | private fun disable() {
|
48 | 56 | mainScope.launch {
|
49 | 57 | delay(250L)
|
50 |
| - AutoLog.disable() |
| 58 | + AutoDisconnect.disable() |
51 | 59 | }
|
52 | 60 | }
|
53 | 61 |
|
|
0 commit comments