Sigma 4.11 AutoSoup module 2 files, 115 lines

Sigma 4.11 AutoSoup: Full Source Analysis

Sigma 4.11's AutoSoup is a health-gated soup eater built around a single windowClick swap.

info/sigmaclient/module/impl/combat/AutoSoup.java · GitHub source ↗

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

Analysis

Overview

Sigma 4.11's AutoSoup is a health-gated soup eater built around a single windowClick swap. When health drops below the HEALTH setting (default 3) and the timer allows, it locates mushroom stew (item id 282) anywhere in the player's inventory container, swaps it into hotbar slot 6 with a mode-2 windowClick against window 0, then sends C09(6), C08 use with the now-held stew, and C09 back to the real slot - all in one event. The windowClick emits a C0EPacketClickWindow even though no GUI is ever opened, which is the defining fingerprint of this implementation and the hook Hawk's InventoryActions and NCP's window-state checks use against it. The Timer gate is never reset, so after the first tick the delay check passes on every update while the health condition holds, making the module eat at the full 20-cycle-per-second rate.

Swap-click routing

getSoupFromInventory scans container slots 1 to 44, matching item id 282 (mushroom stew), and returns the last match found. The module then calls swap(soupSlot, 6), which is PlayerControllerMP.windowClick(0, slot, 6, 2): window id 0 (the player's own inventory container), button 6, mode 2, which is the swap-with-hotbar action. The server sees this as a C0EPacketClickWindow moving the stew from wherever it sat into hotbar slot 6. C09(6) then selects that hotbar slot, C08 uses the now-current stew stack, and a second C09 restores the player's real held slot. The whole sequence happens inside one pre-update event, so all four packets (C0E, C09, C08, C09) arrive in the same tick.

The dead delay

The Timer gate is delay(DELAY) with DELAY defaulting to 350ms, but AutoSoup never calls timer.reset() and the Timer field's prevMS is never updated by any other code path. delay() computes getTime() - prevMS, and with prevMS frozen at its constructor-time nanoTime-derived value, the elapsed time exceeds any setting within milliseconds of module construction. The result: once the health condition holds and soup exists, the eat cycle runs on every single update event - roughly 20 cycles per second - regardless of the configured delay. The DROP setting is equally inert: it is registered in the settings map but never read in the event handler, so the 'Drop soup after use' toggle does nothing in this build.

Wire fingerprint

Each cycle emits, in one tick: C0EPacketClickWindow (window 0, slot = soup's container slot, button 6, mode 2), C09PacketHeldItemChange(6), C08PacketPlayerBlockPlacement with the current (stew) stack, and C09PacketHeldItemChange(real slot). The C0E is sent with the inventory closed - no C16 or C0D window traffic precedes it - and no C07 release ever follows the use, so on vanilla servers the 32-tick use window never completes and the eat is server-side a no-op. The C0E-with-closed-inventory combination is the module's tell, and the same-tick C09/C08/C09 burst is what the switch checks measure.

source AutoSoup.java

AutoSoup.java84 lines · JavaOriginal ↗
1
/**
2
 * Time: 12:16:54 AM
3
 * Date: Dec 26, 2016
4
 * Creator: cool1
5
 */
6
package info.sigmaclient.module.impl.combat;
7
8
import info.sigmaclient.event.Event;
9
import info.sigmaclient.module.data.ModuleData;
10
import info.sigmaclient.util.Timer;
11
import info.sigmaclient.event.RegisterEvent;
12
import info.sigmaclient.event.impl.EventUpdate;
13
import info.sigmaclient.module.Module;
14
import info.sigmaclient.module.data.Setting;
15
import net.minecraft.client.Minecraft;
16
import net.minecraft.item.Item;
17
import net.minecraft.item.ItemStack;
18
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
19
import net.minecraft.network.play.client.C09PacketHeldItemChange;
20
21
/**
22
 * @author cool1
23
 */
24
public class AutoSoup extends Module {
25
26
    Timer timer = new Timer();
27
    public static String DELAY = "DELAY";
28
    public static String HEALTH = "HEALTH";
29
    public String DROP = "DROP";
30
31
    /**
32
     * @param data
33
     */
34
    public AutoSoup(ModuleData data) {
35
        super(data);
36
        settings.put(HEALTH, new Setting(HEALTH, 3, "Maximum health before healing."));
37
        settings.put(DELAY, new Setting(DELAY, 350, "Delay before healing again.", 50, 100, 1000));
38
        settings.put(DROP, new Setting(DROP, false, "Drop soup after use."));
39
    }
40
41
    /*
42
     * (non-Javadoc)
43
     *
44
     * @see EventListener#onEvent(Event)
45
     */
46
    @Override
47
    @RegisterEvent(events = {EventUpdate.class})
48
    public void onEvent(Event event) {
49
        if (event instanceof EventUpdate) {
50
            EventUpdate em = (EventUpdate) event;
51
            if (em.isPre()) {
52
                int soupSlot = getSoupFromInventory();
53
                if (soupSlot != -1 && mc.thePlayer.getHealth() < ((Number) settings.get(HEALTH).getValue()).floatValue()
54
                        && timer.delay(((Number) settings.get(DELAY).getValue()).floatValue())) {
55
                    swap(getSoupFromInventory(), 6);
56
                    mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(6));
57
                    mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));
58
                    mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
59
                }
60
            }
61
        }
62
    }
63
64
    protected void swap(int slot, int hotbarNum) {
65
        mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, hotbarNum, 2, mc.thePlayer);
66
    }
67
68
    public static int getSoupFromInventory() {
69
        Minecraft mc = Minecraft.getMinecraft();
70
        int soup = -1;
71
        int counter = 0;
72
        for (int i = 1; i < 45; i++) {
73
            if (mc.thePlayer.inventoryContainer.getSlot(i).getHasStack()) {
74
                ItemStack is = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
75
                Item item = is.getItem();
76
                if (Item.getIdFromItem(item) == 282) {
77
                    counter++;
78
                    soup = i;
79
                }
80
            }
81
        }
82
        return soup;
83
    }
84
}

What this file does

The module is a single @RegisterEvent handler on EventUpdate that acts only on the pre phase. Lines 52-59 are the whole eat cycle: find soup, check the health gate and the timer, swap the stew into hotbar slot 6 with windowClick, then queue C09(6), C08(use current item), C09(real slot) straight through the net handler. swap (lines 64-66) is the one-liner that produces the C0E: windowClick with mode 2 and hotbar button 6 against window 0, called directly with no GuiScreen involved.\n\nThe dead pieces are the analysis's key details. The Timer (line 26) is constructed once and never reset anywhere in the module, so the 350ms DELAY default is never enforced and the gate is open on every update after the first milliseconds. The DROP setting (line 29, registered at line 38) is never read in onEvent, making the drop toggle cosmetic. getSoupFromInventory (lines 68-83) matches item id 282 and returns the last soup in scan order, and its -1 return value means 'no soup', which the handler checks before doing anything. onDisable is absent, so mid-cycle disables leave the slot state wherever the last event left it.

source Timer.java (delay gate)

Timer.java31 lines · JavaOriginal ↗
1
package info.sigmaclient.util;
2
3
public class Timer {
4
5
    private long prevMS;
6
7
    public Timer() {
8
        this.prevMS = 0L;
9
    }
10
11
    public boolean delay(float milliSec) {
12
        return (float) (getTime() - this.prevMS) >= milliSec;
13
    }
14
15
    public void reset() {
16
        this.prevMS = getTime();
17
    }
18
19
    public long getTime() {
20
        return System.nanoTime() / 1000000L;
21
    }
22
23
    public long getDifference() {
24
        return getTime() - this.prevMS;
25
    }
26
27
    public void setDifference(long difference) {
28
        this.prevMS = (getTime() - difference);
29
    }
30
31
}

What this file does

Sigma's Timer is a monotonic millisecond clock: getTime() reads System.nanoTime() divided by 1e6, so it is immune to wall-clock adjustments, and delay(milliSec) returns whether the elapsed time since prevMS is at least the argument. reset() re-anchors prevMS to the current instant.\n\nAutoSoup's flaw is that it calls delay() but never reset(): prevMS stays at the constructor-time value forever, so the elapsed time grows monotonically and delay() returns true on every call once the module has been alive for longer than the configured setting. The Timer class itself is correct - getDifference and setDifference expose the elapsed and re-anchor operations - but the module never uses them, which is why the 350ms default is decorative. The same Timer class is shared across Sigma modules; the ones that reset properly (AutoPot among them) get the configured pacing, while AutoSoup does not.

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 InventoryActions (click without an open window)

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 two patterns: world interaction (InteractEntity, BlockDig, ArmSwing, InteractWorld) while HawkPlayer.hasInventoryOpen() is non-zero, and a ClickInventoryEvent while it is zero. Hawk tracks the open state from the S2D window-open and C16 inventory-command packets, so a chest or the player inventory screen being open moves the flag off zero, and CloseInventoryEvent clears it.\n\nSigma's swap() fires windowClick(0, soupSlot, 6, 2) with no GUI ever opened and no C16 preceding it, so the click arrives while Hawk's open state is zero and is punished, with the event resynced to re-sync the container contents. Because the module eats at 20 cycles per second (the dead timer), the check fires on every cycle. This is the direct hit: the C0E window click is exactly the traffic Hawk expects to only ever see from a real open inventory, and the module produces it with the inventory closed.

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 counts C0E inventory clicks into an ActionFrequency with five 200ms buckets, comparing the newest bucket against the short-term limit of 4 and the one-second window against the normal limit of 15, with lag division via TickTask. Each counted click adds its weighted amount via getAmountWithAction; a mode-2 swap with an empty cursor scores 1.0.\n\nSigma's swap produces exactly one counted C0E per eat cycle. Because the timer is never reset, the cycle runs every tick while the health condition holds, so the one-second window accumulates roughly 20 clicks against the 15/s normal limit, pushing fastClickVL up by about 5 per second of sustained eating; the default cancel action at vl > 150 lands after roughly 30 seconds. The short-term bucket path stays quiet at about 4-5 clicks per 200ms bucket. The -999 outside-window drops this module never performs would be exempt (slot < 0 skips counting), but the soup swap is a positive slot, so it counts.

anticheat ItemSwitchSpeed (same-tick switch-back)

ItemSwitchSpeed.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
package me.islandscout.hawk.check.interaction.item;
19
20
import me.islandscout.hawk.HawkPlayer;
21
import me.islandscout.hawk.check.Cancelless;
22
import me.islandscout.hawk.check.CustomCheck;
23
import me.islandscout.hawk.event.Event;
24
import me.islandscout.hawk.event.InteractItemEvent;
25
import me.islandscout.hawk.event.InteractWorldEvent;
26
import me.islandscout.hawk.event.ItemSwitchEvent;
27
import org.bukkit.entity.Player;
28
29
import java.util.*;
30
31
public class ItemSwitchSpeed extends CustomCheck implements Cancelless {
32
33
    private Map<UUID, Long> lastSwitchTicks;
34
    private Set<UUID> usedSomething;
35
    private int MIN_SWITCH_TICKS;
36
37
    //might rename this to "AutoUse"
38
    public ItemSwitchSpeed() {
39
        super("itemswitchspeed", true, -1, 1, 0.999, 5000, "%player% failed item switch speed, VL: %vl%", null);
40
        lastSwitchTicks = new HashMap<>();
41
        usedSomething = new HashSet<>();
42
        MIN_SWITCH_TICKS = (int)customSetting("minSwitchTicks", "", 1);
43
    }
44
45
    //For future reference, if you try to verify that the item-switch packet points to a different slot, beware of falses.
46
    //The client can send item-switch packets regardless if the slot switched or not.
47
48
    @Override
49
    protected void check(Event event) {
50
        if(event instanceof InteractItemEvent || event instanceof InteractWorldEvent) {
51
            usedSomething.add(event.getPlayer().getUniqueId());
52
        }
53
        else if(event instanceof ItemSwitchEvent) {
54
55
            HawkPlayer pp = event.getHawkPlayer();
56
            UUID uuid = pp.getUuid();
57
58
            if(usedSomething.contains(uuid)) {
59
                long lastSwitchTick = lastSwitchTicks.getOrDefault(uuid, 0L);
60
                if(pp.getCurrentTick() - lastSwitchTick < MIN_SWITCH_TICKS) {
61
                    punish(pp, 1, false, event);
62
                }
63
                else {
64
                    reward(pp);
65
                }
66
67
                usedSomething.remove(uuid);
68
            }
69
70
            lastSwitchTicks.put(pp.getUuid(), pp.getCurrentTick());
71
        }
72
    }
73
74
    @Override
75
    public void removeData(Player p) {
76
        UUID uuid = p.getUniqueId();
77
        lastSwitchTicks.remove(uuid);
78
        usedSomething.remove(uuid);
79
    }
80
}

How it counteracts this module

Hawk's ItemSwitchSpeed marks a player as having used something on InteractItemEvent or InteractWorldEvent, then checks the next ItemSwitchEvent against the stored lastSwitchTick, punishing when the gap is under minSwitchTicks (default 1).\n\nSigma queues C09(6), the C08 use, and C09(real slot) all within one event, so the switch-back ItemSwitchEvent arrives in the same tick as the C08 that armed usedSomething: the delta is 0 ticks, under the default minimum of 1, so every cycle is punished. This is the opposite of Rise 5.99's AutoSoup, which deliberately delays its switch-back by a full tick to pass the same check; Sigma's same-tick restore is the configuration ItemSwitchSpeed was written to catch. The check also never sees a legitimate reason for a slot to change in the same tick an item was used, so there is no reward path.

anticheat FastConsume (consume duration, conditional)

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 stamps InventoryData.consumeTime on a RIGHT_CLICK_AIR or RIGHT_CLICK_BLOCK with an edible item and flags a PlayerItemConsumeEvent that arrives within consume-time (default 1280ms) of that stamp, with the violation message 'consume time less than allowed.'\n\nSigma's C08 use is followed by C09(real slot) in the same tick, and no C07 release is ever sent, so the item use is aborted by the slot switch on vanilla servers and no consume event fires - the check stays silent there, and the module genuinely fails to eat on vanilla. On soup servers that complete consumption from the use packet itself, the consume event lands within milliseconds of the stamp and the check fires. The dead-timer eating rate does not change this path: FastConsume measures the gap between use and consume, not the cycle rate, so its applicability is purely a function of the server's soup mechanics.

← Back to Analysis Hub