Sigma 4.11 AutoEat module 2 files, 130 lines

Sigma 4.11 AutoEat: Full Source Analysis

Sigma's AutoEat is a one-shot eater that routes through the hotbar instead of the inventory window.

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

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

Analysis

Overview

Sigma's AutoEat is a one-shot eater that routes through the hotbar instead of the inventory window. On every EventUpdate, when a hotbar slot holds an ItemFood, the player's food level is below twice the LEVEL setting (default 8.5, so an integer threshold of 16 out of 20), and the player is collided vertically, it queues C09PacketHeldItemChange to the food slot, C08PacketPlayerBlockPlacement with the food stack (the use-item constructor), 32 positionless C03PacketPlayer(false) packets, then calls stopUsingItem() locally and queues C09 back to the previously held slot. There is no timer gate: the whole sequence re-fires every tick while the condition holds, so the packet flood is the module's true fingerprint.

The eat sequence

The C08 uses the single-argument ItemStack constructor, which serializes the use-item form (origin position, face 255) so the server starts an item use with the food in hand; the two C09 packets bracket it, switching to the food slot and back inside the same tick. The 32 C03s are positionless with onGround false, so they only flip the ground flag. stopUsingItem() is called directly on the entity, bypassing PlayerControllerMP.onStoppedUsingItem, so no C07 release packet is emitted: the server-side use simply runs its fixed 32-tick timer and completes the eat on its own schedule.

Routing family

AutoEat is the C09-routed member of Sigma's eater family. The sibling AutoSoup routes through the inventory window instead: its swap() calls playerController.windowClick(0, slot, 6, 2), the mode-2 swap-with-hotbar click that emits one C0EPacketClickWindow, then C09(6), C08(current item) and C09(restore). AutoEat drops the window click entirely and addresses the food slot directly with C09, which changes the countering surface completely: no window clicks means the window-click rate checks never see it, and the same-tick C09 pair becomes the tell.

Cadence and server-side reality

The gate re-arms every tick because nothing in the handler records a fire time: as long as the food level sits below 16 and the player stands on ground, each EventUpdate queues the full C09, C08, 32x C03, C09 sequence, so a single eat episode sustains roughly 32 C03s per tick for the duration of the server-side 32-tick use. The server-side eat cannot actually be accelerated: the use completes on the fixed 32-tick item-in-use timer regardless of the client's packets, so the module's observable effect is the flood and the slot pair, not a faster heal.

source AutoEat.java

AutoEat.java46 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.Setting;
9
import net.minecraft.item.ItemFood;
10
import net.minecraft.network.play.client.C03PacketPlayer;
11
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
12
import net.minecraft.network.play.client.C09PacketHeldItemChange;
13
14
public class AutoEat extends Module {
15
16
    private String FOODLEVEL = "LEVEL";
17
18
    public AutoEat(ModuleData data) {
19
        super(data);
20
        settings.put(FOODLEVEL, new Setting<>(FOODLEVEL, 8.5, "Food level to eat at.", 0.5, 0, 10));
21
    }
22
23
    @RegisterEvent(events = {EventUpdate.class})
24
    public void onEvent(Event event) {
25
        int foodSlot = getFoodSlotInHotbar();
26
        int eatFood = ((Number) settings.get(FOODLEVEL).getValue()).intValue();
27
        if ((foodSlot != -1) && (mc.thePlayer.getFoodStats().getFoodLevel() < eatFood * 2.0D) && (mc.thePlayer.isCollidedVertically)) {
28
            mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(foodSlot));
29
            mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.mainInventory[foodSlot]));
30
            for (int i = 0; i < 32; i++) {
31
                mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(false));
32
            }
33
            mc.thePlayer.stopUsingItem();
34
            mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
35
        }
36
    }
37
38
    private int getFoodSlotInHotbar() {
39
        for (int i = 0; i < 9; i++) {
40
            if ((mc.thePlayer.inventory.mainInventory[i] != null) && (mc.thePlayer.inventory.mainInventory[i].getItem() != null) && ((mc.thePlayer.inventory.mainInventory[i].getItem() instanceof ItemFood))) {
41
                return i;
42
            }
43
        }
44
        return -1;
45
    }
46
}

What this file does

The module file is the full sequence: getFoodSlotInHotbar scans slots 0-8 for the first ItemFood, the gate combines the food level threshold (twice the LEVEL setting, integer-truncated) with isCollidedVertically, and the body queues C09(food), C08(stack), 32x C03(false), stopUsingItem() and C09(restore) in one EventUpdate. The C08 uses the ItemStack constructor, the use-item form that starts a server-side item use without a block target.

The absence of any Timer or cooldown field is the key fact: the handler re-fires every tick while the gate holds, so the 32-packet flood repeats per tick rather than per eat. The LEVEL setting is the only configuration, and the intValue() truncation turns the 8.5 default into the 16-of-20 threshold.

source AutoSoup.java (sibling routing contrast)

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

AutoSoup is the sibling eater that chose the other routing mechanism: swap() calls playerController.windowClick(0, slot, 6, 2), which emits one C0EPacketClickWindow per cycle to move the soup into hotbar slot 6, then C09(6), C08(current item) and C09(restore). The contrast is the whole point of the file for this analysis: AutoEat and AutoSoup do the same job, but the C0E window click versus the direct C09 switch changes which anticheat checks can see them.

The file also carries the family's dead pieces: the Timer is delay-gated but never reset, so after construction-time milliseconds elapse the gate returns true every tick and the module cycles at roughly 20/s regardless of the 350ms DELAY default, and the DROP setting is registered but never read. AutoEat's handler has no such latch, but the same dead-setting pattern appears as the CLICKSPEED constant in the sibling FastPlace.

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 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

ItemSwitchSpeed punishes a held-slot change that follows an item-use interaction too closely: after an InteractWorldEvent or InteractItemEvent arms the usedSomething flag, a C09 arriving with currentTick minus lastSwitchTick below minSwitchTicks (default 1) is punished. Hawk's own packet listener raises those interaction events from the serverbound C08 stream, so the module's direct C08 send arms the check regardless of the client-side call path.

AutoEat sends both C09s in the same tick as the C08: the switch to the food slot and the restore both land at a delta of 0 ticks from the interaction, below the 1-tick minimum, so every cycle is punished. This is the same verdict the C09-routed eaters get on Hawk: same-tick restore is the losing pattern, while a one-tick-delayed restore would scrape by at the default threshold. The module's choice to restore in the same EventUpdate is what makes the check decisive.

anticheat MorePackets (movement packet rate)

MorePackets.java127 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.moving.player;
16
17
import java.util.ArrayList;
18
import java.util.List;
19
20
import org.bukkit.Location;
21
import org.bukkit.entity.Player;
22
23
import fr.neatmonster.nocheatplus.actions.ParameterName;
24
import fr.neatmonster.nocheatplus.checks.Check;
25
import fr.neatmonster.nocheatplus.checks.CheckType;
26
import fr.neatmonster.nocheatplus.checks.ViolationData;
27
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
28
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
29
import fr.neatmonster.nocheatplus.checks.net.NetStatic;
30
import fr.neatmonster.nocheatplus.players.IPlayerData;
31
import fr.neatmonster.nocheatplus.utilities.StringUtil;
32
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
33
34
/**
35
 * The MorePackets check will try to identify players that send more than the usual
36
 * amount of move-packets to the server to be able to move faster than normal, without getting caught by the other
37
 * checks (flying/running).
38
 */
39
public class MorePackets extends Check {
40
41
    private final List<String> tags = new ArrayList<String>();
42
43
    /**
44
     * Instantiates a new more packets check.
45
     */
46
    public MorePackets() {
47
        super(CheckType.MOVING_MOREPACKETS);
48
    }
49
50
    /**
51
     * Check for speeding by sending too many packets. We assume 22 packets per
52
     * second to be legitimate, while 20 would be ideal. See
53
     * PlayerData.morePacketsFreq for the monitored amount of time and the
54
     * resolution. See NetStatic for the actual check code.
55
     * 
56
     * @param player
57
     * @param from
58
     * @param to
59
     * @param allowSetSetBack
60
     *            If to allow setting the set back location.
61
     * @param data
62
     * @param cc
63
     * @return
64
     */
65
    public Location check(final Player player, final PlayerLocation from, final PlayerLocation to, 
66
            final boolean allowSetSetBack, final MovingData data, final MovingConfig cc,
67
            final IPlayerData pData) {
68
        // Take time once, first:
69
        final long time = System.currentTimeMillis();
70
        final boolean debug = pData.isDebugActive(type);
71
72
        //    	if (from.isSamePos(to)) {
73
        //    		// Ignore moves with "just look" for now.
74
        //    		// TODO: Extra ActionFrequency for "just look" + use to burn, maybe also check individually.
75
        //    		return null;
76
        //    	}
77
78
        // Ensure we have a set back location.
79
        if (allowSetSetBack && !data.hasMorePacketsSetBack()){
80
            // TODO: Check if other set back is appropriate or if to set/reset on other events.
81
            if (data.hasSetBack()) {
82
                data.setMorePacketsSetBackFromSurvivalfly();
83
            }
84
            else {
85
                data.setMorePacketsSetBack(from);
86
            }
87
        }
88
89
        // Check for a violation of the set limits.
90
        tags.clear();
91
        final double violation = NetStatic.morePacketsCheck(data.morePacketsFreq, time, 1f, cc.morePacketsEPSMax, cc.morePacketsEPSIdeal, data.morePacketsBurstFreq, cc.morePacketsBurstPackets, cc.morePacketsBurstDirect, cc.morePacketsBurstEPM, tags);
92
93
        // Process violation result.
94
        if (violation > 0.0) {
95
            // Increment violation level.
96
            data.morePacketsVL = violation; // TODO: Accumulate somehow [e.g. always += 1, decrease with continuous moving without violation]?
97
98
            // Violation handling.
99
            final ViolationData vd = new ViolationData(this, player, data.morePacketsVL, violation, cc.morePacketsActions);
100
            if (debug || vd.needsParameters()) {
101
                vd.setParameter(ParameterName.PACKETS, Integer.toString(new Double(violation).intValue()));
102
                vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
103
            }
104
            if (executeActions(vd).willCancel()) {
105
                // Set to cancel the move.
106
                /*
107
                 * TODO: Harmonize with MovingUtil.getApplicableSetBackLocation
108
                 * (somehow include the desired set back type / loc / context).
109
                 */
110
                return data.hasMorePacketsSetBack() ? data.getMorePacketsSetBack() : data.getSetBack(to); // TODO
111
            }
112
        } 
113
        else if (allowSetSetBack && data.getMorePacketsSetBackAge() > cc.morePacketsSetBackAge) {
114
            // Update the set back location. (CHANGED to only update, if not a violation.)
115
            // (Might update whenever newTo == null)
116
            data.setMorePacketsSetBack(from);
117
            if (debug) {
118
                debug(player, "Update set back (morepackets) to from.");
119
            }
120
        }
121
122
        // No set back.
123
        return null;
124
125
    }
126
127
}

How it counteracts this module

MorePackets scores every processed movement packet into 500ms buckets against a 22-per-second window with a half-second burst path at 15 packets and a direct-violation threshold of 10. AutoEat's 32 positionless C03s arrive in a single tick, so the newest bucket scores 32 against a direct threshold of 10: the violation fires on the first eat tick, and because the sequence re-fires every tick while the food level is low, the window accumulator stays pinned at several times the ceiling for the whole episode.

Positionless packets count identically to position-bearing ones, so the flood cannot hide by omitting coordinates. On any server running the check with its default actions this is a self-kick configuration: the module produces more packet rate in one tick than the burst path allows, independent of the movement it claims.

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

FastConsume is Arc v2's consume-duration ledger: it stamps consumeTime on the right-click use of an edible item and fails when the PlayerItemConsumeEvent arrives within consume-time (1280ms), the signature of an instant-consumption client. On a vanilla 1.8 server the eat completes on the fixed 32-tick use timer, about 1600ms, so the consume event lands after the 1280ms window and the check stays silent; the module's local stopUsingItem() changes nothing server-side because it emits no packet.

The gap is conditional by design: the check bites exactly on the instant-consumption server model, which is the environment these eaters are built for, and stays silent on vanilla pacing. For AutoEat the honest reading is that FastConsume cannot score the module on a stock server, and the module's real exposure is the packet flood the other two checks read.

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

FastClick is NCP's window-click rate check: it scores C0E click traffic through ActionFrequency windows (a 15-per-second normal window and tighter short-term buckets) and is invoked from the inventory listener on every click packet. AutoEat never sends a C0E: the food slot is addressed with C09 held-slot changes, so no window click ever reaches the ledger and the check is structurally blind to the module.

The miss is a documented property of the C09-routed eater family, the same reason the C0E-swapping sibling AutoSoup trips FastClick while AutoEat does not. The distinction belongs in the countering picture because it decides which of the two Sigma eaters a given server setup actually catches: window-click rate for AutoSoup, slot-switch timing and packet flood for AutoEat.

← Back to Analysis Hub