Sigma 4.11 InventoryWalk module 1 files, 131 lines

Sigma 4.11 InventoryWalk: Full Source Analysis

Sigma's InventoryWalk keeps the player moving while any GUI is open by re-asserting the five movement KeyBindings from the raw keyboard state every tick, so the vanilla movement code runs and the C03 stream continues through the window.

info/sigmaclient/module/impl/player/InventoryWalk.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Packets This Module Uses

Analysis

Overview

Sigma's InventoryWalk keeps the player moving while any GUI is open by re-asserting the five movement KeyBindings from the raw keyboard state every tick, so the vanilla movement code runs and the C03 stream continues through the window. Arrow keys rotate the view in addition (pitch 1, yaw 3 per key tick). The three modes differ in how they treat the open-window state: Basic just walks, AACP suppresses sprint while the window is open (one STOP_SPRINTING on open, START_SPRINTING on close, and every START_SPRINTING cancelled in between), and Cubecraft cancels the C0B OPEN_INVENTORY and C16 OPEN_INVENTORY_ACHIEVEMENT packets so the server never opens the vanilla inventory window at all. A separate CARRY toggle cancels outgoing C0D close-window packets, keeping the server-side window alive after the client GUI closes.

Key re-assertion

EventTick runs while mc.currentScreen is non-null and calls KeyBinding.setKeyBindState for forward, back, left, right and jump using Keyboard.isKeyDown, which makes the vanilla EntityPlayerSP movement code believe the keys are pressed even though the GUI owns the input. The arrow-key block mutates rotationPitch and rotationYaw directly (1 degree pitch, 3 degrees yaw per event) unless the open screen is Sigma's own GuiInvManager, and the mutated angles ride the next C03 look packet. The module bails entirely when the screen is a GuiChat, so chat typing never walks the player.

Mode-specific packet games

The inInventory flag tracks whether the module has seen the window open transition. On the first tick with a screen open, AACP sends one C0BPacketEntityAction STOP_SPRINTING; while inInventory it cancels every outgoing START_SPRINTING, so the server-side sprint flag never turns back on during the walk; on close it sends START_SPRINTING to restore the state it found. The Cubecraft mode cancels C0B OPEN_INVENTORY and C16 OPEN_INVENTORY_ACHIEVEMENT, which removes the client's announcement of the vanilla inventory open, so the server-side window bookkeeping never registers the screen the client is actually showing. The CARRY toggle cancels every outgoing C0D close-window packet, which is the classic carry exploit: the client closes the GUI, the server believes the window is still open, and items held in the cursor or crafting slots survive the close.

Detection surface

The wire signature is a normal C03 stream that simply continues while a window is open, plus mode-specific extras: the AACP C0B sprint toggle at each GUI boundary, the Cubecraft C0B/C16 cancellations, and the CARRY C0D cancellations. The open-state checks (NCP Open, Hawk InventoryMove) target the Basic behavior directly, the toggle-rate checks (NCP ToggleFrequency, Hawk ActionToggleSpeed) see the AACP C0B games, and the arrow-key look produces rotation updates while the window flag is set, which is precisely what Hawk InventoryMove flags.

source InventoryWalk.java

InventoryWalk.java131 lines · JavaOriginal ↗
1
package info.sigmaclient.module.impl.player;
2
3
import info.sigmaclient.event.impl.EventPacket;
4
import info.sigmaclient.event.impl.EventTick;
5
import info.sigmaclient.event.impl.EventUpdate;
6
import info.sigmaclient.module.data.Options;
7
import info.sigmaclient.module.data.Setting;
8
import net.minecraft.network.Packet;
9
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
10
import net.minecraft.network.play.client.C0BPacketEntityAction;
11
import net.minecraft.network.play.client.C16PacketClientStatus;
12
import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition;
13
import net.minecraft.network.play.client.C0BPacketEntityAction.Action;
14
import net.minecraft.network.play.client.C0DPacketCloseWindow;
15
import net.minecraft.network.play.client.C16PacketClientStatus.EnumState;
16
import net.minecraft.util.BlockPos;
17
18
import org.lwjgl.input.Keyboard;
19
20
import info.sigmaclient.event.Event;
21
import info.sigmaclient.event.RegisterEvent;
22
import info.sigmaclient.gui.screen.GuiInvManager;
23
import info.sigmaclient.module.Module;
24
import info.sigmaclient.module.data.ModuleData;
25
import info.sigmaclient.util.misc.ChatUtil;
26
import net.minecraft.block.Block;
27
import net.minecraft.block.BlockContainer;
28
import net.minecraft.client.gui.GuiChat;
29
import net.minecraft.client.gui.inventory.GuiChest;
30
import net.minecraft.client.gui.inventory.GuiContainer;
31
import net.minecraft.client.gui.inventory.GuiInventory;
32
import net.minecraft.client.settings.KeyBinding;
33
34
public class InventoryWalk extends Module {
35
36
    private String CARRY = "CARRY";
37
    public final static String MODE = "MODE";
38
    boolean inInventory = false;
39
    public InventoryWalk(ModuleData data) {
40
        super(data);
41
        settings.put(CARRY, new Setting(CARRY, false, "Carry items in crafting slots."));
42
        settings.put(MODE,new Setting<>(MODE,new Options("Mode", "Basic", new String[] {"Basic", "AACP", "Cubecraft"}),"InvMove method."));
43
    }
44
45
    @Override
46
    @RegisterEvent(events = {EventPacket.class, EventTick.class, EventUpdate.class})
47
    public void onEvent(Event event) {
48
    	String mode = ((Options) settings.get(MODE).getValue()).getSelected();
49
    	this.setSuffix(mode);
50
        if (mc.currentScreen instanceof GuiChat) {
51
            return;
52
        }
53
        if(event instanceof EventUpdate){
54
        	EventUpdate em = (EventUpdate)event;
55
        	if(em.isPre()){
56
        	}
57
        }
58
        if (event instanceof EventTick) {
59
            if (mc.currentScreen != null) {
60
    			if(!mode.equalsIgnoreCase("Cubecraft")){
61
    				KeyBinding[] moveKeys = new KeyBinding[]{
62
    					mc.gameSettings.keyBindForward,
63
    					mc.gameSettings.keyBindBack,
64
    					mc.gameSettings.keyBindLeft,
65
    					mc.gameSettings.keyBindRight,
66
    					mc.gameSettings.keyBindJump					
67
    				};
68
    				for (KeyBinding bind : moveKeys){
69
    					KeyBinding.setKeyBindState(bind.getKeyCode(), Keyboard.isKeyDown(bind.getKeyCode()));
70
    				}
71
    				if(!inInventory){
72
    					if(mode.equalsIgnoreCase("AACP")){
73
                			mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.STOP_SPRINTING));
74
                		}
75
    					inInventory = !inInventory;
76
    				}
77
    			}
78
    			if(!(mc.currentScreen instanceof GuiInvManager) ){
79
                if (Keyboard.isKeyDown(200)) {
80
                    mc.thePlayer.rotationPitch -= 1;
81
                }
82
                if (Keyboard.isKeyDown(208)) {
83
                    mc.thePlayer.rotationPitch += 1;
84
                }
85
                if (Keyboard.isKeyDown(203)) {
86
                    mc.thePlayer.rotationYaw -= 3;
87
                }
88
                if (Keyboard.isKeyDown(205)) {
89
                    mc.thePlayer.rotationYaw += 3;
90
                }
91
    			}
92
            }else{
93
            	if(inInventory){
94
            		if(mode.equalsIgnoreCase("AACP")){
95
            			mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, Action.START_SPRINTING));
96
            		}
97
					inInventory = !inInventory;
98
				}
99
            }
100
        }
101
        if (event instanceof EventPacket) {
102
            EventPacket ep = (EventPacket) event;
103
            Packet packet = ep.getPacket();
104
            if(((Boolean) settings.get(CARRY).getValue()))
105
            if (ep.isOutgoing() && packet instanceof C0DPacketCloseWindow) {
106
                ep.setCancelled(true);
107
            }
108
            if(packet instanceof C0BPacketEntityAction){          	
109
            	C0BPacketEntityAction p = (C0BPacketEntityAction)packet;
110
            	if(p.getAction() == Action.START_SPRINTING && inInventory && mode.equalsIgnoreCase("AACP"))
111
            		ep.setCancelled(true);
112
            }
113
            if(ep.isPre() && mode.equalsIgnoreCase("Cubecraft")){
114
            	if(packet instanceof C0BPacketEntityAction){
115
            		C0BPacketEntityAction p =(C0BPacketEntityAction)packet;
116
            		Action act = p.getAction();
117
            		if(act == Action.OPEN_INVENTORY){
118
            			ep.setCancelled(true);
119
            		}
120
            	}
121
            	if(packet instanceof C16PacketClientStatus){
122
                	C16PacketClientStatus p = (C16PacketClientStatus)packet;
123
                	EnumState st = p.getStatus();
124
                	if(st == EnumState.OPEN_INVENTORY_ACHIEVEMENT){
125
                		ep.setCancelled(true);
126
                	}
127
                }
128
        	}
129
        }
130
    }
131
}

What this file does

The module is three event handlers. EventTick owns the key re-assertion and the mode transitions: the move-key loop runs whenever a screen is open, the AACP STOP_SPRINTING/START_SPRINTING pair brackets the inInventory flag flip, and the arrow-key rotation runs for every screen except GuiInvManager. EventPacket handles the packet games: the CARRY toggle cancels outgoing C0D close-window packets, the AACP branch cancels START_SPRINTING while inInventory, and the Cubecraft branch cancels C0B OPEN_INVENTORY and C16 OPEN_INVENTORY_ACHIEVEMENT. EventUpdate is registered but its body is empty, a leftover shell from an earlier revision.

The GuiChat early return and the mode string suffix are the only UX details; the rest is pure packet manipulation. Note that the C0D cancel in the CARRY branch is gated on the CARRY setting only, so it applies to every window including chests, not just the crafting inventory the setting name implies.

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 Open (inventory close on movement)

Open.java171 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.inventory;
16
17
import java.util.UUID;
18
19
import org.bukkit.GameMode;
20
import org.bukkit.Input;
21
import org.bukkit.entity.Player;
22
import org.bukkit.event.inventory.InventoryType;
23
import org.bukkit.event.inventory.InventoryType.SlotType;
24
25
import fr.neatmonster.nocheatplus.NCPAPIProvider;
26
import fr.neatmonster.nocheatplus.checks.Check;
27
import fr.neatmonster.nocheatplus.checks.CheckType;
28
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
29
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
30
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
31
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
32
import fr.neatmonster.nocheatplus.compat.registry.BukkitAPIAccessFactory;
33
import fr.neatmonster.nocheatplus.compat.versions.ClientVersion;
34
import fr.neatmonster.nocheatplus.components.registry.event.IHandle;
35
import fr.neatmonster.nocheatplus.components.registry.feature.IDisableListener;
36
import fr.neatmonster.nocheatplus.hooks.ExemptionSettings;
37
import fr.neatmonster.nocheatplus.players.DataManager;
38
import fr.neatmonster.nocheatplus.players.IPlayerData;
39
import fr.neatmonster.nocheatplus.utilities.collision.CollisionUtil;
40
import fr.neatmonster.nocheatplus.utilities.entity.InventoryUtil;
41
42
/**
43
 * Watch over open inventories - check with "combined" static access, put here because it has too much to do with inventories.
44
 * @author asofold
45
 */
46
public class Open extends Check implements IDisableListener {
47
48
    private static Open instance = null;
49
50
    private UUID nestedPlayer = null;
51
52
    private final IHandle<ExemptionSettings> exeSet = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstanceHandle(ExemptionSettings.class);
53
    
54
    // TODO: Add specific contexts (allow different settings for fight / blockbreak etc.).
55
56
    /**
57
     * Static access check, if there is a cancel-action flag the caller should have stored that locally already and use the result to know if to cancel or not.
58
     * 
59
     * @param player
60
     * @return If cancelling some event is opportune (open inventory and cancel flag set).
61
     */
62
    public static boolean checkClose(Player player) {
63
        return instance.check(player);
64
    }
65
66
    public Open() {
67
        super(CheckType.INVENTORY_OPEN);
68
        instance = this;
69
    }
70
71
    @Override
72
    public void onDisable() {
73
        instance = null;
74
        nestedPlayer = null;
75
    }
76
77
    /**
78
     * Enforce a closed inventory on this generic event/action (without checking for any specific side condition) <br>
79
     * This check contains the isEnabled checking (!). Inventory is closed if set in the config. <br>
80
     * Also resets inventory opening time and interaction time.
81
     * 
82
     * @param player
83
     * @return True, if the inventory has been successfully closed. This will also reset the inventory open time and interaction time.
84
     */
85
    public boolean check(final Player player) {
86
        final boolean isShulkerBox = BukkitAPIAccessFactory.getBukkitAccess().getTopInventory(player).getType().toString().equals("SHULKER_BOX");
87
        if (
88
            // TODO: POC: Item duplication with teleporting NPCS, having their inventory open.
89
            exeSet.getHandle().isRegardedAsNpc(player)
90
            || !isEnabled(player) 
91
            || !InventoryUtil.hasInventoryOpen(player)
92
            // Workaround, Open would disallow players from opening the container if standing on top
93
            // of the shulker. Reason for this is unknown
94
            || isShulkerBox) {
95
            return false;
96
        }
97
        final IPlayerData pData = DataManager.getPlayerData(player);
98
        final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
99
        if (cc.openClose) {
100
            // NOTE about UUID stuff: https://github.com/NoCheatPlus/NoCheatPlus/commit/a41ff38c997bcca780da32681e92216880e9e1b0
101
            final UUID id = player.getUniqueId();
102
            if ((this.nestedPlayer == null || !id.equals(this.nestedPlayer))) {
103
                // (The second condition represents an error, but we don't handle alternating things just yet.)
104
                this.nestedPlayer = id;
105
                player.closeInventory();
106
                pData.getGenericInstance(InventoryData.class).inventoryOpenTime = 0;
107
                pData.getGenericInstance(InventoryData.class).containerInteractTime = 0;
108
                this.nestedPlayer = null;
109
                return true;
110
            }
111
        }
112
        return false;
113
    }
114
115
    /**
116
     * To be called on {@link org.bukkit.event.player.PlayerMoveEvent}; pre-requisite is {@link InventoryUtil#hasInventoryOpen(Player)} having returned true. <br>
117
     * (Against InventoryMove cheats and similar)<br>
118
     * 
119
     * @param player
120
     * @param pData
121
     * @return True, if the open inventory needs to be closed during this movement.
122
     */
123
    public boolean checkOnMove(final Player player, final IPlayerData pData) {
124
        if (BridgeMisc.isWASDImpulseKnown(player)) {
125
            // Use WASD input directly if available (1.21.1+).
126
            Input input = player.getCurrentInput();
127
            boolean moving = input.isLeft() || input.isRight() || input.isForward() || input.isBackward() || input.isJump();
128
            if (moving) {
129
                final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
130
                if (cc.openImprobableWeight > 0.0) {
131
                    Improbable.feed(player, cc.openImprobableWeight, System.currentTimeMillis());
132
                }
133
                return true;
134
            }
135
            return false;
136
        }
137
        
138
        final MovingData mData = pData.getGenericInstance(MovingData.class);
139
        final InventoryConfig cc = pData.getGenericInstance(InventoryConfig.class);
140
        final InventoryData data = pData.getGenericInstance(InventoryData.class);
141
        final boolean creative = player.getGameMode() == GameMode.CREATIVE && ((data.clickedSlotType == SlotType.QUICKBAR) || cc.openDisableCreative);
142
        final boolean isMerchant = BukkitAPIAccessFactory.getBukkitAccess().getTopInventory(player).getType() == InventoryType.MERCHANT;
143
        final PlayerMoveData thisMove = mData.playerMoves.getCurrentMove();
144
        // Skipping conditions first.
145
        if (
146
            // Ignore duplicate packets
147
            mData.lastMoveNoMove
148
            // Can't check vehicles
149
            || player.isInsideVehicle()
150
            // In creative or middle click
151
            || creative 
152
            // Ignore merchant inventories.
153
            || isMerchant 
154
            // Velocity is ignored altogether. TODO: Should be horizontal too. Maybe this still work fine, most the time appear together
155
            || !mData.getOrUseVerticalVelocity(thisMove.yDistance).isEmpty()
156
            //|| mData.useHorizontalVelocity(thisMove.hDistance - mData.getHorizontalFreedom()) >= thisMove.hDistance - mData.getHorizontalFreedom()
157
            // Ignore entity pushing.
158
            || pData.getClientVersion().isAtLeast(ClientVersion.V_1_9) && CollisionUtil.isCollidingWithEntities(player, 0.5, 0.1, 0.5, true)) {
159
            return false;
160
        }
161
            
162
        // Actual detection: do assume player to be actively moving even if we don't actually know the direction (MAYBE, needs testing)
163
        if (thisMove.hasImpulse.decide()) {
164
            if (cc.openImprobableWeight > 0.0) {
165
                Improbable.feed(player, cc.openImprobableWeight, System.currentTimeMillis());
166
            }
167
            return true;
168
        }
169
        return false;
170
    }
171
}

How it counteracts this module

NCP's Open check enforces a closed inventory while the player moves. checkOnMove (lines 123-170) skips duplicate packets, vehicles, creative quickbar cases, merchants and vertical-velocity moves, then decides on impulse: on 1.21.1+ Bukkit it reads the player's actual input flags, otherwise it falls back to the movement model's hasImpulse.decide() (line 163), which infers a deliberate move from the motion pattern. An impulse while InventoryUtil.hasInventoryOpen(player) is true feeds Improbable and the caller force-closes the window, resetting inventoryOpenTime and containerInteractTime.

The Basic mode is the direct target: the whole point of the module is to produce movement impulses while the window is open, and each WASD-driven move trips the decision. The AACP mode's sprint suppression does not help, because the check keys on the move impulse, not the sprint flag. The Cubecraft mode is the honest evasion: by cancelling C16 OPEN_INVENTORY_ACHIEVEMENT and C0B OPEN_INVENTORY it stops the server from ever opening the vanilla inventory window, so hasInventoryOpen stays false and there is no open state for the check to close. The evasion only covers the client inventory, not server-opened containers, and it relies on the server tolerating the missing open announcement.

anticheat ToggleFrequency (C0B toggle ledger)

ToggleFrequency.java61 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.net;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.checks.Check;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
import fr.neatmonster.nocheatplus.players.IPlayerData;
22
import fr.neatmonster.nocheatplus.utilities.TickTask;
23
24
/**
25
 * The ToggleFrequency check is used to detect players who toggle certain actions too quickly (i.e.: sneaking).
26
 */
27
public class ToggleFrequency extends Check {
28
29
    /**
30
     * Instantiates a new toggle frequency check.
31
     */
32
    public ToggleFrequency() {
33
        super(CheckType.NET_TOGGLEFREQUENCY);
34
    }
35
36
    /**
37
     * Checks a player.
38
     * 
39
     * @param player
40
     *            the player
41
     * @param data
42
     * @param cc
43
     * @param pData
44
     * @return true, if successful
45
     */
46
    public boolean check(final Player player, final NetData data, final NetConfig cc, final IPlayerData pData) {
47
        boolean cancel = false;
48
        // (Addition to frequency is done in the listener for each toggle event)
49
        // Full time resolution
50
        final long actionFullTime = data.playerActionFreq.bucketDuration() * data.playerActionFreq.numberOfBuckets();
51
        /** Toggle action events counted */
52
        final float fullActionScore = data.playerActionFreq.score(1f) / TickTask.getLag(actionFullTime);
53
        final double violation = fullActionScore > cc.toggleActionLimit ? fullActionScore - cc.toggleActionLimit : 0.0;
54
        if (violation > 0.0) {
55
            data.toggleFrequencyVL += violation;
56
            cancel = executeActions(player, data.toggleFrequencyVL, violation, cc.toggleFrequencyActions).willCancel();
57
        }
58
        else data.toggleFrequencyVL *= 0.9;
59
        return cancel;
60
    }
61
}

How it counteracts this module

ToggleFrequency limits how often a player toggles actions. The EntityActionAdapter (NCPCompatProtocolLib, checks/net/protocollib/EntityActionAdapter.java) counts every C0B entity action, sprint and sneak toggles included, into data.playerActionFreq (line 86) and runs toggleFrequency.check on each one: the full-window score of the ActionFrequency is compared against cc.toggleActionLimit, and the excess accumulates in toggleFrequencyVL until the configured actions cancel (ToggleFrequency lines 46-60).

The AACP mode feeds this ledger with a STOP_SPRINTING on every inventory open and a START_SPRINTING on every close, on top of the player's own sprint toggling. A single open/close cycle is harmless, but the mode is used exactly where the ledger matters: opening the inventory repeatedly during a fight (the classic inventory-walk pattern) adds two toggles per cycle to whatever sprint toggling the fight already generates, and sustained open/close spamming pushes the window score past the action limit. The check counts action types indiscriminately, so the module's extra C0Bs are indistinguishable from ordinary sprint toggles.

anticheat InventoryMove (rotation and state 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 InventoryMove punishes rotation updates, sprinting and sneaking while an inventory window is open, excluding only teleport-accept moves, and rubberbands the player on violation (InventoryMove.java line 45). The check keys on the client's movement state as reported in the move stream, so it sees the exact states the module produces: the arrow-key look mutates rotationPitch and rotationYaw, and the next C03 look packet is an isUpdateRot move while pp.hasInventoryOpen() is non-zero, which is punished immediately. Sprinting and sneaking while the window is open take the same branch.

The AACP mode's sprint suppression is an evasion of only the sprint leg of this check: it cancels START_SPRINTING at the client so Hawk's server-side state never turns the sprint flag on, but the rotation leg has no such mitigation, and the module's own look keys guarantee rotation updates whenever they are pressed. A player who only walks (no look keys, no sprint, no sneak) stays under this check, which is the narrow safe envelope the module's Basic mode offers against Hawk.

anticheat ActionToggleSpeed (sprint/sneak toggle rate)

ActionToggleSpeed.java80 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.CustomCheck;
23
import me.islandscout.hawk.event.Event;
24
import me.islandscout.hawk.event.PlayerActionEvent;
25
import org.bukkit.entity.Player;
26
27
import java.util.HashMap;
28
import java.util.Map;
29
import java.util.UUID;
30
31
/**
32
 * This check limits clients' sprint and sneak toggle rates to
33
 * prevent exploitation of the speed check and combat mechanics.
34
 */
35
public class ActionToggleSpeed extends CustomCheck {
36
37
    private Map<UUID, Long> lastSneakToggle;
38
    private Map<UUID, Long> lastSprintToggle;
39
40
    public ActionToggleSpeed() {
41
        super("actiontogglespeed", "%player% failed action toggle speed, VL: %vl%");
42
        lastSneakToggle = new HashMap<>();
43
        lastSprintToggle = new HashMap<>();
44
    }
45
46
    @Override
47
    protected void check(Event e) {
48
        if(!(e instanceof PlayerActionEvent))
49
            return;
50
        PlayerActionEvent aE = (PlayerActionEvent)e;
51
        PlayerActionEvent.PlayerAction action = aE.getAction();
52
        HawkPlayer pp = e.getHawkPlayer();
53
        UUID uuid = e.getPlayer().getUniqueId();
54
        if(action == PlayerActionEvent.PlayerAction.SNEAK_START || action == PlayerActionEvent.PlayerAction.SNEAK_STOP) {
55
56
            if(pp.getCurrentTick() - lastSneakToggle.getOrDefault(uuid, 0L) < 1) {
57
                punish(pp, canCancel(), e);
58
            } else {
59
                reward(pp);
60
            }
61
62
            lastSneakToggle.put(uuid, pp.getCurrentTick());
63
        } else if(action == PlayerActionEvent.PlayerAction.SPRINT_START || action == PlayerActionEvent.PlayerAction.SPRINT_STOP) {
64
65
            if(pp.getCurrentTick() - lastSprintToggle.getOrDefault(uuid, 0L) < 1) {
66
                punish(pp, canCancel(), e);
67
            } else {
68
                reward(pp);
69
            }
70
71
            lastSprintToggle.put(uuid, pp.getCurrentTick());
72
        }
73
    }
74
75
    public void removeData(Player p) {
76
        UUID uuid = p.getUniqueId();
77
        lastSneakToggle.remove(uuid);
78
        lastSprintToggle.remove(uuid);
79
    }
80
}

How it counteracts this module

Hawk's ActionToggleSpeed limits sprint and sneak toggle rates to prevent exploitation of the speed check and combat mechanics. For each PlayerActionEvent carrying SNEAK_START, SNEAK_STOP, SPRINT_START or SPRINT_STOP, the check compares the current tick against the last toggle of the same action and punishes when the gap is under one tick (ActionToggleSpeed lines 54-72), then records the new toggle time.

The AACP mode's open/close cycle emits STOP_SPRINTING on open and START_SPRINTING on close, and when a player taps the inventory open and shut in quick succession (or the client's own sprint logic and the module's close-time START_SPRINTING collide in the same tick), two same-direction toggles land within a tick and punish. The check is tick-grained, so it catches the pathological case rather than the ordinary cycle; the honest reading is that a single open/close cycle per few seconds stays inside the one-tick gap, and the check exists to stop the rapid toggle spam that inventory-walk sessions produce.

← Back to Analysis Hub