From a0fab9ae8c8173b3192c52f5cddd35f85eca7ee1 Mon Sep 17 00:00:00 2001 From: KazutoXD Date: Fri, 6 Jan 2023 01:42:46 +0100 Subject: [PATCH 1/2] Rename AutoLog module to AutoDisconnect In most clients this module is called AutoDisconnect so as to avoid confusion I think renaming it would be very good :) --- .../com/lambda/client/gui/mc/LambdaGuiDisconnected.kt | 10 +++++----- .../modules/combat/{AutoLog.kt => AutoDisconnect.kt} | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) rename src/main/kotlin/com/lambda/client/module/modules/combat/{AutoLog.kt => AutoDisconnect.kt} (96%) diff --git a/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt b/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt index 6ee09046f..18ea9b2e5 100644 --- a/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt +++ b/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt @@ -1,6 +1,6 @@ package com.lambda.client.gui.mc -import com.lambda.client.module.modules.combat.AutoLog +import com.lambda.client.module.modules.combat.AutoDisconnect import com.lambda.client.util.threads.mainScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -15,7 +15,7 @@ class LambdaGuiDisconnected(private val reason: Array, private val scree buttonList.add(GuiButton(0, width / 2 - 100, 200, "Okay")) if (!disable) { - buttonList.add(GuiButton(1, width / 2 - 100, 220, "Disable AutoLog")) + buttonList.add(GuiButton(1, width / 2 - 100, 220, "Disable AutoDisconnect")) } else { disable() } @@ -23,14 +23,14 @@ class LambdaGuiDisconnected(private val reason: Array, private val scree override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { drawBackground(0) - drawCenteredString(fontRenderer, "[AutoLog] Logged because:", width / 2, 80, 0x9B90FF) + drawCenteredString(fontRenderer, "[AutoDisconnect] Logged because:", width / 2, 80, 0x9B90FF) for ((index, reason) in reason.withIndex()) { drawCenteredString(fontRenderer, reason, width / 2, 94 + (14 * index), 0xFFFFFF) } drawCenteredString(fontRenderer, "Logged out at: $logoutTime", width / 2, 140, 0xFFFFFFF) - if (!disable) drawCenteredString(fontRenderer, "Disabled AutoLog", width / 2, 224, 0xDE413C) + if (!disable) drawCenteredString(fontRenderer, "Disabled AutoDisconnect", width / 2, 224, 0xDE413C) super.drawScreen(mouseX, mouseY, partialTicks) } @@ -47,7 +47,7 @@ class LambdaGuiDisconnected(private val reason: Array, private val scree private fun disable() { mainScope.launch { delay(250L) - AutoLog.disable() + AutoDisconnect.disable() } } diff --git a/src/main/kotlin/com/lambda/client/module/modules/combat/AutoLog.kt b/src/main/kotlin/com/lambda/client/module/modules/combat/AutoDisconnect.kt similarity index 96% rename from src/main/kotlin/com/lambda/client/module/modules/combat/AutoLog.kt rename to src/main/kotlin/com/lambda/client/module/modules/combat/AutoDisconnect.kt index ebc75a412..1a9de12ec 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/combat/AutoLog.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/combat/AutoDisconnect.kt @@ -7,7 +7,7 @@ import com.lambda.client.manager.managers.CombatManager import com.lambda.client.manager.managers.FriendManager import com.lambda.client.module.Category import com.lambda.client.module.Module -import com.lambda.client.module.modules.combat.AutoLog.Reasons.* +import com.lambda.client.module.modules.combat.AutoDisconnect.Reasons.* import com.lambda.client.util.EntityUtils.isFakeOrSelf import com.lambda.client.util.combat.CombatUtils.scaledHealth import com.lambda.client.util.items.allSlots @@ -25,9 +25,9 @@ import net.minecraft.util.text.TextComponentString import net.minecraftforge.fml.common.gameevent.TickEvent import java.time.LocalTime -object AutoLog : Module( - name = "AutoLog", - description = "Automatically log when in danger or on low health", +object AutoDisconnect : Module( + name = "AutoDisconnect", + description = "Automatically disconnects when in danger or on low health", category = Category.COMBAT, alwaysListening = true ) { From fcfb2ffc9bb73d921ab008e8e759ee1723c6a865 Mon Sep 17 00:00:00 2001 From: Constructor Date: Sun, 8 Jan 2023 19:19:09 +0100 Subject: [PATCH 2/2] Cleanup --- .../client/gui/mc/LambdaGuiDisconnected.kt | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt b/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt index 18ea9b2e5..ca9981c4b 100644 --- a/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt +++ b/src/main/kotlin/com/lambda/client/gui/mc/LambdaGuiDisconnected.kt @@ -8,7 +8,12 @@ import net.minecraft.client.gui.GuiButton import net.minecraft.client.gui.GuiScreen import java.time.LocalTime -class LambdaGuiDisconnected(private val reason: Array, private val screen: GuiScreen, private val disable: Boolean, private val logoutTime: LocalTime) : GuiScreen() { +class LambdaGuiDisconnected( + private val reason: Array, + private val screen: GuiScreen, + private val disable: Boolean, + private val logoutTime: LocalTime +) : GuiScreen() { override fun initGui() { super.initGui() @@ -23,8 +28,9 @@ class LambdaGuiDisconnected(private val reason: Array, private val scree override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { drawBackground(0) - drawCenteredString(fontRenderer, "[AutoDisconnect] Logged because:", width / 2, 80, 0x9B90FF) - for ((index, reason) in reason.withIndex()) { + drawCenteredString(fontRenderer, "[AutoDisconnect] Disconnected because:", width / 2, 80, 0x9B90FF) + + reason.forEachIndexed { index, reason -> drawCenteredString(fontRenderer, reason, width / 2, 94 + (14 * index), 0xFFFFFF) } @@ -37,10 +43,12 @@ class LambdaGuiDisconnected(private val reason: Array, private val scree override fun keyTyped(typedChar: Char, keyCode: Int) {} override fun actionPerformed(button: GuiButton) { - if (button.id == 0) mc.displayGuiScreen(screen) - if (button.id == 1) { - disable() - buttonList.remove(button) + when (button.id) { + 0 -> mc.displayGuiScreen(screen) + 1 -> { + disable() + buttonList.remove(button) + } } }