Rise 5.99 Stealer module 2 files, 393 lines

Rise 5.99 Stealer: Full Source Analysis

Rise 5.99's Stealer empties chests through the vanilla container protocol: it waits for the S30PacketWindowItems content refresh, pauses a randomized delay, then shift-clicks one item at a time…

dev/rise/module/impl/player/Stealer.java · GitHub source ↗

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

Analysis

Overview

Rise 5.99's Stealer empties chests through the vanilla container protocol: it waits for the S30PacketWindowItems content refresh, pauses a randomized delay, then shift-clicks one item at a time with C0EPacketClickWindow (mode 1, button 0) against the chest window id. The delay is redrawn from the min/max settings after every steal, the whitelist keeps junk in the chest unless the trash toggle is on, and Auto Close releases the GUI once the client-side view is empty. The module also publishes three static flags that a GUI mixin consumes: hide the chest screen, allow mouse look inside the chest, and close after the container empties.

Steal loop and delay drawing

onRender2DEvent drives the loop. On the first frame inside a chest, decidedTimer is drawn with RandomUtils.nextInt(floor(min), ceil(max)); both delay settings default to 5ms over a 0-1000ms range with 25ms increments, so the stock configuration drains a double chest in under a second. When the timer has reached the draw, the module walks chest.inventorySlots in order and shift-clicks the first whitelisted stack via windowClick(chest.windowId, i, 0, 1), then resets the timer and redraws the delay from the same distribution. One item per draw, one C0E per item, and the draw is fresh for every steal, which is the module's answer to click-rate checks: the rate is bounded by the delay settings, not by the render loop.

Whitelist and the inverted trash toggle

itemWhitelisted accepts potions whose metadata effect id is in {6, 1, 5, 8, 14, 12, 10, 16} (instant health, speed, strength, jump boost, invisibility, fire resistance, regeneration, night vision), any block item except TNT, slime and falling blocks, plus anvils, swords, armor, tools, food, skulls and any stack whose display name contains a section-sign color code. A ten-entry material list adds ender pearls, iron and gold ingots, redstone, diamonds, emeralds, quartz, bows, arrows and fishing rods; the spider-eye exclusion only guards that list because && binds tighter than ||. The 'Steal trash items' toggle is inverted: the steal condition requires itemWhitelisted(stack) AND NOT the toggle, so enabling it makes the predicate false for every stack and the module stops stealing entirely.

GUI cooperation and close

onPreMotion recenters and re-grabs the mouse while a chest GUI is up (mouseInput and hideGui both default on), which releases the vanilla grab so the player can look around inside the chest; the static hideChestGui and allowMouseInput flags are consumed by code outside this file, and closeAfterContainer is declared but only ever cleared here. gotItems is armed by any S30PacketWindowItems and by every steal, ticksInChest counts time inside the GUI, and autoClose calls closeScreen() once the client-side view is empty (gotItems or more than 10 ticks). Both packet handlers and the steal loop bail for the first 60 ticks after spawn, and the world-change handler can auto-disable the module.

source Stealer.java

Stealer.java243 lines · JavaOriginal ↗
1
/*
2
 Copyright Alan Wood 2021
3
 None of this code to be reused without my written permission
4
 Intellectual Rights owned by Alan Wood
5
 */
6
package dev.rise.module.impl.player;
7
8
import dev.rise.event.impl.motion.PreMotionEvent;
9
import dev.rise.event.impl.other.WorldChangedEvent;
10
import dev.rise.event.impl.packet.PacketReceiveEvent;
11
import dev.rise.event.impl.render.Render2DEvent;
12
import dev.rise.font.CustomFont;
13
import dev.rise.font.fontrenderer.TTFFontRenderer;
14
import dev.rise.module.Module;
15
import dev.rise.module.api.ModuleInfo;
16
import dev.rise.module.enums.Category;
17
import dev.rise.setting.impl.BooleanSetting;
18
import dev.rise.setting.impl.NumberSetting;
19
import dev.rise.util.math.TimeUtil;
20
import dev.rise.util.render.theme.ThemeType;
21
import dev.rise.util.render.theme.ThemeUtil;
22
import net.minecraft.block.BlockFalling;
23
import net.minecraft.block.BlockSlime;
24
import net.minecraft.block.BlockTNT;
25
import net.minecraft.client.gui.ScaledResolution;
26
import net.minecraft.client.gui.inventory.GuiChest;
27
import net.minecraft.init.Items;
28
import net.minecraft.inventory.ContainerChest;
29
import net.minecraft.item.*;
30
import net.minecraft.network.play.server.S30PacketWindowItems;
31
import org.apache.commons.lang3.RandomUtils;
32
import org.lwjgl.input.Keyboard;
33
import org.lwjgl.opengl.Display;
34
35
import java.util.ArrayList;
36
37
@ModuleInfo(name = "Stealer", description = "Steals items from chests", category = Category.PLAYER)
38
public final class Stealer extends Module {
39
40
    private final TimeUtil timer = new TimeUtil();
41
    private final TimeUtil startTimer = new TimeUtil();
42
43
    private final NumberSetting minDelay = new NumberSetting("Min Delay", this, 5, 0, 1000, 25);
44
    private final NumberSetting maxDelay = new NumberSetting("Max Delay", this, 5, 0, 1000, 25);
45
    private final BooleanSetting stealTrashItems = new BooleanSetting("Steal trash items", this, false);
46
    private final BooleanSetting autoClose = new BooleanSetting("Auto Close", this, true);
47
    private final BooleanSetting hideGui = new BooleanSetting("Hide Gui", this, true);
48
    private final BooleanSetting mouseInput = new BooleanSetting("Move head in chest", this, true);
49
    private final BooleanSetting chestName = new BooleanSetting("Check chest name", this, false);
50
    private final BooleanSetting disableOnWorldChange = new BooleanSetting("Disable on World Change", this, false);
51
52
    private int decidedTimer = 0;
53
54
    public static boolean hideChestGui, allowMouseInput, closeAfterContainer;
55
56
    private boolean gotItems;
57
    private final static TTFFontRenderer comfortaa = CustomFont.FONT_MANAGER.getFont("Comfortaa 18");
58
    private int ticksInChest;
59
60
    private boolean lastInChest;
61
62
    @Override
63
    protected void onDisable() {
64
        closeAfterContainer = false;
65
        allowMouseInput = false;
66
        hideChestGui = false;
67
        gotItems = false;
68
    }
69
70
    @Override
71
    public void onPacketReceive(final PacketReceiveEvent event) {
72
        if (mc.thePlayer.ticksExisted <= 60) return;
73
74
        if (event.getPacket() instanceof S30PacketWindowItems) {
75
            gotItems = true;
76
        }
77
    }
78
79
    @Override
80
    public void onPreMotion(final PreMotionEvent event) {
81
        if (mc.thePlayer.ticksExisted <= 60) return;
82
        if (mc.currentScreen instanceof GuiChest && Display.isVisible() && mouseInput.isEnabled() && hideGui.isEnabled() && (!chestName.isEnabled() || (((GuiChest) mc.currentScreen).lowerChestInventory.getDisplayName().getUnformattedText().contains("chest")))) {
83
            mc.mouseHelper.centerMouse();
84
            mc.mouseHelper.mouseGrab(false);
85
            mc.mouseHelper.mouseGrab(true);
86
        }
87
88
        if (mc.currentScreen instanceof GuiChest) {
89
            ticksInChest++;
90
91
            if (ticksInChest * 50 > 255) {
92
                ticksInChest = 10;
93
            }
94
        } else {
95
            ticksInChest--;
96
            gotItems = false;
97
            if (ticksInChest < 0) {
98
                ticksInChest = 0;
99
            }
100
        }
101
    }
102
103
    @Override
104
    public void onRender2DEvent(final Render2DEvent event) {
105
        if (mc.thePlayer.ticksExisted <= 60) return;
106
        if (!lastInChest) startTimer.reset();
107
        lastInChest = mc.currentScreen instanceof GuiChest;
108
109
        if (mc.currentScreen instanceof GuiChest) {
110
            if (hideGui.isEnabled()) {
111
                hideChestGui = true;
112
            }
113
114
            if (mouseInput.isEnabled()) {
115
                allowMouseInput = true;
116
            }
117
118
            if (chestName.isEnabled()) {
119
                final String name = ((GuiChest) mc.currentScreen).lowerChestInventory.getDisplayName().getUnformattedText();
120
121
                if (!name.toLowerCase().contains("chest")) return;
122
            }
123
124
            if (hideGui.isEnabled()) {
125
                final ScaledResolution SR = new ScaledResolution(mc);
126
                final String t = "Stealing chest... Press " + Keyboard.getKeyName(mc.gameSettings.keyBindInventory.getKeyCode()) + " to close the chest";
127
                int o;
128
129
                o = ticksInChest * 50;
130
131
                if (o > 255)
132
                    o = 255;
133
134
                comfortaa.drawStringWithShadow(t, SR.getScaledWidth() / 2f - comfortaa.getWidth(t) / 2f, SR.getScaledHeight() - 80, ThemeUtil.getThemeColorInt(ThemeType.GENERAL));
135
            }
136
137
            if (decidedTimer == 0) {
138
                final int delayFirst = (int) Math.floor(Math.min(minDelay.getValue(), maxDelay.getValue()));
139
                final int delaySecond = (int) Math.ceil(Math.max(minDelay.getValue(), maxDelay.getValue()));
140
                decidedTimer = RandomUtils.nextInt(delayFirst, delaySecond);
141
            }
142
143
            if (timer.hasReached(decidedTimer)) {
144
                final ContainerChest chest = (ContainerChest) mc.thePlayer.openContainer;
145
146
                for (int i = 0; i < chest.inventorySlots.size(); i++) {
147
                    final ItemStack stack = chest.getLowerChestInventory().getStackInSlot(i);
148
                    if (stack != null && (itemWhitelisted(stack) && !stealTrashItems.isEnabled())) {
149
                        mc.playerController.windowClick(chest.windowId, i, 0, 1, mc.thePlayer);
150
                        timer.reset();
151
152
                        final int delayFirst = (int) Math.floor(Math.min(minDelay.getValue(), maxDelay.getValue()));
153
                        final int delaySecond = (int) Math.ceil(Math.max(minDelay.getValue(), maxDelay.getValue()));
154
155
                        decidedTimer = RandomUtils.nextInt(delayFirst, delaySecond);
156
157
                        gotItems = true;
158
                        return;
159
                    }
160
                }
161
162
                if (autoClose.isEnabled() && (gotItems || ticksInChest > 10)) {
163
                    mc.thePlayer.closeScreen();
164
                }
165
            }
166
        } else {
167
            hideChestGui = false;
168
            allowMouseInput = false;
169
        }
170
    }
171
172
    @Override
173
    public void onWorldChanged(final WorldChangedEvent event) {
174
        if (disableOnWorldChange.isEnabled()) {
175
            this.toggleModule();
176
            this.registerNotification("Disabled " + this.getModuleInfo().name() + " due to world change.");
177
        }
178
    }
179
    private boolean itemWhitelisted(final ItemStack itemStack) {
180
        final ArrayList<Item> whitelistedItems = new ArrayList<Item>() {{
181
            add(Items.ender_pearl);
182
            add(Items.iron_ingot);
183
            add(Items.gold_ingot);
184
            add(Items.redstone);
185
            add(Items.diamond);
186
            add(Items.emerald);
187
            add(Items.quartz);
188
            add(Items.bow);
189
            add(Items.arrow);
190
            add(Items.fishing_rod);
191
        }};
192
193
        final Item item = itemStack.getItem();
194
        final String itemName = itemStack.getDisplayName();
195
196
        if (itemName.contains("Right Click") || itemName.contains("Click to Use") || itemName.contains("Players Finder"))
197
            return true;
198
199
        final ArrayList<Integer> whitelistedPotions = new ArrayList<Integer>() {{
200
            add(6);
201
            add(1);
202
            add(5);
203
            add(8);
204
            add(14);
205
            add(12);
206
            add(10);
207
            add(16);
208
        }};
209
210
        if (item instanceof ItemPotion) {
211
            final int potionID = getPotionId(itemStack);
212
            return whitelistedPotions.contains(potionID);
213
        }
214
215
        return (item instanceof ItemBlock
216
                && !(((ItemBlock) item).getBlock() instanceof BlockTNT)
217
                && !(((ItemBlock) item).getBlock() instanceof BlockSlime)
218
                && !(((ItemBlock) item).getBlock() instanceof BlockFalling))
219
                || item instanceof ItemAnvilBlock
220
                || item instanceof ItemSword
221
                || item instanceof ItemArmor
222
                || item instanceof ItemTool
223
                || item instanceof ItemFood
224
                || item instanceof ItemSkull
225
                || itemName.contains("\247")
226
                || whitelistedItems.contains(item)
227
                && !item.equals(Items.spider_eye);
228
    }
229
230
    private int getPotionId(final ItemStack potion) {
231
        final Item item = potion.getItem();
232
233
        try {
234
            if (item instanceof ItemPotion) {
235
                final ItemPotion p = (ItemPotion) item;
236
                return p.getEffects(potion.getMetadata()).get(0).getPotionID();
237
            }
238
        } catch (final NullPointerException ignored) {
239
        }
240
241
        return 0;
242
    }
243
}

What this file does

The steal loop lives entirely in onRender2DEvent, with onPreMotion handling mouse release and the screen-fade counter, onPacketReceive arming gotItems from S30PacketWindowItems, and onWorldChanged providing the auto-disable. The container interaction is a single line: windowClick(chest.windowId, i, 0, 1) is the vanilla shift-click, which the server applies as a MOVE_TO_OTHER_INVENTORY action on the chest window. The whitelist is a mixture of item-class checks, potion metadata effects and display-name scans, all re-evaluated per candidate stack.

The static flags are the module's contract with the rest of the client: hideChestGui and allowMouseInput tell a mixin to suppress the chest screen and free the mouse, which is what makes the steal look like normal play instead of a locked GUI session. The inverted trash toggle is a genuine logic bug: with the setting on, the predicate (whitelisted AND NOT enabled) is always false, so nothing is ever stolen. The delay pair defaults to 5ms/5ms, which at stock settings turns a chest drain into a sub-second burst.

source TimeUtil.java (steal timing)

TimeUtil.java150 lines · JavaOriginal ↗
1
package dev.rise.util.math;
2
3
4
import store.intent.hwid.HWID;
5
6
import javax.net.ssl.HttpsURLConnection;
7
import java.io.BufferedReader;
8
import java.io.InputStreamReader;
9
import java.net.URL;
10
import java.util.ArrayList;
11
12
/**
13
 * TimeHelper, used to time stuff using real life time, like killaura cps
14
 *
15
 * @author Alan
16
 * @since 13/02/2021
17
 */
18
19
public final class TimeUtil {
20
21
    public long lastMS = 0L;
22
23
    /**
24
     * Devides 1000 / d
25
     */
26
    public int convertToMS(final int d) {
27
        return 1000 / d;
28
    }
29
30
    /***
31
     * Gets current system time
32
     */
33
    public long getCurrentMS() {
34
        return System.nanoTime() / 1000000L;
35
    }
36
37
    public long getElapsedTime() {
38
        return System.currentTimeMillis() - this.lastMS;
39
    }
40
41
    /***
42
     * Checks if a timer has reached an amount of time
43
     */
44
    public boolean hasReached(final long milliseconds) {
45
        return getCurrentMS() - lastMS >= milliseconds;
46
    }
47
48
    /***
49
     * Gets the current amount of time that has passed since last reset
50
     */
51
    public long getDelay() {
52
        return System.currentTimeMillis() - lastMS;
53
    }
54
55
    /***
56
     * Resets timer
57
     */
58
    public void reset() {
59
        lastMS = getCurrentMS();
60
    }
61
62
    /***
63
     * Tbh I skidded this from intent and don't remember what this does
64
     */
65
    public void setLastMS() {
66
        lastMS = System.currentTimeMillis();
67
    }
68
69
    /***
70
     * Tbh I skidded this from intent and don't remember what this does
71
     */
72
    public void setLastMS(final long lastMS) {
73
        this.lastMS = lastMS;
74
    }
75
76
    public static String lmfao() {
77
        try {
78
            final String xd = new String(new char[]{'h', 't', 't', 'p', 's', ':', '/', '/', 'i', 'n', 't', 'e', 'n', 't', '.', 's', 't', 'o', 'r', 'e', '/', 'p', 'r', 'o', 'd', 'u', 'c', 't', '/', '2', '5', '/', 'w', 'h', 'i', 't', 'e', 'l', 'i', 's', 't', '?', 'h', 'w', 'i', 'd', '='});
79
            final String xd2 = new String(new char[]{'U', 's', 'e', 'r', '-', 'A', 'g', 'e', 'n', 't'});
80
            final String xd3 = new String(new char[]{'M', 'o', 'z', 'i', 'l', 'l', 'a', '/', '5', '.', '0', ' ', '(', 'W', 'i', 'n', 'd', 'o', 'w', 's', ' ', 'N', 'T', ' ', '6', '.', '1', ';', ' ', 'W', 'O', 'W', '6', '4', ';', ' ', 'r', 'v', ':', '2', '5', '.', '0', ')', ' ', 'G', 'e', 'c', 'k', 'o', '/', '2', '0', '1', '0', '0', '1', '0', '1', ' ', 'F', 'i', 'r', 'e', 'f', 'o', 'x', '/', '2', '5', '.', '0'});
81
            final String xd4 = new String(new char[]{'琀', '爀', '甀', '攀'});
82
            final String xd5 = new String(new char[]{'昀', '愀', '氀', '猀', '攀'});
83
84
            try {
85
                final HttpsURLConnection connection =
86
                        (HttpsURLConnection) new URL(xd + HWID.getHardwareID())
87
                                .openConnection();
88
89
                connection.addRequestProperty(xd2, xd3);
90
91
92
                final BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
93
94
                String currentln;
95
                final ArrayList<String> response = new ArrayList<>();
96
97
                while ((currentln = in.readLine()) != null) {
98
                    response.add(currentln);
99
                }
100
101
                final StringBuilder fax = new StringBuilder();
102
103
                for (int i = 0; i < xd4.length(); i++) {
104
                    fax.append(Character.reverseBytes(xd4.charAt(i)));
105
                }
106
107
                final StringBuilder notFax = new StringBuilder();
108
109
                for (int i = 0; i < xd5.length(); i++) {
110
                    notFax.append(Character.reverseBytes(xd5.charAt(i)));
111
                }
112
113
                if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
114
                    for (int i = 0; i < 0; i = 2) {
115
                        if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
116
                            for (int g = 0; g < 0; g = 2) {
117
118
                            }
119
                            return null;
120
                        }
121
                    }
122
                    return null;
123
                }
124
                if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
125
                    for (int i = 0; i < 0; i = 2) {
126
127
                    }
128
                    return null;
129
                }
130
                if (!response.contains(fax.toString()) || response.contains(notFax.toString())) {
131
                    for (int i = 0; i < 0; i = 2) {
132
133
                    }
134
                    return null;
135
                }
136
            } catch (final Exception e) {
137
                for (; ; ) {
138
139
                }
140
            }
141
        } catch (final Exception e) {
142
            for (int i = 0; i < 0; i = 2) {
143
144
            }
145
            return null;
146
        }
147
148
        return "Yes";
149
    }
150
}

What this file does

TimeUtil is the module's timing backbone: lastMS anchors the window, reset() re-anchors it, and hasReached(milliseconds) compares the elapsed nanoTime-based time against the argument, so the steal pacing is monotonic and immune to wall-clock jumps. getCurrentMS reads System.nanoTime() divided by 1e6, the same basis as the module's RandomUtils delay draws.

Stealer uses two TimeUtil instances: timer gates the per-item delay and startTimer tracks how long the player has been inside the chest (reset on every frame where the chest was not open the previous frame). The decidedTimer value is drawn once per steal from RandomUtils.nextInt over the floor and ceiling of the two delay settings, so the actual pacing is a uniform random walk within the configured band, which spreads the C0E clicks across the window instead of firing them at a fixed interval.

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 legacy detectTweaks1_5 weighting only kicks in when the cursor already holds a stack, scaling the count down by stack size. The check also carries the container-interaction path: isContainerInteractionRecent compares the latest click against the container open time, and any click landing within the 155ms min-interaction-duration default adds a violation of (155 / duration) * 100.

Stealer's default 5ms delay puts roughly 200 C0E clicks per second into the buckets, or about 40 per bucket, so the short-term limit of 4 is exceeded by an order of magnitude on the first bucket and fastClickVL climbs past the cancel action at vl>150 within the first second of a drain. The randomized delays do not help: even at a generous 100ms average the module still lands 5 clicks per bucket. The interact_time path also fires because the first click usually lands well inside the 155ms window after the chest opens. The whitelist is irrelevant to the check, which is content-blind and counts every shift-click regardless of what was stolen.

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 1.21.1+ 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.

Stealer does not suppress movement: the module only manipulates the container, so any strafing or stepping while the chest GUI is open is visible to the check, and a single impulse move mid-steal closes the chest and aborts the drain. The practical tension is that stealers stand still, so a careful user never trips it; the check still matters because it converts a movement mistake into a lost window, and because it resets the timestamps that FastClick's interact_time path reads, wiping the open-time baseline the module's first-click timing is measured against.

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.

Stealer's Auto Close path calls closeScreen() client-side the moment the viewed contents look empty. If the server-side window close (C0D, or the server's own close) lags behind, or if the S30 refresh that armed gotItems arrived for a stale window id, the client can emit a C0E for a window Hawk already considers closed, and that click is punished with a resync. The world-interaction branch is the other edge: the module's mouse release makes it easy to swing or interact while the chest screen is hidden, and any InteractEntity, BlockDig, ArmSwing or InteractWorld event while the window flag is non-zero is punished and resynced. The check is content-blind and window-id aware, so randomized delays change nothing.

anticheat InventoryMove (rotation while open)

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

How it counteracts this module

Hawk's InventoryMove check runs on MoveEvent and punishes rotation updates, sprinting or sneaking while an inventory is open, with an explicit exclusion for teleport-accept moves. punishAndTryRubberband sends the player back on violation, and the VL decays via reward on clean moves.

This is a direct hit on Stealer's default configuration. The 'Move head in chest' feature (mouseInput) deliberately recenters and re-grabs the mouse every pre-motion so the player can look around inside the chest GUI, which produces exactly the isUpdateRot-with-open-inventory pattern the check is built for: every head turn while the chest is open scores a violation. Sprint and sneak states are equally visible because the module never sends C0B suppression. The check cannot be avoided by the randomized delays, since it keys on rotation and movement state, not click timing; the only safe configuration is mouseInput off and the player holding still.

← Back to Analysis Hub