Sigma 4.11 ChestStealer module 2 files, 251 lines

Sigma 4.11 ChestStealer: Full Source Analysis

Sigma 4.11's ChestStealer drains chests one item at a time through the vanilla container protocol.

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

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

Analysis

Overview

Sigma 4.11's ChestStealer drains chests one item at a time through the vanilla container protocol. Every steal passes through mc.playerController.windowClick, which emits C0EPacketClickWindow against the open window id, paced by a timer of 50 milliseconds per delay-setting tick. The Hypixel mode doubles every steal into two shift-clicks (button 0 then button 1) so each item costs two C0E packets, and the Drop option appends a -999 outside-window throw. A title blacklist refuses to touch shop, selector and lobby GUIs, the item filter keeps junk and worse swords out of the inventory, and the optional ChestAura opens nearby chests with C08PacketPlayerBlockPlacement sent through the no-event packet path. The module closes the chest with the client closeScreen once the viewed contents are gone or the inventory is full.

Steal loop and pacing

The handler runs on EventUpdate pre. While a GuiChest is open and the title passes the blacklist, a per-item delay is computed as 50 times the Delay setting (default 2, so 100ms per item) and gated through a Sigma Timer. A First Delay setting (default 0, range 0 to 15) holds the first click for that many update ticks. Each steal is a windowClick against the chest window id, and the timer resets after every click. The loop first verifies the player inventory is not full, then scans the chest slots for the first stack that passes the isBad filter; when nothing stealable remains, or when the inventory is full, the module closes the screen and clears the stealing flag.

Modes and filters

In Hypixel mode each item costs two window clicks: the first with button 0 and the second with button 1, both in shift mode, which doubles the C0E rate to roughly 20 packets per second at the default delay. With Drop enabled the steal is a left-click pickup followed by a -999 outside-window throw, and the server-side drop is also issued per item. The isBad filter compares candidate swords against the best sword already in the inventory using sharpness times 1.25 plus base damage, and rejects a long unlocalized-name list (tnt, sticks, eggs, string, flint, compass, feathers, buckets, snow, fish, enchantments, xp, shears, anvils, torches, seeds, leather, pistons), plus pickaxes, glass bottles, tools and harmful splash potions. The chest-title blacklist holds about forty substrings such as menu, selector, game, shop, lobby, vault and anticheat, and any match makes the handler return without stealing.

ChestAura

ChestAura is a separate pre-update branch that runs while no screen is open. It walks the loaded tile-entity list, and for each TileEntityChest within 4 blocks that is not marked empty it sends a C08PacketPlayerBlockPlacement with the chest position, a ray-traced facing direction and the current held item through NetUtil.sendPacketNoEvents, then marks the chest empty client-side and breaks. The stealTimer gates re-scans at 1000ms and resets the stealing flag after 2000ms of inactivity, so the module re-opens chests as they become available. The C08 goes out through the network manager's no-event path, bypassing the client's outgoing event bus.

source ChestStealer.java (module)

ChestStealer.java238 lines · JavaOriginal ↗
1
package info.sigmaclient.module.impl.player;
2
3
import info.sigmaclient.event.Event;
4
import info.sigmaclient.event.RegisterEvent;
5
import info.sigmaclient.event.impl.EventUpdate;
6
import info.sigmaclient.module.Module;
7
import info.sigmaclient.module.data.ModuleData;
8
import info.sigmaclient.module.data.Options;
9
import info.sigmaclient.module.data.Setting;
10
import info.sigmaclient.util.NetUtil;
11
import info.sigmaclient.util.Timer;
12
import info.sigmaclient.util.misc.ChatUtil;
13
import net.minecraft.client.gui.inventory.GuiChest;
14
import net.minecraft.enchantment.Enchantment;
15
import net.minecraft.enchantment.EnchantmentHelper;
16
import net.minecraft.item.*;
17
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
18
import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition;
19
import net.minecraft.potion.Potion;
20
import net.minecraft.potion.PotionEffect;
21
import net.minecraft.tileentity.TileEntityChest;
22
import net.minecraft.util.BlockPos;
23
import net.minecraft.util.EnumFacing;
24
import net.minecraft.util.MovingObjectPosition;
25
import net.minecraft.util.Vec3;
26
27
public class ChestStealer extends Module {
28
29
    private final String DELAY = "DELAY";
30
    private final String DROP = "DROP";
31
    private final String CLOSE = "CLOSE";
32
    private final String CHESTAURA = "CHESTAURA";
33
    private final String IGNORE = "IGNORE";
34
    private final String FIRST = "FIRST";
35
    private final String MODE = "MODE";
36
    private Timer timer = new Timer();
37
    private Timer stealTimer = new Timer();
38
    private boolean isStealing;
39
    private int first = 0;
40
41
    public ChestStealer(ModuleData data) {
42
        super(data);
43
        settings.put(MODE, new Setting<>(MODE, new Options("ChestStealer Mode", "Hypixel", new String[]{"Hypixel", "Basic"}), "ChestStealer bypass method."));
44
        settings.put(DELAY, new Setting<>(DELAY, 2, "Tick delay before grabbing next item.", 1, 1, 5));
45
        settings.put(FIRST, new Setting<>(FIRST, 0, "Tick delay before grabbing first item.", 1, 0, 15));
46
        settings.put(DROP, new Setting<>(DROP, false, "Auto drop items."));
47
        settings.put(CLOSE, new Setting<>(CLOSE, true, "Auto closes chests when done."));
48
        settings.put(CHESTAURA, new Setting<>(CHESTAURA, false, "Auto opens chests near you."));
49
        settings.put(IGNORE, new Setting<>(IGNORE, true, "Ignores trash items for minigames."));
50
    }
51
52
    @Override
53
    @RegisterEvent(events = {EventUpdate.class})
54
    public void onEvent(Event event) {
55
    	String currMode = ((Options) settings.get(MODE).getValue()).getSelected();
56
    	this.setSuffix(currMode);
57
        if (event instanceof EventUpdate) {
58
            EventUpdate em = (EventUpdate) event;
59
            if (em.isPre() && ((Boolean) settings.get(CHESTAURA).getValue())) {
60
                if (stealTimer.delay(2000) && isStealing) {
61
                    stealTimer.reset();
62
                    isStealing = false;
63
                }
64
                for (Object o : mc.theWorld.loadedTileEntityList) {
65
                    if (o instanceof TileEntityChest) {
66
                        TileEntityChest chest = (TileEntityChest) o;
67
                        float x = chest.getPos().getX();
68
                        float y = chest.getPos().getY();
69
                        float z = chest.getPos().getZ();
70
                        if (!isStealing && !chest.isEmpty && mc.thePlayer.getDistance(x, y, z) < 4 && stealTimer.delay(1000) && mc.currentScreen == null) {
71
                            isStealing = true;
72
                            NetUtil.sendPacketNoEvents(new C08PacketPlayerBlockPlacement(chest.getPos(), getFacingDirection(chest.getPos()).getIndex(), mc.thePlayer.getCurrentEquippedItem(), x, y, z));
73
                            chest.isEmpty = true;
74
                            stealTimer.reset();
75
                            break;
76
                        }
77
                    }
78
                }
79
            } else if (mc.currentScreen instanceof GuiChest) {
80
                GuiChest guiChest = (GuiChest) mc.currentScreen;
81
                String name = guiChest.lowerChestInventory.getDisplayName().getUnformattedText().toLowerCase();
82
                String[] list = new String[]{"menu", "selector", "game", "gui", "server", "inventory", "play", "teleporter", "shop", "melee", "armor",
83
                        "block", "castle", "mini", "warp", "teleport", "user", "team", "tool", "sure", "trade", "cancel", "accept", "soul", "book", "recipe",
84
                        "profile", "tele", "port", "map", "kit", "select", "lobby", "vault", "lock", "anticheat", "travel", "settings", "user", "preference",
85
                        "compass", "cake", "wars", "buy", "upgrade", "ranged", "potions", "utility"};
86
            
87
88
              
89
                for (String str : list) {
90
                    if (name.contains(str))
91
                        return;
92
                }
93
                if(!isStealing){
94
                	first = 0;
95
                }
96
                first ++;
97
                isStealing = true;
98
                if(first <= ((Number) settings.get(FIRST).getValue()).intValue()){
99
                	return;
100
                }
101
                boolean full = true;
102
                ItemStack[] arrayOfItemStack;
103
                int j = (arrayOfItemStack = mc.thePlayer.inventory.mainInventory).length;
104
                for (int i = 0; i < j; i++) {
105
                    ItemStack item = arrayOfItemStack[i];
106
                    if (item == null) {
107
                        full = false;
108
                        break;
109
                    }
110
                }
111
                boolean containsItems = false;
112
                if (!full) {
113
                    for (int index = 0; index < guiChest.lowerChestInventory.getSizeInventory(); index++) {
114
                        ItemStack stack = guiChest.lowerChestInventory.getStackInSlot(index);
115
                        if (stack != null && !isBad(stack)) {
116
                            containsItems = true;
117
                            break;
118
                        }
119
                    }
120
                    if (containsItems) {
121
                        for (int index = 0; index < guiChest.lowerChestInventory.getSizeInventory(); index++) {
122
                            ItemStack stack = guiChest.lowerChestInventory.getStackInSlot(index);
123
                            int delay = 50 * ((Number) settings.get(DELAY).getValue()).intValue();
124
                            if (stack != null && timer.delay(delay) && !isBad(stack)) {
125
                            	mc.playerController.windowClick(guiChest.inventorySlots.windowId, index, 0, ((Boolean) settings.get(DROP).getValue()) ? 0 : 1, mc.thePlayer);
126
                            	
127
                            	 if (currMode.equalsIgnoreCase("Hypixel")) {
128
                            		 mc.playerController.windowClick(guiChest.inventorySlots.windowId, index, 1, ((Boolean) settings.get(DROP).getValue()) ? 0 : 1, mc.thePlayer);
129
                            	 }
130
                            	if (((Boolean) settings.get(DROP).getValue())) {
131
                                    mc.playerController.windowClick(guiChest.inventorySlots.windowId, -999, 0, 0, mc.thePlayer);
132
                                }
133
                                timer.reset();
134
                            }
135
                        }
136
                    } else if (((Boolean) settings.get(CLOSE).getValue())) {
137
                        mc.thePlayer.closeScreen();
138
                        isStealing = false;
139
                    }
140
                } else if (((Boolean) settings.get(CLOSE).getValue())) {
141
                    mc.thePlayer.closeScreen();
142
                    isStealing = false;
143
                }
144
            } else {
145
            	
146
                isStealing = false;
147
            }
148
        }
149
    }
150
151
    private EnumFacing getFacingDirection(final BlockPos pos) {
152
        EnumFacing direction = null;
153
        if (!mc.theWorld.getBlockState(pos.add(0, 1, 0)).getBlock().isSolidFullCube()) {
154
            direction = EnumFacing.UP;
155
        }
156
        final MovingObjectPosition rayResult = mc.theWorld.rayTraceBlocks(new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ), new Vec3(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5));
157
        if (rayResult != null) {
158
            return rayResult.facing;
159
        }
160
        return direction;
161
    }
162
163
    private boolean isBad(ItemStack item) {
164
        if (!(Boolean) settings.get(IGNORE).getValue())
165
            return false;
166
        ItemStack is = null;
167
        float lastDamage = -1;
168
        for (int i = 9; i < 45; i++) {
169
            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {
170
                ItemStack is1 = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
171
                if (is1.getItem() instanceof ItemSword && item.getItem() instanceof ItemSword) {
172
                    if (lastDamage < getDamage(is1)) {
173
                        lastDamage = getDamage(is1);
174
                        is = is1;
175
                    }
176
                }
177
            }
178
        }
179
180
181
        if (is != null && is.getItem() instanceof ItemSword && item.getItem() instanceof ItemSword) {
182
            float currentDamage = getDamage(is);
183
            float itemDamage = getDamage(item);
184
            if (itemDamage > currentDamage) {
185
                return false;
186
            }
187
        }
188
189
190
        return item != null &&
191
                ((item.getItem().getUnlocalizedName().contains("tnt")) ||
192
                        (item.getItem().getUnlocalizedName().contains("stick")) ||
193
                        (item.getItem().getUnlocalizedName().contains("egg") && !item.getItem().getUnlocalizedName().contains("leg")) ||
194
                        (item.getItem().getUnlocalizedName().contains("string")) ||
195
                        (item.getItem().getUnlocalizedName().contains("flint")) ||
196
                        (item.getItem().getUnlocalizedName().contains("compass")) ||
197
                        (item.getItem().getUnlocalizedName().contains("feather")) ||
198
                        (item.getItem().getUnlocalizedName().contains("bucket")) ||
199
                        (item.getItem().getUnlocalizedName().contains("snow")) ||
200
                        (item.getItem().getUnlocalizedName().contains("fish")) ||
201
                        (item.getItem().getUnlocalizedName().contains("enchant")) ||
202
                        (item.getItem().getUnlocalizedName().contains("exp")) ||
203
                        (item.getItem().getUnlocalizedName().contains("shears")) ||
204
                        (item.getItem().getUnlocalizedName().contains("anvil")) ||
205
                        (item.getItem().getUnlocalizedName().contains("torch")) ||
206
                        (item.getItem().getUnlocalizedName().contains("seeds")) ||
207
                        (item.getItem().getUnlocalizedName().contains("leather")) ||
208
                        ((item.getItem() instanceof ItemPickaxe)) ||
209
                        ((item.getItem() instanceof ItemGlassBottle)) ||
210
                        ((item.getItem() instanceof ItemTool)) ||
211
                        (item.getItem().getUnlocalizedName().contains("piston")) ||
212
                        ((item.getItem().getUnlocalizedName().contains("potion"))
213
                                && (isBadPotion(item))));
214
    }
215
216
    private boolean isBadPotion(ItemStack stack) {
217
        if (stack != null && stack.getItem() instanceof ItemPotion) {
218
            final ItemPotion potion = (ItemPotion) stack.getItem();
219
            if (ItemPotion.isSplash(stack.getItemDamage())) {
220
                for (final Object o : potion.getEffects(stack)) {
221
                    final PotionEffect effect = (PotionEffect) o;
222
                    if (effect.getPotionID() == Potion.poison.getId() || effect.getPotionID() == Potion.harm.getId() || effect.getPotionID() == Potion.moveSlowdown.getId() || effect.getPotionID() == Potion.weakness.getId()) {
223
                        return true;
224
                    }
225
                }
226
            }
227
        }
228
        return false;
229
    }
230
231
    private float getDamage(ItemStack stack) {
232
        if (!(stack.getItem() instanceof ItemSword)) {
233
            return 0;
234
        }
235
        return EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, stack) * 1.25f + ((ItemSword) stack.getItem()).getDamageGiven();
236
    }
237
238
}

What this file does

The module is one EventUpdate handler with two branches. The chest branch runs the paced steal loop: it computes the 50-millisecond per-item delay, applies the first-delay counter, verifies the inventory is not full, scans for a non-bad stack and shift-clicks it through windowClick, which emits C0E via the fork's PlayerControllerMP. The Hypixel double-click and the Drop throw are extra windowClick calls in the same branch. The ChestAura branch opens nearby chests with C08 through NetUtil.sendPacketNoEvents and tracks them with a client-side isEmpty flag.\n\nThe close path is mc.thePlayer.closeScreen, which the Sigma fork's EntityPlayerSP overrides to queue C0DPacketCloseWindow with the open container window id. The C09 held-item chip is inherited from the client's window protocol: the fork's windowClick emits pure C0E and only other sync paths, like the per-tick updateController sync, ever emit C09, and this module never changes the held item. The title blacklist and the sword-damage comparison are pure client-side filters that decide which stacks are worth a click.

source NetUtil.java (no-event send path)

NetUtil.java13 lines · JavaOriginal ↗
1
package info.sigmaclient.util;
2
3
import net.minecraft.network.Packet;
4
5
public class NetUtil implements MinecraftUtil {
6
    public static void sendPacketNoEvents(Packet packet) {
7
        mc.getNetHandler().getNetworkManager().sendPacketNoEvent(packet);
8
    }
9
10
    public static void sendPacket(Packet packet) {
11
        mc.thePlayer.sendQueue.addToSendQueue(packet);
12
    }
13
}

What this file does

NetUtil is the module's only external helper. sendPacketNoEvents routes a packet straight to the network manager's sendPacketNoEvent, which queues it for the wire without running it through the client's outgoing event bus, so no other module or event listener can cancel or observe the ChestAura open in flight. sendPacket sends through the normal event-visible path. The module uses the no-event variant specifically for the C08 chest-open packets so the open cannot be intercepted by other handlers.\n\nThe distinction matters for the wire behavior: both paths ultimately reach the server, and the server sees the C08 as a normal use-item-on-block action that opens the chest and starts the S30 window refresh the steal loop then consumes. The class is a thin static wrapper over the fork's NetworkManager, which is why it is the right supporting file for the ChestAura half of the module.

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 FastClick (window click rate)

FastClick.java243 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.ArrayList;
18
import java.util.List;
19
20
import org.bukkit.Material;
21
import org.bukkit.entity.Player;
22
import org.bukkit.event.inventory.InventoryClickEvent;
23
import org.bukkit.event.inventory.InventoryType;
24
import org.bukkit.inventory.InventoryView;
25
import org.bukkit.inventory.ItemStack;
26
27
import fr.neatmonster.nocheatplus.actions.ParameterName;
28
import fr.neatmonster.nocheatplus.checks.Check;
29
import fr.neatmonster.nocheatplus.checks.CheckType;
30
import fr.neatmonster.nocheatplus.checks.ViolationData;
31
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
32
import fr.neatmonster.nocheatplus.permissions.Permissions;
33
import fr.neatmonster.nocheatplus.players.IPlayerData;
34
import fr.neatmonster.nocheatplus.utilities.entity.InventoryUtil;
35
import fr.neatmonster.nocheatplus.utilities.StringUtil;
36
import fr.neatmonster.nocheatplus.utilities.TickTask;
37
38
39
/**
40
 * FastClick checks for players clicking in inventories too quickly (nerfs autosteal cheats and the like).
41
 */
42
public class FastClick extends Check {
43
44
45
    final List<String> tags = new ArrayList<String>();
46
47
48
    /**
49
     * Instantiates a new fast click check.
50
     */
51
    public FastClick() {
52
        super(CheckType.INVENTORY_FASTCLICK);
53
    }
54
55
56
   /**
57
    * Checks a player.
58
    * 
59
    * @param player
60
    * @param now Millisec
61
    * @param view
62
    * @param slot
63
    * @param cursor
64
    * @param clicked
65
    * @param isShiftClick
66
    * @param inventoryAction
67
    * @param data
68
    * @param cc 
69
    * @param pData
70
    * @return true, if successful
71
    */
72
    public boolean check(final Player player, final long now, 
73
                         final InventoryClickEvent event, final int slot, final ItemStack cursor, 
74
                         final ItemStack clicked, final boolean isShiftClick, 
75
                         final String inventoryAction, final InventoryData data, final InventoryConfig cc, 
76
                         final IPlayerData pData) {
77
78
        final float amount;
79
        final Material clickedMat = clicked == null ? Material.AIR : clicked.getType();
80
        final Material cursorMat;
81
        final int cursorAmount;
82
        boolean cancel = false;
83
        tags.clear();
84
85
        if (cursor != null) {
86
            cursorMat = cursor.getType();
87
            cursorAmount = Math.max(1, cursor.getAmount());
88
        }
89
        else {
90
            cursorMat = null;
91
            cursorAmount = 0;
92
        }
93
94
        if (inventoryAction != null) {
95
            amount = getAmountWithAction(event, slot, clicked, clickedMat, cursorMat, cursorAmount, isShiftClick, inventoryAction, data, cc);
96
        }
97
        else if (cursor != null) {
98
            // Detect shift-click features indirectly.
99
            amount = detectTweaks1_5(event, slot, clicked, clickedMat, cursorMat, cursorAmount, isShiftClick, data, cc);
100
        }
101
        else amount = 1f;
102
103
        if (isShiftClick && inventoryAction.equals("MOVE_TO_OTHER_INVENTORY") 
104
            && (cursorMat != null && cursorMat != Material.AIR) 
105
            && clickedMat != Material.AIR) {
106
            return false;
107
        }
108
        
109
        // Count clicks
110
        data.fastClickFreq.add(now, amount);
111
        
112
        // Shor-term VL
113
        float shortTerm = data.fastClickFreq.bucketScore(0);
114
        if (shortTerm > cc.fastClickShortTermLimit) {
115
            // Check for lag.
116
            shortTerm /= (float) TickTask.getLag(data.fastClickFreq.bucketDuration(), true);
117
        }
118
        shortTerm -= cc.fastClickShortTermLimit;
119
        
120
        // Normal VL
121
        float normal = data.fastClickFreq.score(1f);
122
        if (normal > cc.fastClickNormalLimit) {
123
            // Check for lag.
124
            normal /= (float) TickTask.getLag(data.fastClickFreq.bucketDuration() * data.fastClickFreq.numberOfBuckets(), true);
125
        }
126
        normal -= cc.fastClickNormalLimit;
127
        
128
        // Process Violations.
129
        final double violation = Math.max(shortTerm, normal);
130
        if (violation > 0.0) {
131
            tags.add("clickspeed");
132
            data.fastClickVL += violation;
133
            final ViolationData vd = new ViolationData(this, player, data.fastClickVL, violation, cc.fastClickActions);
134
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
135
            cancel = executeActions(vd).willCancel();
136
        }
137
        else data.fastClickVL *= 0.99;
138
139
        if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
140
            player.sendMessage("FastClick: " + data.fastClickFreq.bucketScore(0) + " | " + data.fastClickFreq.score(1f) + " | cursor=" + cursor 
141
                                + " | clicked=" + clicked + " | action=" + inventoryAction);
142
        }
143
        
144
        // Adjust data
145
        data.fastClickLastClicked = clickedMat;
146
        data.fastClickLastSlot = slot;
147
        data.fastClickLastCursor = cursorMat;
148
        data.fastClickLastCursorAmount = cursorAmount;
149
150
        // Lastly, always feed the improbable.
151
        if (cc.fastClickImprobableWeight > 0.0f) {
152
            Improbable.feed(player, cc.fastClickImprobableWeight * amount, now);
153
        }
154
        return cancel;
155
    }
156
    
157
158
   /**
159
    * Enforce sane timings for interacting with the container and clicking in it.
160
    * 
161
    * @param player
162
    * @param data
163
    * @param cc
164
    */
165
    public boolean checkContainerInteraction(final Player player, final InventoryData data, final InventoryConfig cc) {
166
        boolean cancel = false;
167
        tags.clear();
168
        if (InventoryUtil.isContainerInteractionRecent(player, cc.chestOpenLimit)) {
169
            // Interaction was too quick, violation.
170
            tags.add("interact_time");
171
            long duration = Math.max(data.lastClickTime - data.containerInteractTime, 20);
172
            double violation = (cc.chestOpenLimit / duration) * 100D; // Normalize.
173
            data.fastClickVL += violation;
174
            final ViolationData vd = new ViolationData(this, player, data.fastClickVL, violation, cc.fastClickActions);
175
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
176
            cancel = executeActions(vd).willCancel();  
177
        }
178
       return cancel;
179
    }
180
    
181
182
   /**
183
    * Detect the inventory tweaks that were introduced in MC 1.5
184
    * 
185
    * @param view
186
    * @param slot
187
    * @param clicked
188
    * @param clickedMat
189
    * @param cursorAmount
190
    * @param isShiftClick
191
    * @param data
192
    * @param cc
193
    */
194
    private float detectTweaks1_5(final InventoryClickEvent event, final int slot, final ItemStack clicked, 
195
                                  final Material clickedMat, final Material cursorMat, 
196
                                  final int cursorAmount, final boolean isShiftClick, 
197
                                  final InventoryData data, final InventoryConfig cc) {
198
199
        if (cursorMat != data.fastClickLastCursor 
200
            && (!isShiftClick || clickedMat == Material.AIR || clickedMat != data.fastClickLastClicked) 
201
            || cursorMat == Material.AIR || cursorAmount != data.fastClickLastCursorAmount) {
202
            return 1f;
203
        }
204
        else if (clickedMat == Material.AIR || clickedMat == cursorMat 
205
                || isShiftClick && clickedMat == data.fastClickLastClicked ) {
206
            return Math.min(cc.fastClickNormalLimit , cc.fastClickShortTermLimit) 
207
                    / (float) (isShiftClick && clickedMat != Material.AIR ? (1.0 + Math.max(cursorAmount, InventoryUtil.getStackCount(event, clicked))) : cursorAmount)  * 0.75f;
208
        }
209
        return 1f;
210
    }
211
212
213
    private float getAmountWithAction(final InventoryClickEvent event, final int slot, final ItemStack clicked, 
214
                                      final Material clickedMat, final Material cursorMat, 
215
                                      final int cursorAmount, final boolean isShiftClick, 
216
                                      final String inventoryAction, 
217
                                      final InventoryData data, final InventoryConfig cc) {
218
219
        // Continuous drop feature with open inventories.
220
        if (inventoryAction.equals("DROP_ONE_SLOT")
221
            && slot == data.fastClickLastSlot 
222
            && clickedMat == data.fastClickLastClicked
223
            && event.getInventory().getType() == InventoryType.CRAFTING
224
            // && InventoryUtil.couldHaveInventoryOpen(player)
225
            // TODO: Distinguish if the inventory is really open.
226
            ) {
227
            return 0.6f;
228
        }
229
230
        // Collect to cursor.
231
        if (inventoryAction.equals("COLLECT_TO_CURSOR")) {
232
            final int stackCount = InventoryUtil.getStackCount(event, clicked);
233
            return stackCount <= 0 ? 1f : Math.min(cc.fastClickNormalLimit , cc.fastClickShortTermLimit) / stackCount * 0.75f;
234
        }
235
236
        // Shift click features.
237
        if ((inventoryAction.equals("MOVE_TO_OTHER_INVENTORY")) && cursorMat != Material.AIR) {
238
            // Let the legacy method do the side condition checks and counting for now.
239
            return detectTweaks1_5(event, slot, clicked, clickedMat, cursorMat, cursorAmount, isShiftClick, data, cc);
240
        }
241
        return 1f;
242
    }
243
}

How it counteracts this module

NoCheatPlus FastClick scores InventoryClickEvent traffic into an ActionFrequency with five 200ms buckets: the newest bucket is compared against the short-term limit of 4 and the full window against the normal limit of 15, with TickTask lag division before the comparison. A plain shift-click with an empty cursor counts 1.0 via getAmountWithAction. The check also carries the container-interaction path: any click landing within the 155ms min-interaction-duration default after the container opened adds a violation of (155 / duration) * 100. Slot -999 outside-window throws are excluded entirely, so the Drop mode's throws never count.\n\nThe stock Sigma configuration sits just under the rate limits: 100ms per item is 10 clicks per second, or 2 per bucket, below both the short-term 4 and the window 15, so a default-delay drain passes the rate paths. Hypixel mode changes that: two clicks per item at 20 per second blows the 15 window (roughly 5 VL per click, cancel at vl>150 in about 1.5 seconds) and touches the 4-per-bucket short-term limit. The interact_time path is the most reliable hit because the First Delay default of 0 lands the first click within a frame of the chest opening, deep inside the 155ms window, worth close to 100 VL on its own. The honest gap is the delay dial: raising Delay to 4 ticks or more puts the rate back under both windows.

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 watches PlayerMoveEvent traffic while an inventory window is open. checkOnMove skips duplicate packets, vehicles, creative quickbar clicks, merchants and velocity-affected moves, then decides whether the move carries an impulse: with modern input it reads the WASD/jump bits directly, otherwise it falls back to the movement model's hasImpulse decision. An impulse while open feeds Improbable and returns true, and the caller force-closes the inventory, resetting inventoryOpenTime and containerInteractTime.\n\nThe module does not suppress movement, so any strafing or stepping during a drain is visible to the check and a single impulse move mid-steal closes the chest and aborts the session. The practical tension is that chest stealers stand still by design, so a careful user never trips it; the check still matters because it resets the very timestamps FastClick's interact_time path reads, wiping the open-time baseline the module's instant first click is measured against. ChestAura's own motion, walking between chests, happens while no window is open and is invisible to this check.

anticheat InventoryActions (window state mismatch)

InventoryActions.java60 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.interaction.inventory;
20
21
/*
22
 * InventoryActions check originally written by Havesta; modified, split apart, and implemented into Hawk by Islandscout
23
 *
24
 * InventoryActions checks if a player is
25
 * - interacting with entities/blocks while inventory is opened
26
 */
27
28
import me.islandscout.hawk.HawkPlayer;
29
import me.islandscout.hawk.check.CustomCheck;
30
import me.islandscout.hawk.event.*;
31
32
public class InventoryActions extends CustomCheck {
33
34
    public InventoryActions() {
35
        super("inventoryactions", true, 3, 5, 0.999, 5000, "%player% failed inventory-actions, VL: %vl%", null);
36
    }
37
38
    @Override
39
    protected void check(Event e) {
40
        HawkPlayer pp = e.getHawkPlayer();
41
42
        //player tried to interact with entities/world while an inventory window is open
43
        if(pp.hasInventoryOpen() != 0 && (e instanceof InteractEntityEvent || e instanceof BlockDigEvent ||
44
                e instanceof ArmSwingEvent || e instanceof InteractWorldEvent)) {
45
            punish(pp, true, e);
46
            e.resync();
47
            //TODO After failing several times, there's a chance that they could be legit, but the inventory state is glitched. Close the player's inventory.
48
        }
49
50
        //player tried to interact with inventory while it is closed
51
        else if(pp.hasInventoryOpen() == 0 && e instanceof ClickInventoryEvent) {
52
            //TODO also check that window ID makes sense with the window type (eg. ID 0 must mean hasInventoryOpen() == 0)
53
            punish(pp, true, e);
54
            e.resync();
55
        }
56
        else {
57
            reward(pp);
58
        }
59
    }
60
}

How it counteracts this module

Hawk's InventoryActions punishes world interaction while a window is open and, more importantly for stealers, punishes ClickInventoryEvent packets when HawkPlayer.hasInventoryOpen() is zero. Hawk derives the open state from the S2D window-open, C16 inventory command and close packets, so it tracks the same window lifecycle the server sees, not the client's GUI state, and every punish calls e.resync().\n\nThe module's close path is the race surface: mc.thePlayer.closeScreen emits C0D the moment the client-side view looks empty, but if the server-side close is processed later, or if a stale S30 refresh armed the loop for a window Hawk already considers closed, the client can emit a C0E for a window Hawk sees as closed, and that click is punished and resynced. The world-interaction branch is the other edge: ChestAura swings and right-clicks while walking between chests, and any InteractEntity, BlockDig, ArmSwing or InteractWorld event while the window flag is non-zero is punished, so a close that races the next chest open turns into a resync. The check is content-blind and window-id aware, so randomized delays change nothing.

anticheat FastConsume (eat-duration; silent for stealers)

FastConsume.java28 lines · Java
1
package me.vrekt.arc.check.inventory;
2
3
import me.vrekt.arc.Arc;
4
import me.vrekt.arc.check.Check;
5
import me.vrekt.arc.check.CheckType;
6
import me.vrekt.arc.data.inventory.InventoryData;
7
import org.bukkit.entity.Player;
8
9
public class FastConsume extends Check {
10
11
    private int consumeTime = 0;
12
13
    public FastConsume() {
14
        super(CheckType.FASTCONSUME);
15
16
        consumeTime = Arc.getCheckManager().getValueInt(CheckType.FASTCONSUME, "consume-time");
17
    }
18
19
    public boolean check(Player player, InventoryData data) {
20
21
        long now = System.currentTimeMillis();
22
        long last = data.getConsumeTime();
23
        long total = now - last;
24
25
        // check if the time it took to consume the item is less than allowed.
26
        return total < consumeTime && checkViolation(player, "consume time less than allowed.");
27
    }
28
}

How it counteracts this module

Arc v2's FastConsume guards the item-use path of the inventory family. The inventory listener stamps a consume time on the right-click of an edible or potion, and the check compares it against the consume-time limit (1280ms default) when PlayerItemConsumeEvent fires, flagging any consume that completes faster than a real eat could. The mechanism only engages when a consume event actually lands, which requires the full vanilla use duration to elapse.\n\nFor a chest stealer the check is silent by design: shift-click C0E traffic and C08 chest opens never produce a consume event, so FastConsume stays quiet through an entire drain, and the -999 throws are equally invisible to it. The entry belongs in this set because the same C0E corpus pools the eat-rate checks with the click-rate checks, and it documents the boundary honestly: the inventory family's real pressure on this module is FastClick's click ledger, while FastConsume is the guard for the instant-consume sibling modules (AutoSoup and AutoEat), which would trip it on any server that processes eats immediately.

← Back to Analysis Hub