AutoLeave module

AutoLeave: Minecraft 26.3 cheat module, full source for every implementation (2 clients: MelaHack (ThunderHack fork), LiquidBounce (Kotlin)).

2 implementationsMISCCOMBAT

Full module source: 2 implementations

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

MelaHack (ThunderHack fork)MISCsrc/main/java/thunder/hack/features/modules/misc/AutoLeave.javaJava · 147 lines · 6.8 KB

Disconnects from the server under specified conditions.

SettingsAntiHelperLeaveAntiKTLeaveAutoDisableInstantLeaveCommandLeave ifLowHpTotemsTotemsCountHPStaffPlayersDistanceLeaveOnBindLeaveBindMessageOnLeave
AutoLeave.javaJava · Minecraft 26.2 · 147 lines · 6.8 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.misc;
2
3
import org.lwjgl.glfw.GLFW;
4
import thunder.hack.core.Managers;
5
import thunder.hack.core.manager.client.ModuleManager;
6
import thunder.hack.features.modules.Module;
7
import thunder.hack.setting.Setting;
8
import thunder.hack.setting.impl.Bind;
9
import thunder.hack.setting.impl.SettingGroup;
10
import thunder.hack.utility.Timer;
11
import thunder.hack.utility.player.InventoryUtility;
12
13
import static thunder.hack.features.modules.client.ClientSettings.isRu;
14
15
import net.minecraft.ChatFormatting;
16
import net.minecraft.network.chat.Component;
17
import net.minecraft.network.protocol.game.ServerboundSetCarriedItemPacket;
18
import net.minecraft.world.entity.player.Player;
19
import net.minecraft.world.item.Items;
20
21
public class AutoLeave extends Module {
22
    public AutoLeave() {
23
        super("AutoLeave", Category.MISC);
24
    }
25
26
    private final Setting<Boolean> antiHelperLeave = new Setting<>("AntiHelperLeave", true);
27
    private final Setting<Boolean> antiKTLeave = new Setting<>("AntiKTLeave", true);
28
    private final Setting<Boolean> autoDisable = new Setting<>("AutoDisable", true);
29
    private final Setting<Boolean> fastLeave = new Setting<>("InstantLeave", true);
30
    public static Setting<String> command = new Setting<>("Command", "hub");
31
    private final Setting<SettingGroup> leaveIf = new Setting<>("Leave if", new SettingGroup(false, 0));
32
    private final Setting<Boolean> low_hp = new Setting<>("LowHp", false).addToGroup(leaveIf);
33
    private final Setting<Boolean> totems = new Setting<>("Totems", false).addToGroup(leaveIf);
34
    private final Setting<Integer> totemsCount = new Setting<>("TotemsCount", 2, 0, 10, v -> totems.getValue());
35
    private final Setting<Float> leaveHp = new Setting<>("HP", 8.0f, 1f, 20.0f, v -> low_hp.getValue());
36
    private final Setting<LeaveMode> staff = new Setting<>("Staff", LeaveMode.None).addToGroup(leaveIf);
37
    private final Setting<LeaveMode> players = new Setting<>("Players", LeaveMode.Leave).addToGroup(leaveIf);
38
    private final Setting<Integer> distance = new Setting<>("Distance", 256, 4, 256, v -> players.getValue() != LeaveMode.None).addToGroup(leaveIf);
39
    public final Setting<Boolean> leaveOnBind = new Setting<>("LeaveOnBind", false, v -> true).addToGroup(leaveIf);
40
    public final Setting<Bind> leaveBind = new Setting<>("LeaveBind", new Bind(GLFW.GLFW_KEY_N, false, false), v -> leaveOnBind.is(true)).addToGroup(leaveIf);
41
    public final Setting<String> leaveChat = new Setting<>("MessageOnLeave", "", v -> true);
42
43
    private final Timer chatDelay = new Timer();
44
45
    // Будет хуева если мы ливнем в кт
46
    private final Timer hurtTimer = new Timer();
47
48
    @Override
49
    public void onUpdate() {
50
        if (mc.player == null || mc.level == null)
51
            return;
52
53
        if (mc.player.hurtTime > 0)
54
            hurtTimer.reset();
55
56
        if (antiKTLeave.getValue() && !hurtTimer.passedMs(30000))
57
            return;
58
59
        for (Player pl : mc.level.players()) {
60
            if (pl.getTeam() != null && antiHelperLeave.getValue()) {
61
                String prefix = pl.getTeam().getPlayerPrefix().getString();
62
                if (isStaff(ChatFormatting.stripFormatting(prefix)))
63
                    continue;
64
            }
65
66
67
            if (pl != mc.player && !Managers.FRIEND.isFriend(pl) && players.getValue() != LeaveMode.None && mc.player.distanceToSqr(pl.position()) <= distance.getPow2Value()) {
68
                switch (players.getValue()) {
69
                    case Command -> {
70
                        if (autoDisable.getValue()) disable();
71
                        sendMessage(isRu() ? "Ливнул т.к. рядом появился игрок!" : "Logged out because there was a player!");
72
                        mc.player.connection.sendCommand(command.getValue());
73
                        return;
74
                    }
75
                    case Leave -> {
76
                        leave(isRu() ? "Ливнул т.к. рядом появился игрок" : "Logged out because there was a player");
77
                        return;
78
                    }
79
                }
80
            }
81
        }
82
83
        if (totems.getValue() && InventoryUtility.getItemCount(Items.TOTEM_OF_UNDYING) <= totemsCount.getValue())
84
            leave(isRu() ? "Ливнул т.к. кончились тотемы" : "Logged out because out of totems");
85
86
        if (mc.player.getHealth() < leaveHp.getValue() && low_hp.getValue())
87
            leave(isRu() ? "Ливнул т.к. мало хп" : "Logged out because ur hp is low");
88
89
        if (staff.getValue() != LeaveMode.None && ModuleManager.staffBoard.isDisabled() && mc.player.tickCount % 5 == 0)
90
            sendMessage(isRu() ? "Включи StaffBoard!" : "Turn on StaffBoard!");
91
92
        if (isKeyPressed(leaveBind) && leaveOnBind.getValue())
93
            leave(isRu() ? "Ливнул т.к. прожат бинд" : "Logged out because bind is pressed");
94
    }
95
96
    private void leave(String message) {
97
98
        if (!chatDelay.passedMs(1000))
99
            return;
100
        chatDelay.reset();
101
102
        if (autoDisable.getValue())
103
            disable(message);
104
105
        if (leaveChat.getValue() != null || leaveChat.getValue() != "") {
106
            if (leaveChat.getValue().contains("/")) {
107
                mc.getConnection().sendCommand(leaveChat.getValue());
108
            } else {
109
                mc.getConnection().sendChat(leaveChat.getValue());
110
            }
111
        }
112
113
        if (fastLeave.getValue()) sendPacket(new ServerboundSetCarriedItemPacket(228));
114
        else mc.player.connection.getConnection().disconnect(Component.nullToEmpty("[AutoLeave] " + message));
115
    }
116
117
    /*public void onStaff() { todo
118
        if (!chatDelay.passedMs(1000))
119
            return;
120
        chatDelay.reset();
121
122
        if (hurtTimer.passedMs(30000) || !antiKTLeave.getValue()) {
123
            switch (staff.getValue()) {
124
                case Command -> {
125
                    sendMessage(isRu() ? "Ливнул т.к. хелпер в спеке!" : "Logged out because helper in vanish!");
126
                    mc.player.networkHandler.sendChatCommand(command.getValue());
127
                    if (autoDisable.getValue())
128
                        disable();
129
                }
130
                case Leave -> leave(isRu() ? "Ливнул т.к. хелпер в спеке!" : "Logged out because helper in vanish!");
131
            }
132
        }
133
    }*/
134
135
    public static boolean isStaff(String name) {
136
        if (name == null) return false;
137
138
        name = name.toLowerCase();
139
140
        return name.contains("helper") || name.contains("moder") || name.contains("admin") || name.contains("owner") || name.contains("curator") || name.contains("куратор") || name.contains("модер") || name.contains("админ") || name.contains("хелпер") || name.contains("поддержка");
141
    }
142
143
    private enum LeaveMode {
144
        None, Command, Leave
145
    }
146
}
147
LiquidBounce (Kotlin)COMBATsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/ModuleAutoLeave.ktKotlin · 67 lines · 2.4 KB

Automatically leaves the server whenever your health goes below the certain threshold.

SettingsHealthDelayMode
ModuleAutoLeave.ktKotlin · Minecraft 26.2 · 67 lines · 2.4 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.combat
20
21
import net.ccbluex.liquidbounce.event.tickConditional
22
import net.ccbluex.liquidbounce.event.tickHandler
23
import net.ccbluex.liquidbounce.features.module.ClientModule
24
import net.ccbluex.liquidbounce.features.module.ModuleCategories
25
import net.ccbluex.liquidbounce.features.module.modules.exploit.ModuleKick
26
import net.minecraft.core.component.DataComponents
27
28
/**
29
 * AutoLeave module
30
 *
31
 * Automatically makes you leave the server whenever your health is low.
32
 */
33
object ModuleAutoLeave : ClientModule("AutoLeave", ModuleCategories.COMBAT) {
34
35
    private val health by float("Health", 8f, 0f..20f, "HP")
36
    /**
37
     * When conditions are met, we will start counting up until we reach our threshold. If conditions are not met,
38
     * we reset the counter and start from the beginning.
39
     */
40
    private val delay by intRange("Delay", 0..0, 0..60, "ticks")
41
    private val mode by enumChoice("Mode", ModuleKick.KickModeEnum.QUIT)
42
43
    @Suppress("unused")
44
    private val tickHandler = tickHandler {
45
        val passed = tickConditional(delay.random()) {
46
            if (player.abilities.instabuild || mc.hasSingleplayerServer()) {
47
                return@tickConditional true
48
            }
49
50
            // Player can heal himself
51
            if (player.mainHandItem.has(DataComponents.DEATH_PROTECTION)
52
                || player.offhandItem.has(DataComponents.DEATH_PROTECTION)
53
            ) {
54
                return@tickConditional true
55
            }
56
57
            player.health >= health
58
        }
59
60
        if (passed) {
61
            ModuleKick.kick(mode)
62
            enabled = false
63
        }
64
    }
65
66
}
67