Skip to content

Commit

Permalink
LEGACY: Added AutoDisable Module (CCBlueX#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
EclipsesDev authored Feb 9, 2024
1 parent 98743a0 commit ace50e0
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object CommandManager {
fun registerCommands() {
commands.clear()

registerCommand(AutoDisableCommand)
registerCommand(BindCommand)
registerCommand(VClipCommand)
registerCommand(HClipCommand)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.command.commands

import net.ccbluex.liquidbounce.features.command.Command
import net.ccbluex.liquidbounce.features.module.ModuleManager
import net.ccbluex.liquidbounce.features.module.modules.misc.AutoDisable

object AutoDisableCommand : Command("autodisable") {

/**
* Execute commands with provided [args]
*/
override fun execute(args: Array<String>) {
if (args.size < 2) {
chatSyntax("autodisable <add/remove/list>")
return
}

when (args[1].lowercase()) {
"add" -> {
if (args.size < 3) {
chatSyntax("autodisable add <module>")
return
}

val moduleName = args[2]
val module = ModuleManager.getModule(moduleName)

if (module != null) {
if (AutoDisable.getModules().contains(module)) {
chat("§cModule §b$moduleName §cis already in the auto-disable list.")
} else {
AutoDisable.addModule(module)
chat("§b$moduleName §ahas been added to the auto-disable list.")
}
} else {
chat("§cModule §b$moduleName §cnot found.")
}
}
"remove" -> {
if (args.size < 3) {
chatSyntax("autodisable remove <module>")
return
}

val moduleName = args[2]
val module = ModuleManager.getModule(moduleName)

if (module != null) {
if (AutoDisable.getModules().contains(module)) {
AutoDisable.removeModule(module)
chat("§b$moduleName §6has been removed from the auto-disable list.")
} else {
chat("§cModule §b$moduleName §cis not in the auto-disable list.")
}
} else {
chat("§cModule §b$moduleName §cnot found.")
}
}
"list" -> {
val modules = AutoDisable.getModules()
chat("Modules in the auto-disable list:")
modules.forEach { chat(it.name) }
}
else -> chatSyntax("autodisable <add/remove/list>")
}
}

override fun tabComplete(args: Array<String>): List<String> {
if (args.isEmpty()) {
return emptyList()
}

return when (args.size) {
1 -> listOf("add", "remove", "list").filter { it.startsWith(args[0], true) }
2 -> {
when (args[0].lowercase()) {
"add" -> {
val input = args[1].lowercase()
ModuleManager.modules.filter { it.name.lowercase().startsWith(input) }.map { it.name }
}
"remove" -> {
val input = args[1].lowercase()
AutoDisable.getModules().filter { it.name.lowercase().startsWith(input) }.map { it.name }
}
else -> emptyList()
}
}
else -> emptyList()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ object ModuleManager : Listenable {
AutoBow,
AutoBreak,
AutoClicker,
AutoDisable,
AutoFish,
AutoProjectile,
AutoPlay,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.misc

import net.ccbluex.liquidbounce.LiquidBounce.hud
import net.ccbluex.liquidbounce.event.EventTarget
import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.event.UpdateEvent
import net.ccbluex.liquidbounce.event.WorldEvent
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.modules.combat.KillAura
import net.ccbluex.liquidbounce.features.module.modules.combat.Velocity
import net.ccbluex.liquidbounce.features.module.modules.movement.Fly
import net.ccbluex.liquidbounce.features.module.modules.movement.Speed
import net.ccbluex.liquidbounce.features.module.modules.world.Scaffold
import net.ccbluex.liquidbounce.script.api.global.Chat
import net.ccbluex.liquidbounce.ui.client.hud.element.elements.Notification
import net.ccbluex.liquidbounce.value.BoolValue
import net.ccbluex.liquidbounce.value.ListValue
import net.minecraft.network.play.server.S08PacketPlayerPosLook

object AutoDisable : Module("AutoDisable", ModuleCategory.MISC, gameDetecting = false) {
val modulesList = arrayListOf(KillAura, Velocity, Scaffold, Fly, Speed)

private val onFlagged by BoolValue("onFlag", true)
private val onWorldChange by BoolValue("onWorldChange", false)
private val onDeath by BoolValue("onDeath", false)

private val warn by ListValue("Warn", arrayOf("Chat", "Notification"), "Chat")

@EventTarget
fun onPacket(event: PacketEvent) {
val packet = event.packet

if (packet is S08PacketPlayerPosLook && onFlagged) {
disabled("flagged")
}
}

@EventTarget
fun onUpdate(event: UpdateEvent) {
val player = mc.thePlayer ?: return

if (onDeath && player.isDead) {
disabled("deaths")
}
}

@EventTarget
fun onWorld(event: WorldEvent) {
if (mc.thePlayer == null) {
return
}

if (onWorldChange) {
disabled("world changed")
}
}

private fun disabled(reason: String) {
val anyModuleEnabled = modulesList.any { it.state }

if (anyModuleEnabled) {
modulesList.forEach { module ->
if (module.state) {
module.state = false
module.onDisable()
}
}

if (warn == "Chat") {
Chat.print("§eModules have been disabled due to §c$reason")
} else {
hud.addNotification(Notification("Modules have been disabled due to $reason", 2000F))
}
}
}

fun addModule(module: Module) {
if (!modulesList.contains(module)) {
modulesList.add(module)
}
}

fun removeModule(module: Module) {
modulesList.remove(module)
}

fun getModules(): List<Module> {
return modulesList.toList()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

"module.autoClicker.description": "Constantly clicks when holding down a mouse button.",

"module.autoDisable.description": "Automatically disables selected module based on specified events.",

"module.autoLeave.description": "Automatically makes you leave the server whenever your health is low.",

"module.autoPot.description": "Automatically throws healing potions.",
Expand Down

0 comments on commit ace50e0

Please sign in to comment.