ChatUtils module

ChatUtils: Minecraft 26.3 cheat module, full source for every implementation (1 client: MelaHack (ThunderHack fork)).

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.

MelaHack (ThunderHack fork)MISCsrc/main/java/thunder/hack/features/modules/misc/ChatUtils.javaJava · 311 lines · 12.4 KB

Chat modifications.

SettingsWelcomerPrefixTotemsTimeMentionPMSoundZOVwAvYTranslitAntiCoordLeak
ChatUtils.javaJava · Minecraft 26.2 · 311 lines · 12.4 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.misc;
2
3
import meteordevelopment.orbit.EventHandler;
4
import net.minecraft.ChatFormatting;
5
import net.minecraft.client.multiplayer.PlayerInfo;
6
import net.minecraft.network.chat.Component;
7
import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket;
8
import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket;
9
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket;
10
import net.minecraft.network.protocol.game.ServerboundChatPacket;
11
import net.minecraft.sounds.SoundEvents;
12
import net.minecraft.sounds.SoundSource;
13
import net.minecraft.world.item.Items;
14
import org.jetbrains.annotations.NotNull;
15
import thunder.hack.core.Managers;
16
import thunder.hack.events.impl.PacketEvent;
17
import thunder.hack.events.impl.TotemPopEvent;
18
import thunder.hack.features.modules.Module;
19
import thunder.hack.injection.accesors.IGameMessageS2CPacket;
20
import thunder.hack.gui.notification.Notification;
21
import thunder.hack.setting.Setting;
22
import thunder.hack.utility.Timer;
23
24
import java.text.SimpleDateFormat;
25
import java.util.*;
26
27
import static thunder.hack.features.modules.client.ClientSettings.isRu;
28
29
public class ChatUtils extends Module {
30
    private final Setting<Welcomer> welcomer = new Setting<>("Welcomer", Welcomer.Off);
31
    private final Setting<Prefix> prefix = new Setting<>("Prefix", Prefix.None);
32
    private final Setting<Boolean> totems = new Setting<>("Totems", false);
33
    private final Setting<Boolean> time = new Setting<>("Time", false);
34
    private final Setting<Boolean> mention = new Setting<>("Mention", false);
35
    private final Setting<PMSound> pmSound = new Setting<>("PMSound", PMSound.Default);
36
    private final Setting<Boolean> zov = new Setting<>("ZOV", false);
37
    private final Setting<Boolean> wavy = new Setting<>("wAvY", false);
38
    private final Setting<Boolean> translit = new Setting<>("Translit", false);
39
    private final Setting<Boolean> antiCoordLeak = new Setting<>("AntiCoordLeak", false);
40
41
    private final Timer timer = new Timer();
42
    private final Timer antiSpam = new Timer();
43
    private final Timer messageTimer = new Timer();
44
    private final LinkedHashMap<UUID, String> nameMap = new LinkedHashMap<>();
45
    private String skip;
46
47
    Map<String, String> ruToEng = Map.ofEntries(
48
            Map.entry("а", "a"),
49
            Map.entry("б", "6"),
50
            Map.entry("в", "B"),
51
            Map.entry("г", "r"),
52
            Map.entry("д", "d"),
53
            Map.entry("е", "e"),
54
            Map.entry("ё", "e"),
55
            Map.entry("ж", ">I<"),
56
            Map.entry("з", "3"),
57
            Map.entry("и", "u"),
58
            Map.entry("й", "u"),
59
            Map.entry("к", "k"),
60
            Map.entry("л", "JI"),
61
            Map.entry("м", "m"),
62
            Map.entry("н", "H"),
63
            Map.entry("о", "o"),
64
            Map.entry("п", "n"),
65
            Map.entry("р", "p"),
66
            Map.entry("с", "c"),
67
            Map.entry("т", "T"),
68
            Map.entry("у", "y"),
69
            Map.entry("ф", "f"),
70
            Map.entry("х", "x"),
71
            Map.entry("ц", "lI"),
72
            Map.entry("ч", "4"),
73
            Map.entry("ш", "w"),
74
            Map.entry("щ", "w"),
75
            Map.entry("ь", "b"),
76
            Map.entry("ы", "bI"),
77
            Map.entry("ъ", "b"),
78
            Map.entry("э", "-)"),
79
            Map.entry("ю", "I-O"),
80
            Map.entry("я", "9I")
81
    );
82
83
    private final String[] bb = new String[]{
84
            "See you later, ",
85
            "Catch ya later, ",
86
            "See you next time, ",
87
            "Farewell, ",
88
            "Bye, ",
89
            "Good bye, ",
90
            "Later, "
91
    };
92
93
    private final String[] qq = new String[]{
94
            "Good to see you, ",
95
            "Greetings, ",
96
            "Hello, ",
97
            "Howdy, ",
98
            "Hey, ",
99
            "Good evening, ",
100
            "Welcome to SERVERIP1D5A9E, "
101
    };
102
103
    private final String[] popMessages = new String[]{
104
            " EZZZ POP <pop> TIMES PIECE OF SHIT GET GOOD",
105
            " ez pop <pop> times fuckin unbrain",
106
            " pop <pop> times get good kiddo ",
107
            " EZZZZZZZ pop <pop> times GO LEARN PVP PUSSY",
108
            " piece of shit popped <pop> times so ez",
109
            " easiest pop <pop> times in my life",
110
            " HAHAHAHA BRO POPPED <pop> TIMES SO EZ LMAO",
111
            " POP <pop> TIMES OMG MAN UR SO BAD LMAO",
112
            " my grandma has more skill than you nigga pop <pop> times",
113
            " trash pop <pop> times retard ",
114
            " ezz no skill dog pop <pop> times",
115
            " lame dude tryes to pvp with me but dyes) hahah pop <pop> times",
116
            " get better tbh bruh pop <pop> times",
117
            " pop <pop> times ur eyes don't work right? ",
118
            " cringelord popped <pop> times so ez "
119
    };
120
121
122
    public ChatUtils() {
123
        super("ChatUtils", Category.MISC);
124
    }
125
126
    @Override
127
    public void onDisable() {
128
        nameMap.clear();
129
    }
130
131
    @Override
132
    public void onUpdate() {
133
        if (timer.passedMs(15000)) {
134
            for (PlayerInfo b : mc.player.connection.getOnlinePlayers()) {
135
                if (!nameMap.containsKey(b.getProfile().id())) {
136
                    nameMap.put(b.getProfile().id(), b.getProfile().name());
137
                }
138
            }
139
            timer.reset();
140
        }
141
    }
142
143
    @EventHandler
144
    public void onPacketReceive(PacketEvent.Receive event) {
145
        if (welcomer.getValue() != Welcomer.Off && antiSpam.passedMs(3000)) {
146
            if (event.getPacket() instanceof ClientboundPlayerInfoUpdatePacket pck) {
147
                int n2 = (int) Math.floor(Math.random() * qq.length);
148
                String string1;
149
                if (mc.player.connection.getServerData() != null) {
150
                    string1 = qq[n2].replace("SERVERIP1D5A9E", mc.player.connection.getServerData().ip);
151
                } else string1 = "server";
152
                if (pck.actions().contains(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER)) {
153
                    for (ClientboundPlayerInfoUpdatePacket.Entry ple : pck.newEntries()) {
154
                        if (antiBot(ple.profile().name())) return;
155
                        if (Objects.equals(ple.profile().name(), mc.player.getName().getString())) return;
156
                        if (welcomer.getValue() == Welcomer.Server) {
157
                            mc.player.connection.sendChat(getPrefix() + string1 + ple.profile().name());
158
                            antiSpam.reset();
159
                        } else sendMessage(string1 + ple.profile().name());
160
                        nameMap.put(ple.profile().id(), ple.profile().name());
161
                    }
162
                }
163
            }
164
165
            if (event.getPacket() instanceof ClientboundPlayerInfoRemovePacket pac) {
166
                for (UUID uuid2 : pac.profileIds) {
167
                    if (!nameMap.containsKey(uuid2)) return;
168
                    if (antiBot(nameMap.get(uuid2))) return;
169
                    if (Objects.equals(nameMap.get(uuid2), mc.player.getName().getString())) return;
170
                    int n = (int) Math.floor(Math.random() * bb.length);
171
                    if (welcomer.getValue() == Welcomer.Server) {
172
                        mc.player.connection.sendChat(getPrefix() + bb[n] + nameMap.get(uuid2));
173
                        antiSpam.reset();
174
                    } else sendMessage(bb[n] + nameMap.get(uuid2));
175
                    nameMap.remove(uuid2);
176
                }
177
            }
178
        }
179
        if (event.getPacket() instanceof ClientboundSystemChatPacket pac) {
180
            if (time.getValue()) {
181
                IGameMessageS2CPacket pac2 = event.getPacket();
182
                pac2.setContent(Component.nullToEmpty("[" + ChatFormatting.GRAY + new SimpleDateFormat("HH:mm:ss").format(Calendar.getInstance().getTime()) + ChatFormatting.RESET + "] ").copy().append(pac.content));
183
            }
184
185
            if (mention.getValue()) {
186
                if (pac.content.getString().contains(mc.player.getName().getString()) && messageTimer.passedMs(1000)) {
187
                    Managers.NOTIFICATION.publicity("ChatUtils", isRu() ? "Тебя помянули в чате!" : "You were mentioned in the chat!", 4, Notification.Type.WARNING);
188
                    mc.level.playSound(mc.player, mc.player.blockPosition(), SoundEvents.PLAYER_LEVELUP, SoundSource.BLOCKS, 5f, 1f);
189
                }
190
            }
191
192
            String content = pac.content.getString().toLowerCase();
193
            if (!pmSound.is(PMSound.Off) && (content.contains("whisper") || content.contains("-> я") || content.contains("-> " + NameProtect.getCustomName()) || content.contains("-> me") || content.contains(" says:"))) {
194
                Managers.SOUND.playPmSound(pmSound.getValue());
195
            }
196
        }
197
    }
198
199
    @EventHandler
200
    public void onTotem(TotemPopEvent e) {
201
        if (totems.getValue() && antiSpam.passedMs(3000) && e.getEntity() != mc.player) {
202
            int n = (int) Math.floor(Math.random() * popMessages.length);
203
            String s = popMessages[n].replace("<pop>", e.getPops() + "");
204
            mc.player.connection.sendChat(getPrefix() + e.getEntity().getName().getString() + s);
205
            antiSpam.reset();
206
        }
207
    }
208
209
    private @NotNull String getPrefix() {
210
        return switch (prefix.getValue()) {
211
            case Green -> ">";
212
            case Global -> "!";
213
            case None -> "";
214
        };
215
    }
216
217
    public boolean antiBot(@NotNull String s) {
218
        if (s.contains("soon_") || s.contains("_npc") || s.contains("CIT-")) {
219
            return true;
220
        }
221
        for (int i = 0; i < s.length(); i++) {
222
            if (Character.UnicodeBlock.of(s.charAt(i)).equals(Character.UnicodeBlock.CYRILLIC)) {
223
                return true;
224
            }
225
        }
226
        return false;
227
    }
228
229
    @EventHandler
230
    public void onPacketSend(PacketEvent.@NotNull Send e) {
231
        if (e.getPacket() instanceof ServerboundChatPacket pac) {
232
            if (antiCoordLeak.getValue() && pac.message.replaceAll("\\D", "").length() >= 6) {
233
                sendMessage("[ChatUtils] " + (isRu() ? "В сообщении содержатся координаты!" : "The message contains coordinates!"));
234
                e.cancel();
235
            }
236
237
            messageTimer.reset();
238
        }
239
240
        if (fullNullCheck()) return;
241
        if (e.getPacket() instanceof ServerboundChatPacket pac && (zov.getValue() || wavy.getValue() || translit.getValue())) {
242
243
            if (Objects.equals(pac.message(), skip)) {
244
                return;
245
            }
246
247
            if (mc.player.getMainHandItem().getItem() == Items.FILLED_MAP || mc.player.getOffhandItem().getItem() == Items.FILLED_MAP)
248
                return;
249
250
            if (pac.message().startsWith("/") || pac.message().startsWith(Managers.COMMAND.getPrefix()))
251
                return;
252
253
            String message = pac.message();
254
            if (zov.getValue()) {
255
                StringBuilder builder = new StringBuilder();
256
                for (char Z : message.toCharArray()) {
257
                    if ('З' == Z || 'з' == Z) {
258
                        builder.append("Z");
259
                    } else if ('В' == Z || 'в' == Z) {
260
                        builder.append("V");
261
                    } else {
262
                        builder.append(Z);
263
                    }
264
                }
265
                message = builder.toString();
266
            }
267
            if (wavy.getValue()) {
268
                StringBuilder builder = new StringBuilder();
269
                boolean up = false;
270
                for (char C : message.toCharArray()) {
271
                    if (up) {
272
                        builder.append(Character.toUpperCase(C));
273
                    } else {
274
                        builder.append(Character.toLowerCase(C));
275
                    }
276
                    up = Character.isLetter(C) != up;
277
                }
278
                message = builder.toString();
279
            }
280
            if (translit.getValue())
281
                message = transliterate(message);
282
            skip = message;
283
            mc.player.connection.sendChat(skip);
284
            e.cancel();
285
        }
286
    }
287
288
    public String transliterate(String text) {
289
        StringBuilder result = new StringBuilder();
290
291
        for (char ch : text.toCharArray()) {
292
            String str = ruToEng.get(ch + "");
293
            result.append(str != null ? str : ch);
294
        }
295
296
        return result.toString();
297
    }
298
299
    private enum Welcomer {
300
        Off, Server, Client
301
    }
302
303
    private enum Prefix {
304
        Green, Global, None
305
    }
306
307
    public enum PMSound {
308
        Off, Default, Custom
309
    }
310
}
311