Memeware 7.3 InvMove module 1 files, 41 lines

Memeware 7.3 InvMove: Full Source Analysis

Memeware's InvMove keeps the movement keys live while a GUI screen is open.

me/memewaredevs/client/module/movement/InvMove.java · GitHub source ↗

Published 2026-08-12 · Updated 2026-08-12

Packets This Module Uses

Analysis

Overview

Memeware's InvMove keeps the movement keys live while a GUI screen is open. On every UpdateEvent, and only when the current screen is not GuiChat, the module writes the raw keyboard state straight into the pressed flags of the forward, right, left, back and jump keybindings. MovementInputFromOptions reads those flags, so the player entity keeps producing forward, strafe and jump input while an inventory or other container screen has focus, and the C03 position stream keeps advancing under an open window.

Input-path bypass

The module never touches packet code. It writes KeyBinding.pressed from Keyboard.isKeyDown(keyCode) for the five movement bindings, bypassing the GUI input path entirely. The GuiChat exclusion means typing in chat does not walk the player, and the handler runs on the pre update event, so the re-asserted flags are in place before MovementInputFromOptions.updatePlayerMoveState() reads them the same tick. The player controller then behaves as if no screen were open.

Wire fingerprint

EntityPlayerSP.func_175161_p fires the pre UpdateEvent and sends one C03 variant per tick based on position and look deltas. With the module, position deltas stay nonzero while the inventory is open, so the server receives position-changing C06 packets (and the sprint-state C0B changes that accompany them) for a player whose server-side container is still open. Vanilla clients freeze in place under a screen, which is exactly the gap the module exploits and the fingerprint the inventory-move checks key on.

Server-side view

The server tracks the open window from the player's window interactions, so a position change with a live container is a contradiction it can validate. CheaterDeleter flags position-changing moves while a screen handler is open, Photon flags any movement past the breaking-time leniency and any jump, Negativity scores distance and sprint and sneak deltas from Bukkit events, and Hawk flags rotation, sprint or sneak while an inventory is open. All four are C03-corpus checks.

source InvMove.java

InvMove.java41 lines · JavaOriginal ↗
1
/*
2
 * Decompiled with CFR 0.145.
3
 *
4
 * Could not load the following classes:
5
 *  org.lwjgl.input.Keyboard
6
 */
7
package me.memewaredevs.client.module.movement;
8
9
import me.hippo.api.lwjeb.annotation.Handler;
10
import me.memewaredevs.client.event.events.UpdateEvent;
11
import me.memewaredevs.client.module.Module;
12
import net.minecraft.client.gui.GuiChat;
13
import net.minecraft.client.settings.KeyBinding;
14
import org.lwjgl.input.Keyboard;
15
16
import java.util.function.Consumer;
17
18
public class InvMove extends Module {
19
    public InvMove() {
20
        super("InvMove", 0, Module.Category.MOVEMENT);
21
    }
22
23
    @Handler
24
    public Consumer<UpdateEvent> eventConsumer0 = (event) -> {
25
        if (this.mc.currentScreen instanceof GuiChat) {
26
            return;
27
        }
28
        KeyBinding keyBindings[] = new KeyBinding[] {
29
                mc.gameSettings.keyBindForward,
30
                mc.gameSettings.keyBindRight,
31
                mc.gameSettings.keyBindLeft,
32
                mc.gameSettings.keyBindBack,
33
                mc.gameSettings.keyBindJump
34
        };
35
36
        for (KeyBinding keyBinding : keyBindings) {
37
            keyBinding.pressed = Keyboard.isKeyDown(keyBinding.getKeyCode());
38
        }
39
40
    };
41
}

What this file does

The module is self-contained: one handler consumer, one GuiChat guard, and a loop over the five movement keybindings. For each binding it assigns keyBinding.pressed = Keyboard.isKeyDown(keyBinding.getKeyCode()), which is exactly the state the vanilla input classes read (MovementInputFromOptions calls getIsKeyPressed()). Because the write happens on the pre update event, the forced state survives until the next event, and because the raw keyboard poll bypasses the screen, no GUI focus check can clear it.

The jump binding is included, so the module also permits jumping while an inventory is open, which Photon's inventory-move check treats as a separate and heavier violation. The GuiChat guard is the only behavioral carve-out, and it exists so chat text entry does not drive the player.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat InventoryMoveCheck (position change under a screen handler)

InventoryMoveCheck.java106 lines · Java
1
package io.github.coolmineman.cheaterdeleter.modules.movement;
2
3
import io.github.coolmineman.cheaterdeleter.events.PlayerMovementListener;
4
import io.github.coolmineman.cheaterdeleter.events.PacketCallback;
5
import io.github.coolmineman.cheaterdeleter.events.PlayerDamageListener;
6
import io.github.coolmineman.cheaterdeleter.modules.CDModule;
7
import io.github.coolmineman.cheaterdeleter.objects.PlayerMoveC2SPacketView;
8
import io.github.coolmineman.cheaterdeleter.objects.entity.CDPlayer;
9
import io.github.coolmineman.cheaterdeleter.util.BlockCollisionUtil;
10
import net.minecraft.entity.damage.DamageSource;
11
import net.minecraft.network.Packet;
12
import net.minecraft.network.listener.ServerPlayPacketListener;
13
import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket;
14
import net.minecraft.util.ActionResult;
15
16
public class InventoryMoveCheck extends CDModule
17
        implements PlayerMovementListener, PacketCallback, PlayerDamageListener {
18
    public InventoryMoveCheck() {
19
        super("inventorymove_check");
20
        PlayerMovementListener.EVENT.register(this);
21
        PacketCallback.EVENT.register(this);
22
        PlayerDamageListener.EVENT.register(this);
23
    }
24
25
    @Override
26
    public long getFlagCoolDownMs() {
27
        return 100;
28
    }
29
30
    @Override
31
    public void onMovement(CDPlayer player, PlayerMoveC2SPacketView packet, MoveCause cause) {
32
        if (
33
            !enabledFor(player) ||
34
            player.isFallFlying() ||
35
            player.isSpectator() ||
36
            BlockCollisionUtil.isNearby(player, 2, 4, BlockCollisionUtil.NON_SOLID_COLLISION)
37
        ) {
38
            return;
39
        }
40
        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);
41
        if (packet.isChangePosition() && player.getCurrentScreenHandler() != null) {
42
            if (!data.wasOpen) {
43
                data.wasOpen = true;
44
                data.openTime = System.currentTimeMillis();
45
            }
46
            if (invalidateMove(player, packet)) {
47
                flag(player, FlagSeverity.MINOR, "Inventory Move");
48
            }
49
        } else if (player.getCurrentScreenHandler() == null) {
50
            data.lastDeltaX = Double.MAX_VALUE;
51
            data.lastDeltaZ = Double.MAX_VALUE;
52
            data.wasOpen = false;
53
        }
54
    }
55
56
    private boolean invalidateMove(CDPlayer player, PlayerMoveC2SPacketView packet) {
57
        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);
58
        if (System.currentTimeMillis() - data.openTime < 500)
59
            return false;
60
        if (player.getVelocity().getY() < 0.0 && packet.getY() > player.getPacketY())
61
            return true;
62
        double delaX = Math.abs(packet.getX() - player.getPacketX());
63
        double delaZ = Math.abs(packet.getZ() - player.getPacketZ());
64
        if (player.getVelocity().getX() == 0.0 && delaX > 0.0 && delaX > data.lastDeltaX)
65
            return true;
66
        if (player.getVelocity().getX() != 0.0) {
67
            data.lastDeltaX = Double.MAX_VALUE;
68
        } else {
69
            data.lastDeltaX = delaX;
70
        }
71
        if (player.getVelocity().getZ() == 0.0 && delaZ > 0.0 && delaZ > data.lastDeltaZ)
72
            return true;
73
        if (player.getVelocity().getZ() != 0.0) {
74
            data.lastDeltaZ = Double.MAX_VALUE;
75
        } else {
76
            data.lastDeltaZ = delaZ;
77
        }
78
        return false;
79
    }
80
81
    public static class InventoryMoveCheckData {
82
        volatile double lastDeltaX = Double.MAX_VALUE;
83
        volatile double lastDeltaZ = Double.MAX_VALUE;
84
        volatile boolean wasOpen = false;
85
        volatile long openTime = 0;
86
    }
87
88
    @Override
89
    public ActionResult onPacket(CDPlayer player, Packet<ServerPlayPacketListener> packet) {
90
        if (packet instanceof CloseHandledScreenC2SPacket) {
91
            InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class,
92
                    InventoryMoveCheckData::new);
93
            data.wasOpen = false;
94
        }
95
        return ActionResult.PASS;
96
    }
97
98
    @Override
99
    public void onPlayerDamage(CDPlayer player, DamageSource source, float amount) {
100
        InventoryMoveCheckData data = player.getOrCreateData(InventoryMoveCheckData.class, InventoryMoveCheckData::new);
101
        data.lastDeltaX = Double.MAX_VALUE;
102
        data.lastDeltaZ = Double.MAX_VALUE;
103
        data.openTime = System.currentTimeMillis() + 1000;
104
    }
105
    
106
}

How it counteracts this module

CheaterDeleter's check runs on every serverbound move through PlayerMovementListener.onMovement and keys on the exact module signature: packet.isChangePosition() while player.getCurrentScreenHandler() != null (lines 41-48). After a 500ms grace from the moment the screen opened (lines 58-59), invalidateMove flags when a horizontal delta grows while the server-side velocity on that axis is zero (lines 62-77), i.e. an accelerating walk with no applied velocity, which is precisely what forced keybind input produces. The flag is MINOR severity with a 100ms cooldown, and the data resets on window close and on damage (onPlayerDamage extends the grace by 1000ms, lines 99-104).

The module's sustained WASD movement past the grace period drives deltas that grow against zero server velocity, so the check flags on steady use. The bypass surface is real: movement that rides server-applied velocity (knockback, a moving platform) or movement confined to the first 500ms after opening does not trip it, and the check skips players near non-solid collision and in spectator. A careful module user who drifts instead of accelerates can stay under the delta-growth heuristic.

anticheat InventoryMove (movement and jump under an open inventory)

InventoryMove.java190 lines · Java
1
package de.photon.anticheataddition.modules.checks.inventory;
2
3
import de.photon.anticheataddition.AntiCheatAddition;
4
import de.photon.anticheataddition.modules.ViolationModule;
5
import de.photon.anticheataddition.user.User;
6
import de.photon.anticheataddition.user.data.TimeKey;
7
import de.photon.anticheataddition.util.datastructure.SetUtil;
8
import de.photon.anticheataddition.util.log.Log;
9
import de.photon.anticheataddition.util.mathematics.TimeUtil;
10
import de.photon.anticheataddition.util.minecraft.ping.PingProvider;
11
import de.photon.anticheataddition.util.minecraft.world.WorldUtil;
12
import de.photon.anticheataddition.util.minecraft.world.entity.EntityUtil;
13
import de.photon.anticheataddition.util.minecraft.world.entity.InternalPotion;
14
import de.photon.anticheataddition.util.minecraft.world.material.MaterialUtil;
15
import de.photon.anticheataddition.util.violationlevels.Flag;
16
import de.photon.anticheataddition.util.violationlevels.ViolationLevelManagement;
17
import de.photon.anticheataddition.util.violationlevels.ViolationManagement;
18
import org.bukkit.Bukkit;
19
import org.bukkit.Location;
20
import org.bukkit.Material;
21
import org.bukkit.block.Block;
22
import org.bukkit.block.BlockFace;
23
import org.bukkit.event.EventHandler;
24
import org.bukkit.event.EventPriority;
25
import org.bukkit.event.Listener;
26
import org.bukkit.event.player.PlayerMoveEvent;
27
import org.bukkit.event.player.PlayerTeleportEvent;
28
import org.bukkit.potion.PotionEffect;
29
30
import java.util.Set;
31
import java.util.stream.Stream;
32
33
public final class InventoryMove extends ViolationModule implements Listener
34
{
35
    // 300 is the vanilla breaking time without a speed effect (derived from testing, especially slab jumping)
36
    public static final long BASE_BREAKING_TIME = 300L;
37
38
39
    // The materials below a player that allow a player to jump while having an open inventory.
40
    private static final Set<Material> JUMP_ENABLING_MATERIALS = Stream.of(MaterialUtil.INSTANCE.getAutoStepMaterials(),
41
                                                                           MaterialUtil.INSTANCE.getBounceMaterials())
42
                                                                       .flatMap(Set::stream)
43
                                                                       .collect(SetUtil.toImmutableEnumSet());
44
45
    public static final InventoryMove INSTANCE = new InventoryMove();
46
    public static final double STANDING_STILL_THRESHOLD = 0.005;
47
    private final int cancelVl = loadInt(".cancel_vl", 60);
48
    private final boolean extremePingLeniency = loadBoolean(".extreme_ping_leniency", false);
49
50
    private InventoryMove()
51
    {
52
        super("Inventory.parts.Move");
53
    }
54
55
    private static void cancelAction(User user, PlayerMoveEvent event)
56
    {
57
        // Not many blocks moved to prevent exploits and world change problems.
58
        if (WorldUtil.INSTANCE.inSameWorld(event.getFrom(), event.getTo()) && event.getFrom().distanceSquared(event.getTo()) < 4) {
59
            // Teleport back the next tick.
60
            Bukkit.getScheduler().runTask(AntiCheatAddition.getInstance(), () -> user.getPlayer().teleport(event.getFrom(), PlayerTeleportEvent.TeleportCause.UNKNOWN));
61
        }
62
    }
63
64
    private static long breakingTime(User user)
65
    {
66
        return BASE_BREAKING_TIME + InternalPotion.SPEED.getPotionEffect(user.getPlayer())
67
                                                        .map(PotionEffect::getAmplifier)
68
                                                        // If a speed effect exists calculate the speed millis, otherwise the speedMillis are 0.
69
                                                        .map(amplifier -> TimeUtil.toMillis(Math.max(100, amplifier + 1)))
70
                                                        .orElse(0L);
71
    }
72
73
    @EventHandler(priority = EventPriority.LOWEST)
74
    public void onPlayerMove(PlayerMoveEvent event)
75
    {
76
        final var user = User.getUser(event.getPlayer());
77
        if (User.isUserInvalid(user, this) || event.getTo() == null ||
78
            // Check that the player has actually moved.
79
            // Do this here to prevent bypasses with setting allowedToJump to true
80
            event.getTo().distanceSquared(event.getFrom()) <= STANDING_STILL_THRESHOLD) return;
81
82
        // Not inside a vehicle
83
        if (user.getPlayer().isInsideVehicle() ||
84
            // Not flying (vanilla or elytra) as it may trigger some fps
85
            user.getPlayer().isFlying() ||
86
            EntityUtil.INSTANCE.isFlyingWithElytra(user.getPlayer()) ||
87
            // Player must not be in an inventory
88
            !user.hasOpenInventory() ||
89
            // After being hit a player moves due to knock-back, so recent hits can cause false positives.
90
            user.getPlayer().getNoDamageTicks() != 0 ||
91
            // Recent teleports can cause bugs
92
            Inventory.teleportOrWorldChangeBypassed(user) ||
93
            // The player is currently not in a liquid (liquids push)
94
            // This would need to check for async chunk loads if done in packets (see history)
95
            user.isInLiquids() ||
96
            // Auto-Disable if TPS are too low
97
            !Inventory.hasMinTPS()) {
98
            user.getData().bool.allowedToJump = true;
99
            return;
100
        }
101
102
        final boolean movingUpwards = event.getFrom().getY() < event.getTo().getY();
103
        final boolean noYMovement = event.getFrom().getY() == event.getTo().getY();
104
105
        // Player accelerated upwards.
106
        if (movingUpwards && !user.getData().bool.movingUpwards) {
107
            handleJump(user, event);
108
            return;
109
        }
110
111
        final double yMovement = event.getPlayer().getVelocity().getY();
112
113
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " checking for falling: " + user.getTimeMap().at(TimeKey.VELOCITY_CHANGE_NO_EXTERNAL_CAUSES).passedTime() + " | y-velocity: " + yMovement);
114
115
        // This bypasses players during a long fall from hundreds of blocks.
116
        if (yMovement < -2.0 ||
117
            // Bypass a falling player after a normal jump in which they opened an inventory.
118
            // If the y-movement is 0, the falling process is finished and there is no need for bypassing anymore.
119
            (user.hasJumpedRecently(1850) && !noYMovement)) {
120
            user.getTimeMap().at(TimeKey.INVENTORY_MOVE_JUMP_END).update();
121
            return;
122
        }
123
124
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " is not fall-bypassed with y-movement: " + yMovement);
125
126
        final long leniency = extremePingLeniency ? Math.min(PingProvider.INSTANCE.getPing(user.getPlayer()) / 2, 500) : 0;
127
        final long totalBreakingTime = breakingTime(user) + leniency;
128
129
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " breaking time: " + totalBreakingTime + " (leniency: " + leniency + ")" +
130
                        " | inventory open passed time: " + user.getTimeMap().at(TimeKey.INVENTORY_OPENED).passedTime() +
131
                        " | jump end passed time: " + user.getTimeMap().at(TimeKey.INVENTORY_MOVE_JUMP_END).passedTime());
132
133
        // The breaking is no longer affecting the user as they have opened their inventory long enough ago.
134
        if (user.notRecentlyOpenedInventory(totalBreakingTime) &&
135
            // If the player jumped, we need to check the breaking time after the jump ended.
136
            user.getTimeMap().at(TimeKey.INVENTORY_MOVE_JUMP_END).notRecentlyUpdated(totalBreakingTime) &&
137
            // Do the entity pushing stuff here (performance impact)
138
            // No nearby entities that could push the player
139
            WorldUtil.INSTANCE.getLivingEntitiesAroundEntity(user.getPlayer(), user.getHitboxLocation().hitbox(), 0.1D).isEmpty()) {
140
            getManagement().flag(Flag.of(user)
141
                                     .setAddedVl(5)
142
                                     .setCancelAction(cancelVl, () -> cancelAction(user, event))
143
                                     .setDebug(() -> "Inventory-Debug | Player: " + user.getPlayer().getName() + " moved while having an open inventory."));
144
        }
145
    }
146
147
    private void handleJump(User user, PlayerMoveEvent event)
148
    {
149
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " detected a jump.");
150
151
        // A player is only allowed to jump once.
152
        if (user.getData().bool.allowedToJump) {
153
            user.getData().bool.allowedToJump = false;
154
            return;
155
        }
156
157
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " is not jump-bypassed.");
158
159
        // Bouncing can lead to false positives.
160
        if (playerCanJumpDueToGroundMaterial(event.getFrom())) return;
161
162
        Log.finer(() -> "Inventory-Debug | Player " + user.getPlayer().getName() + " no jump enabling materials detected.");
163
164
        getManagement().flag(Flag.of(user)
165
                                 .setAddedVl(25)
166
                                 .setCancelAction(cancelVl, () -> cancelAction(user, event))
167
                                 .setDebug(() -> "Inventory-Debug | Player: " + user.getPlayer().getName() + " jumped while having an open inventory."));
168
    }
169
170
    /**
171
     * This checks all 9 blocks centered on where the player stands as well as the 9 blocks below to reliably check for materials like slabs.
172
     * Checking all those blocks is required because stepping up a slab does not mean the player's block-location is already the slab.
173
     */
174
    private static boolean playerCanJumpDueToGroundMaterial(Location location)
175
    {
176
        return Stream.concat(WorldUtil.INSTANCE.getBlocksAround(location.getBlock(), WorldUtil.HORIZONTAL_FACES, Set.of()).stream(),
177
                             WorldUtil.INSTANCE.getBlocksAround(location.getBlock().getRelative(BlockFace.DOWN), WorldUtil.HORIZONTAL_FACES, Set.of()).stream())
178
                     .map(Block::getType)
179
                     .anyMatch(InventoryMove.JUMP_ENABLING_MATERIALS::contains);
180
    }
181
182
    @Override
183
    protected ViolationManagement createViolationManagement()
184
    {
185
        return ViolationLevelManagement.builder(this)
186
                                       .emptyThresholdManagement()
187
                                       .withDecay(100, 2).build();
188
    }
189
}

How it counteracts this module

Photon's InventoryMove listens on PlayerMoveEvent and skips everything that is not real movement: a squared distance at or below 0.005, vehicles, flight, no open inventory, damage invulnerability ticks, liquids, recent teleports or world changes, and low TPS (lines 77-100). The leniency is breakingTime (300ms base plus the speed-potion adjustment, lines 64-71) plus an optional ping leniency; a player still moving after that window with no jump-end grace and no pushing entities flags at 5 VL (lines 134-144). A jump while the inventory is open routes to handleJump at 25 VL, with one allowed jump per open and slab and bounce materials exempted (lines 147-180). The cancel action at 60 VL teleports the player back to the move origin (lines 55-62).

The module's sustained movement and its forced jump binding map directly onto both paths: walking past the 300ms breaking window flags repeatedly, and the jump keybind triggers the 25 VL jump branch unless the player stands on slab or bounce material. The one soft spot is the window itself: movement confined to the first 300ms after opening the inventory (or riding out a jump) is tolerated, which is how a module could preserve brief inventory movement, but the sustained walk the module is built for cannot hide inside it.

anticheat InventoryMoveProtocol (Bukkit-event distance scoring)

InventoryMoveProtocol.java136 lines · Java
1
package com.elikill58.negativity.spigot.protocols;
2
3
import org.bukkit.Material;
4
import org.bukkit.entity.Player;
5
import org.bukkit.event.EventHandler;
6
import org.bukkit.event.Listener;
7
import org.bukkit.event.inventory.InventoryClickEvent;
8
import org.bukkit.event.inventory.InventoryCloseEvent;
9
import org.bukkit.event.inventory.InventoryOpenEvent;
10
import org.bukkit.event.inventory.InventoryType.SlotType;
11
import org.bukkit.event.player.PlayerMoveEvent;
12
13
import com.elikill58.negativity.spigot.SpigotNegativity;
14
import com.elikill58.negativity.spigot.SpigotNegativityPlayer;
15
import com.elikill58.negativity.spigot.blocks.SpigotLocation;
16
import com.elikill58.negativity.spigot.utils.LocationUtils;
17
import com.elikill58.negativity.universal.Cheat;
18
import com.elikill58.negativity.universal.CheatKeys;
19
import com.elikill58.negativity.universal.ReportType;
20
import com.elikill58.negativity.universal.adapter.Adapter;
21
import com.elikill58.negativity.universal.utils.UniversalUtils;
22
23
public class InventoryMoveProtocol extends Cheat implements Listener {
24
25
	public InventoryMoveProtocol() {
26
		super(CheatKeys.INVENTORY_MOVE, false, Material.NETHER_STAR, CheatCategory.MOVEMENT, true, "invmove");
27
	}
28
29
	@EventHandler
30
	public void onMove(PlayerMoveEvent e) {
31
		Player p = e.getPlayer();
32
		SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer(p);
33
		if (!np.hasDetectionActive(this) || np.isUsingTrident() || np.hasElytra() || p.isInsideVehicle() || p.getFallDistance() > 0.5 || np.inventoryMoveData == null
34
				|| LocationUtils.isInWater(new SpigotLocation(p.getLocation())) || p.getVelocity().length() > 0.1 || !np.inventoryMoveData.active || LocationUtils.hasMaterialsAround(new SpigotLocation(e.getFrom()), "PISTON")) {
35
			Adapter.getAdapter().debug("Velocity length: " + p.getVelocity().length());
36
			return;
37
		}
38
		if (p.getOpenInventory() == null) {
39
			np.inventoryMoveData = null;
40
			Adapter.getAdapter().debug("No opened inventory but data always running ?");
41
			return;
42
		}
43
		InventoryMoveData data = np.inventoryMoveData;
44
		int amount = 0;
45
		if (p.isSprinting())
46
			amount += data.sprint ? 1 : 5; // means it started sprinting since inv open
47
		if (p.isSneaking())
48
			amount += data.sneak ? 1 : 5; // means it started sneaking since inv open
49
50
		double distance = e.getFrom().distance(e.getTo());
51
		double distanceXZ = LocationUtils.distanceXZ(e.getFrom(), e.getTo());
52
		if (distanceXZ >= data.distanceXZ && distanceXZ >= p.getWalkSpeed()) // if running at least at the same
53
			amount += (data.distanceXZ - distanceXZ) + 1; // +1 to always have alert
54
55
		if (distance >= data.distance && distance >= p.getWalkSpeed() && p.getFallDistance() < 0.5) // fall "allow" to make the distance goes brr
56
			amount += (data.distanceXZ - distanceXZ) + 1 - p.getFallDistance();
57
		if (data.timeSinceOpen > 2)
58
			Adapter.getAdapter().debug("Time: " + data.timeSinceOpen + ", amount: " + amount);
59
		if (data.timeSinceOpen >= 3 && amount > 2) {
60
			SpigotNegativity.alertMod(ReportType.WARNING, p, this, UniversalUtils.parseInPorcent(80 + data.timeSinceOpen),
61
					"Sprint: " + p.isSprinting() + ", Sneak: " + p.isSneaking() + ", data: " + data + ", vel: " + p.getVelocity() + ", fd: " + String.format("%.5f", p.getFallDistance()),
62
					(CheatHover) null, amount);
63
		}
64
		data.update(distance, distanceXZ);
65
	}
66
67
	@EventHandler
68
	public void onClick(InventoryClickEvent e) {
69
		if (!(e.getWhoClicked() instanceof Player) || e.getClickedInventory() == null || !e.getSlotType().equals(SlotType.CONTAINER) || e.isCancelled())
70
			return;
71
		SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer((Player) e.getWhoClicked());
72
		if (!np.hasDetectionActive(this))
73
			return;
74
		checkInvMove(np, (Player) e.getWhoClicked(), "Click");
75
	}
76
77
	@EventHandler
78
	public void onOpen(InventoryOpenEvent e) {
79
		if (!(e.getPlayer() instanceof Player) || e.isCancelled())
80
			return;
81
		SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer((Player) e.getPlayer());
82
		if (!np.hasDetectionActive(this))
83
			return;
84
		checkInvMove(np, (Player) e.getPlayer(), "Open");
85
	}
86
87
	@EventHandler
88
	public void onClose(InventoryCloseEvent e) {
89
		if (e.getPlayer() instanceof Player)
90
			SpigotNegativityPlayer.getNegativityPlayer((Player) e.getPlayer()).inventoryMoveData.reset((Player) e.getPlayer());
91
	}
92
93
	private void checkInvMove(SpigotNegativityPlayer np, Player p, String from) {
94
		if (np.hasElytra() || p.isInsideVehicle() || p.getLocation().getBlock().getType().name().contains("WATER"))
95
			return;
96
		np.inventoryMoveData.active = true;
97
	}
98
99
	@Override
100
	public boolean isBlockedInFight() {
101
		return true;
102
	}
103
104
	public static class InventoryMoveData {
105
106
		public Player p;
107
		public double distance = 0, distanceXZ = 0;
108
		public int timeSinceOpen = 0;
109
		public boolean sprint, sneak, active;
110
111
		public InventoryMoveData() {
112
			reset(null);
113
		}
114
115
		public void update(double distance, double distanceXZ) {
116
			this.distance = distance;
117
			this.distanceXZ = distanceXZ;
118
			this.timeSinceOpen++;
119
		}
120
121
		public void reset(Player p) {
122
			this.sprint = p == null ? false : p.isSprinting();
123
			this.sneak = p == null ? false : p.isSneaking();
124
			this.active = false;
125
			this.distance = 0;
126
			this.distanceXZ = 0;
127
			this.timeSinceOpen = 0;
128
		}
129
130
		@Override
131
		public String toString() {
132
			return "InventoryMoveData{sprint=" + sprint + ",sneak=" + sneak + ",distance=" + String.format("%.3f", distance) + ",distanceXZ=" + String.format("%.3f", distance) + ",time="
133
					+ timeSinceOpen + "}";
134
		}
135
	}
136
}

How it counteracts this module

Negativity's protocol is event-based: onMove requires an open inventory (p.getOpenInventory() != null), no elytra, trident, vehicle, water or nearby pistons, fall distance under 0.5 and server velocity at or below 0.1 (lines 33-34), then scores a transition to sprint or sneak as 5 points, and movement distance at or above the previous move's distance and at or above walk speed as a positive delta (lines 44-56). It flags once timeSinceOpen reaches 3 ticks and the score exceeds 2 (lines 57-63), and isBlockedInFight pauses the whole protocol during combat (lines 99-102).

The module produces exactly the scored inputs: sustained movement at walk speed keeps distance at or above the previous move, and holding W re-enables sprinting, which the transition check counts as 5. A flag fires from the third tick of an open inventory. The exclusions matter: water, pistons, vehicles, fall damage over 0.5 and knockback velocity all silence the protocol, and combat pauses it, so the module is cleanest to detect on flat dry ground away from fights.

anticheat InventoryMove (rotation or sprint or sneak while open)

InventoryMove.java52 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.movement;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.MovementCheck;
23
import me.islandscout.hawk.event.MoveEvent;
24
25
/*
26
 * InventoryActions check originally written by Havesta; modified, split apart, and implemented into Hawk by Islandscout
27
 *
28
 * InventoryMove checks if a player is
29
 * - rotating, sprinting, or sneaking while inventory is opened
30
 */
31
32
public class InventoryMove extends MovementCheck {
33
34
    public InventoryMove() {
35
        super("inventorymove", true, 3, 5, 0.999, 5000, "%player% failed inventory-move, VL: %vl%", null);
36
    }
37
38
    @Override
39
    protected void check(MoveEvent e) {
40
        HawkPlayer pp = e.getHawkPlayer();
41
42
        //TODO: false flag: rotation is still possible at least 1 tick after opening inventory
43
        //TODO: false flag: you gotta do that TP grace period thing for this too
44
        //TODO: false flag: ESCing out of F6 twitch options while inv is open will cause a desync. Forcibly close inventory on flag to fix desyncs like this?
45
        if((e.isUpdateRot() || pp.isSprinting() || pp.isSneaking()) && pp.hasInventoryOpen() != 0 && !e.isTeleportAccept()) {
46
            punishAndTryRubberband(pp, e);
47
        }
48
        else {
49
            reward(pp);
50
        }
51
    }
52
}

How it counteracts this module

Hawk's check is the broadest of the set: it flags any MoveEvent where the player is updating rotation, sprinting or sneaking while hasInventoryOpen() is nonzero and the move is not a teleport accept (line 45), with a violation threshold of 3, a 0.999 decay and a 5 second timeout, punishing with a rubberband. Because vanilla sends look updates as part of every C03, any movement while the inventory is open carries an isUpdateRot flag and trips the check immediately.

The module cannot avoid the look component: func_175161_p sends C05 or C06 variants whenever yaw or pitch changed, and the module's forced movement changes the player's facing as it turns. The check's own TODO comments concede a one-tick false positive window after opening an inventory and the lack of a teleport grace, so a module that moved only within the first tick could slip one move through, but sustained inventory movement flags on the second move and rubberbands. The rotation clause also means a derp-style head spin combined with an open inventory is caught by the same path.

← Back to Analysis Hub