From 5e7f0577fc5a455d35cef4f7ad7697dbd9a795f9 Mon Sep 17 00:00:00 2001 From: Snowshoe <20788786+SnowshoeIceboot@users.noreply.github.com> Date: Sat, 29 Oct 2022 06:02:08 -0700 Subject: [PATCH 1/6] Make AutoExcuse external only --- .../client/module/modules/chat/AutoExcuse.kt | 81 +++++-------------- 1 file changed, 22 insertions(+), 59 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt index 229d87665..3ced7aff4 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt @@ -1,6 +1,7 @@ package com.lambda.client.module.modules.chat import com.lambda.client.LambdaMod +import com.lambda.client.commons.extension.synchronized import com.lambda.client.event.SafeClientEvent import com.lambda.client.event.events.PacketEvent import com.lambda.client.module.Category @@ -15,6 +16,7 @@ import net.minecraft.init.Items import net.minecraft.network.play.server.SPacketUpdateHealth import net.minecraft.util.EnumHand import java.io.File +import kotlin.random.Random object AutoExcuse : Module( name = "AutoExcuse", @@ -22,78 +24,32 @@ object AutoExcuse : Module( category = Category.CHAT, modulePriority = 500 ) { - private val mode by setting("Mode", Mode.INTERNAL) - - private enum class Mode { - INTERNAL, EXTERNAL - } - - private const val CLIENT_NAME = "%CLIENT%" - private val defaultExcuses = arrayOf( - "Sorry, im using $CLIENT_NAME client", - "My ping is so bad", - "I was changing my config :(", - "Why did my AutoTotem break", - "I was desynced", - "Stupid hackers killed me", - "Wow, so many try hards", - "Lagggg", - "I wasn't trying", - "I'm not using $CLIENT_NAME client", - "Thers to much lag", - "My dog ate my pc", - "Sorry, $CLIENT_NAME Client is really bad", - "I was lagging", - "He was cheating!", - "Your hacking!", - "Lol imagine actully trying", - "I didn't move my mouse", - "I was playing on easy mode(;", - "My wifi went down", - "I'm playing vanila", - "My optifine didn't work", - "The CPU cheated!" - ) - private val file = File(FolderUtils.lambdaFolder + "excuses.txt") - private var loadedExcuses = defaultExcuses - - private val clients = arrayOf( - "Future", - "Salhack", - "Pyro", - "Impact" - ) + private val spammer = ArrayList().synchronized() + private var currentLine = 0 private val timer = TickTimer(TimeUnit.SECONDS) init { safeListener { - if (loadedExcuses.isEmpty() || it.packet !is SPacketUpdateHealth) return@safeListener + if (spammer.isEmpty() || it.packet !is SPacketUpdateHealth) return@safeListener if (it.packet.health <= 0.0f && !isHoldingTotem && timer.tick(3L)) { sendServerMessage(getExcuse()) } } onEnable { - loadedExcuses = if (mode == Mode.EXTERNAL) { - if (file.exists()) { - val cacheList = ArrayList() - try { - file.forEachLine { if (it.isNotBlank()) cacheList.add(it.trim()) } - MessageSendHelper.sendChatMessage("$chatName Loaded spammer messages!") - } catch (e: Exception) { - LambdaMod.LOG.error("Failed loading excuses", e) - } - cacheList.toTypedArray() - } else { - file.createNewFile() - MessageSendHelper.sendErrorMessage("$chatName Excuses file is empty!" + - ", please add them in the &7excuses.txt&f under the &7.minecraft/lambda&f directory.") - defaultExcuses + if (file.exists()) { + try { + file.forEachLine { if (it.isNotBlank()) spammer.add(it.trim()) } + MessageSendHelper.sendChatMessage("$chatName Loaded spammer messages!") + } catch (e: Exception) { + LambdaMod.LOG.error("Failed loading excuses", e) } } else { - defaultExcuses + file.createNewFile() + MessageSendHelper.sendErrorMessage("$chatName Excuses file is empty!" + + ", please add them in the &7excuses.txt&f under the &7.minecraft/lambda&f directory.") } } } @@ -101,5 +57,12 @@ object AutoExcuse : Module( private val SafeClientEvent.isHoldingTotem: Boolean get() = EnumHand.values().any { player.getHeldItem(it).item == Items.TOTEM_OF_UNDYING } - private fun getExcuse() = loadedExcuses.random().replace(CLIENT_NAME, clients.random()) + private fun getExcuse(): String { + val prevLine = currentLine + // Avoids sending the same message + while (spammer.size != 1 && currentLine == prevLine) { + currentLine = Random.nextInt(spammer.size) + } + return spammer[currentLine] + } } From 363e193c02dca6244e56e6e23b56d1cd9c19d3c2 Mon Sep 17 00:00:00 2001 From: Snowshoe <20788786+SnowshoeIceboot@users.noreply.github.com> Date: Sun, 30 Oct 2022 05:28:10 -0700 Subject: [PATCH 2/6] Changed var name in AutoExcuse.kt --- .../lambda/client/module/modules/chat/AutoExcuse.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt index 3ced7aff4..37637565c 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt @@ -25,14 +25,14 @@ object AutoExcuse : Module( modulePriority = 500 ) { private val file = File(FolderUtils.lambdaFolder + "excuses.txt") - private val spammer = ArrayList().synchronized() + private val loadedExcuses = ArrayList().synchronized() private var currentLine = 0 private val timer = TickTimer(TimeUnit.SECONDS) init { safeListener { - if (spammer.isEmpty() || it.packet !is SPacketUpdateHealth) return@safeListener + if (loadedExcuses.isEmpty() || it.packet !is SPacketUpdateHealth) return@safeListener if (it.packet.health <= 0.0f && !isHoldingTotem && timer.tick(3L)) { sendServerMessage(getExcuse()) } @@ -41,7 +41,7 @@ object AutoExcuse : Module( onEnable { if (file.exists()) { try { - file.forEachLine { if (it.isNotBlank()) spammer.add(it.trim()) } + file.forEachLine { if (it.isNotBlank()) loadedExcuses.add(it.trim()) } MessageSendHelper.sendChatMessage("$chatName Loaded spammer messages!") } catch (e: Exception) { LambdaMod.LOG.error("Failed loading excuses", e) @@ -60,9 +60,9 @@ object AutoExcuse : Module( private fun getExcuse(): String { val prevLine = currentLine // Avoids sending the same message - while (spammer.size != 1 && currentLine == prevLine) { - currentLine = Random.nextInt(spammer.size) + while (loadedExcuses.size != 1 && currentLine == prevLine) { + currentLine = Random.nextInt(loadedExcuses.size) } - return spammer[currentLine] + return loadedExcuses[currentLine] } } From ea8c75a0cdea92c812b43c1336e3af4f572a481c Mon Sep 17 00:00:00 2001 From: Snowshoe <20788786+SnowshoeIceboot@users.noreply.github.com> Date: Sun, 30 Oct 2022 07:52:36 -0700 Subject: [PATCH 3/6] In-Order option for AutoExcuse --- .../client/module/modules/chat/AutoExcuse.kt | 45 ++++++++++++++----- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt index 37637565c..0683bbb23 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt @@ -6,12 +6,16 @@ import com.lambda.client.event.SafeClientEvent import com.lambda.client.event.events.PacketEvent import com.lambda.client.module.Category import com.lambda.client.module.Module +import com.lambda.client.module.modules.chat.Spammer.setting import com.lambda.client.util.FolderUtils import com.lambda.client.util.TickTimer import com.lambda.client.util.TimeUnit import com.lambda.client.util.text.MessageSendHelper import com.lambda.client.util.text.MessageSendHelper.sendServerMessage +import com.lambda.client.util.threads.defaultScope import com.lambda.client.util.threads.safeListener +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch import net.minecraft.init.Items import net.minecraft.network.play.server.SPacketUpdateHealth import net.minecraft.util.EnumHand @@ -24,32 +28,45 @@ object AutoExcuse : Module( category = Category.CHAT, modulePriority = 500 ) { + private val modeSetting by setting("Order", Mode.RANDOM_ORDER) + private val file = File(FolderUtils.lambdaFolder + "excuses.txt") private val loadedExcuses = ArrayList().synchronized() private var currentLine = 0 private val timer = TickTimer(TimeUnit.SECONDS) + private enum class Mode { + IN_ORDER, RANDOM_ORDER + } + init { safeListener { if (loadedExcuses.isEmpty() || it.packet !is SPacketUpdateHealth) return@safeListener if (it.packet.health <= 0.0f && !isHoldingTotem && timer.tick(3L)) { - sendServerMessage(getExcuse()) + val message = if (modeSetting == Mode.IN_ORDER) getOrdered() else getRandom() + sendServerMessage(message) } } onEnable { - if (file.exists()) { - try { - file.forEachLine { if (it.isNotBlank()) loadedExcuses.add(it.trim()) } - MessageSendHelper.sendChatMessage("$chatName Loaded spammer messages!") - } catch (e: Exception) { - LambdaMod.LOG.error("Failed loading excuses", e) + loadedExcuses.clear() + + defaultScope.launch(Dispatchers.IO) { + if (file.exists()) { + try { + file.forEachLine { if (it.isNotBlank()) loadedExcuses.add(it.trim()) } + MessageSendHelper.sendChatMessage("$chatName Loaded excuse messages!") + } catch (e: Exception) { + MessageSendHelper.sendErrorMessage("$chatName Failed loading excuses, $e") + disable() + } + } else { + file.createNewFile() + MessageSendHelper.sendErrorMessage("$chatName Excuses file is empty!" + + ", please add them in the &7excuses.txt&f under the &7.minecraft/lambda&f directory.") + disable() } - } else { - file.createNewFile() - MessageSendHelper.sendErrorMessage("$chatName Excuses file is empty!" + - ", please add them in the &7excuses.txt&f under the &7.minecraft/lambda&f directory.") } } } @@ -57,7 +74,11 @@ object AutoExcuse : Module( private val SafeClientEvent.isHoldingTotem: Boolean get() = EnumHand.values().any { player.getHeldItem(it).item == Items.TOTEM_OF_UNDYING } - private fun getExcuse(): String { + private fun getOrdered(): String { + currentLine %= loadedExcuses.size + return loadedExcuses[currentLine++] + } + private fun getRandom(): String { val prevLine = currentLine // Avoids sending the same message while (loadedExcuses.size != 1 && currentLine == prevLine) { From c876fd67079fd9277a2c6d58733d9eb5c06da6b0 Mon Sep 17 00:00:00 2001 From: Snowshoe <20788786+SnowshoeIceboot@users.noreply.github.com> Date: Sun, 30 Oct 2022 07:54:43 -0700 Subject: [PATCH 4/6] Remove unused import --- .../kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt index 0683bbb23..fca33dc64 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt @@ -6,7 +6,6 @@ import com.lambda.client.event.SafeClientEvent import com.lambda.client.event.events.PacketEvent import com.lambda.client.module.Category import com.lambda.client.module.Module -import com.lambda.client.module.modules.chat.Spammer.setting import com.lambda.client.util.FolderUtils import com.lambda.client.util.TickTimer import com.lambda.client.util.TimeUnit From 8d1c75aaa6e5de298d56721aee5b645d7ccd5ca9 Mon Sep 17 00:00:00 2001 From: Constructor Date: Sun, 8 Jan 2023 20:33:57 +0100 Subject: [PATCH 5/6] Brought back default excuses :) --- .../client/module/modules/chat/AutoExcuse.kt | 79 +++++++++++++++---- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt index fca33dc64..6a940a5f0 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt @@ -1,6 +1,5 @@ package com.lambda.client.module.modules.chat -import com.lambda.client.LambdaMod import com.lambda.client.commons.extension.synchronized import com.lambda.client.event.SafeClientEvent import com.lambda.client.event.events.PacketEvent @@ -28,6 +27,7 @@ object AutoExcuse : Module( modulePriority = 500 ) { private val modeSetting by setting("Order", Mode.RANDOM_ORDER) + private val modeSource by setting("Source", SourceMode.INTERNAL) private val file = File(FolderUtils.lambdaFolder + "excuses.txt") private val loadedExcuses = ArrayList().synchronized() @@ -39,32 +39,80 @@ object AutoExcuse : Module( IN_ORDER, RANDOM_ORDER } + private enum class SourceMode { + INTERNAL, EXTERNAL + } + + private const val CLIENT_NAME = "%CLIENT%" + + private val defaultExcuses = arrayOf( + "Sorry, im using $CLIENT_NAME", + "My ping is so bad", + "I was changing my config :(", + "Why did my AutoTotem break", + "I was desynced", + "Stupid hackers killed me", + "Wow, so many try hards", + "Lagggg", + "I wasn't trying", + "I'm not using $CLIENT_NAME", + "Thers to much lag", + "My dog ate my pc", + "Sorry, $CLIENT_NAME is really bad", + "I was lagging", + "He was cheating!", + "Your hacking!", + "Lol imagine actully trying", + "I didn't move my mouse", + "I was playing on easy mode(;", + "My wifi went down", + "I'm playing vanila", + "My optifine didn't work", + "The CPU cheated!", + "I am using a cracked client", + "My brother was playing." + ) + + private val clients = arrayOf( + "Future Client", + "Salhack", + "Pyro", + "Impact" + ) + init { safeListener { if (loadedExcuses.isEmpty() || it.packet !is SPacketUpdateHealth) return@safeListener if (it.packet.health <= 0.0f && !isHoldingTotem && timer.tick(3L)) { val message = if (modeSetting == Mode.IN_ORDER) getOrdered() else getRandom() - sendServerMessage(message) + sendServerMessage(message.replace("%CLIENT%", clients.random())) } } onEnable { loadedExcuses.clear() + currentLine = 0 + + when (modeSource) { + SourceMode.INTERNAL -> loadedExcuses.addAll(defaultExcuses) + SourceMode.EXTERNAL -> { + defaultScope.launch(Dispatchers.IO) { + if (!file.exists()) { + file.createNewFile() + MessageSendHelper.sendErrorMessage("$chatName Excuses file is empty!" + + ", please add them in the &7excuses.txt&f under the &7.minecraft/lambda&f directory.") + disable() + return@launch + } - defaultScope.launch(Dispatchers.IO) { - if (file.exists()) { - try { - file.forEachLine { if (it.isNotBlank()) loadedExcuses.add(it.trim()) } - MessageSendHelper.sendChatMessage("$chatName Loaded excuse messages!") - } catch (e: Exception) { - MessageSendHelper.sendErrorMessage("$chatName Failed loading excuses, $e") - disable() + try { + file.forEachLine { if (it.isNotBlank()) loadedExcuses.add(it.trim()) } + MessageSendHelper.sendChatMessage("$chatName Loaded excuse messages!") + } catch (e: Exception) { + MessageSendHelper.sendErrorMessage("$chatName Failed loading excuses, $e") + disable() + } } - } else { - file.createNewFile() - MessageSendHelper.sendErrorMessage("$chatName Excuses file is empty!" + - ", please add them in the &7excuses.txt&f under the &7.minecraft/lambda&f directory.") - disable() } } } @@ -77,6 +125,7 @@ object AutoExcuse : Module( currentLine %= loadedExcuses.size return loadedExcuses[currentLine++] } + private fun getRandom(): String { val prevLine = currentLine // Avoids sending the same message From a79acb3c044c0c4aeadcbd2155f15a9b415a67d7 Mon Sep 17 00:00:00 2001 From: Constructor Date: Sun, 8 Jan 2023 21:18:06 +0100 Subject: [PATCH 6/6] More excuses --- .../lambda/client/module/modules/chat/AutoExcuse.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt index 6a940a5f0..0501eb9df 100644 --- a/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt +++ b/src/main/kotlin/com/lambda/client/module/modules/chat/AutoExcuse.kt @@ -1,5 +1,6 @@ package com.lambda.client.module.modules.chat +import com.lambda.client.LambdaMod import com.lambda.client.commons.extension.synchronized import com.lambda.client.event.SafeClientEvent import com.lambda.client.event.events.PacketEvent @@ -70,7 +71,14 @@ object AutoExcuse : Module( "My optifine didn't work", "The CPU cheated!", "I am using a cracked client", - "My brother was playing." + "My brother was playing.", + "Phobos hacked my pc!!", + "I didn't have enough totems", + "I died for you <3", + "I was trying the popbob exploit!!", + "Sorry, let me relog with ${LambdaMod.NAME}", + "I was alt tabbing", + "I was trying out a new mod", ) private val clients = arrayOf(