AutoAccount module

AutoAccount: Minecraft 26.3 cheat module, full source for every implementation (1 client: LiquidBounce (Kotlin)).

1 implementationMISC

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

LiquidBounce (Kotlin)MISCsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/misc/ModuleAutoAccount.ktKotlin · 129 lines · 4.3 KB

Automatically authenticates you on cracked servers.

SettingsPasswordDelayRegisterCommandLoginCommandRegisterRegexLoginRegexRepeatPasswordOnRegisterMessageSource
ModuleAutoAccount.ktKotlin · Minecraft 26.2 · 129 lines · 4.3 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.misc
20
21
import net.ccbluex.liquidbounce.config.types.list.Tagged
22
import net.ccbluex.liquidbounce.event.Event
23
import net.ccbluex.liquidbounce.event.events.ChatReceiveEvent
24
import net.ccbluex.liquidbounce.event.events.TitleEvent
25
import net.ccbluex.liquidbounce.event.sequenceHandler
26
import net.ccbluex.liquidbounce.event.tickUntil
27
import net.ccbluex.liquidbounce.event.waitTicks
28
import net.ccbluex.liquidbounce.features.command.commands.module.CommandAutoAccount
29
import net.ccbluex.liquidbounce.features.misc.SelfDestruct
30
import net.ccbluex.liquidbounce.features.module.ClientModule
31
import net.ccbluex.liquidbounce.features.module.ModuleCategories
32
import net.ccbluex.liquidbounce.utils.client.chat
33
34
35
/**
36
 * Auto account module
37
 *
38
 * Automatically handles logins or registrations on servers when requested.
39
 *
40
 * Command: [CommandAutoAccount]
41
 */
42
object ModuleAutoAccount : ClientModule(
43
    "AutoAccount",
44
    ModuleCategories.MISC,
45
    aliases = listOf("AutoLogin", "AutoRegister")
46
) {
47
48
    private val password by text("Password", "a1b2c3d4")
49
        .doNotIncludeAlways()
50
    private val delay by intRange("Delay", 3..5, 0..50, "ticks")
51
52
    private val registerCommand by text("RegisterCommand", "register")
53
    private val loginCommand by text("LoginCommand", "login")
54
55
    private val registerRegex by regex("RegisterRegex", Regex("/register"))
56
57
    private val loginRegex by regex("LoginRegex", Regex("/login"))
58
59
    private val repeatPasswordOnRegister by boolean("RepeatPasswordOnRegister", true)
60
61
    private val messageSources by multiEnumChoice("MessageSource", MessageSource.entries, canBeNone = false)
62
63
    private enum class MessageSource(override val tag: String) : Tagged {
64
        CHAT("Chat"),
65
        TITLE("Title"),
66
        SUBTITLE("Subtitle"),
67
    }
68
69
    // We can receive chat messages before the world is initialized,
70
    // so we have to handle events even before that
71
    override val running
72
        get() = !SelfDestruct.isDestructed && enabled
73
74
    private var sending = false
75
76
    override fun onDisabled() {
77
        sending = false
78
    }
79
80
    private suspend inline fun action(operation: () -> Unit) {
81
        sending = true
82
        tickUntil { mc.connection != null }
83
        waitTicks(delay.random())
84
        operation()
85
        sending = false
86
    }
87
88
    fun login() {
89
        chat("login")
90
        network.sendCommand("$loginCommand $password")
91
    }
92
93
    fun register() {
94
        chat("register")
95
        network.sendCommand(
96
            if (repeatPasswordOnRegister) "$registerCommand $password $password" else "$registerCommand $password",
97
        )
98
    }
99
100
    private inline fun <reified T : Event> createMessageHandler(
101
        messageSource: MessageSource,
102
        crossinline textProvider: (T) -> String?,
103
    ) {
104
        sequenceHandler<T> { event ->
105
            if (sending || messageSource !in messageSources) {
106
                return@sequenceHandler
107
            }
108
109
            val msg = textProvider(event) ?: return@sequenceHandler
110
111
            when {
112
                registerRegex.containsMatchIn(msg) -> {
113
                    action(::register)
114
                }
115
                loginRegex.containsMatchIn(msg) -> {
116
                    action(::login)
117
                }
118
            }
119
        }
120
    }
121
122
    init {
123
        createMessageHandler<ChatReceiveEvent>(MessageSource.CHAT) { it.message }
124
        createMessageHandler<TitleEvent.Title>(MessageSource.TITLE) { it.text?.tryCollapseToString() }
125
        createMessageHandler<TitleEvent.Subtitle>(MessageSource.SUBTITLE) { it.text?.tryCollapseToString() }
126
    }
127
128
}
129