Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -103,6 +104,31 @@ public class AntiAFK extends Module {
.build()
);

private final Setting<Boolean> 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<Integer> 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<Boolean> 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

Expand Down Expand Up @@ -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;

Expand All @@ -163,6 +190,7 @@ public void onActivate() {

lastYaw = mc.player.getYRot();
messageTimer = delay.get() * 20;
hotbarTimer = switchDelay.get() * 20;
}

@Override
Expand Down Expand Up @@ -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());
Expand Down
Loading