From dad440ac18ac2c70e6e9496dc149fe8c394056e5 Mon Sep 17 00:00:00 2001 From: Eccys <73040912+Eccys@users.noreply.github.com> Date: Sat, 22 Aug 2026 19:47:27 +0000 Subject: [PATCH] feat(AntiAFK): add hotbar switcher and randomizer --- .../systems/modules/player/AntiAFK.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiAFK.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiAFK.java index d5fbc94826b..6f88fd390ff 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiAFK.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiAFK.java @@ -11,6 +11,7 @@ import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.ChatUtils; +import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.meteorclient.utils.player.Rotations; import meteordevelopment.orbit.EventHandler; @@ -103,6 +104,31 @@ public class AntiAFK extends Module { .build() ); + private final Setting switchHotbar = sgActions.add(new BoolSetting.Builder() + .name("switch-hotbar") + .description("Randomly switches active hotbar slots to avoid AFK detection.") + .defaultValue(false) + .build() + ); + + private final Setting switchDelay = sgActions.add(new IntSetting.Builder() + .name("switch-delay") + .description("The delay between hotbar switches in seconds.") + .defaultValue(5) + .min(1) + .sliderMax(30) + .visible(switchHotbar::get) + .build() + ); + + private final Setting randomHotbarSlot = sgActions.add(new BoolSetting.Builder() + .name("random-slot") + .description("Switches to a completely random slot instead of sequential.") + .defaultValue(true) + .visible(switchHotbar::get) + .build() + ); + // Messages @@ -151,6 +177,7 @@ public AntiAFK() { private int messageI = 0; private int sneakTimer = 0; private int strafeTimer = 0; + private int hotbarTimer = 0; private boolean direction = false; private float lastYaw; @@ -163,6 +190,7 @@ public void onActivate() { lastYaw = mc.player.getYRot(); messageTimer = delay.get() * 20; + hotbarTimer = switchDelay.get() * 20; } @Override @@ -213,6 +241,23 @@ private void onTick(TickEvent.Pre event) { } } + // Switch Hotbar + if (switchHotbar.get() && hotbarTimer-- <= 0) { + int currentSlot = mc.player.getInventory().getSelectedSlot(); + int nextSlot; + + if (randomHotbarSlot.get()) { + do { + nextSlot = random.nextInt(9); + } while (nextSlot == currentSlot); + } else { + nextSlot = (currentSlot + 1) % 9; + } + + InvUtils.swap(nextSlot, false); + hotbarTimer = switchDelay.get() * 20; + } + // Messages if (sendMessages.get() && !messages.get().isEmpty() && messageTimer-- <= 0) { if (randomMessage.get()) messageI = random.nextInt(messages.get().size());