Tenacity 6.0 ResetVL module 2 files, 156 lines

Tenacity 6.0 ResetVL: Full Source Analysis

Tenacity's ResetVL is a bounded hop-and-timer burst that runs for exactly 25 ground hops and switches itself off.

dev/tenacity/module/impl/exploit/ResetVL.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-10-14

Packets This Module Uses

Analysis

Overview

Tenacity's ResetVL is a bounded hop-and-timer burst that runs for exactly 25 ground hops and switches itself off. While the counter is under 25, every on-ground tick sets motionY to 0.11, re-pins the client's Y to the position captured at enable, and drives the vanilla tick multiplier to 2.25, so the client executes 2.25 ticks per real tick and every tick-driven outgoing cadence compresses to 2.25 times its real-time rate. The server sees rapid, small vertical moves at an accelerated rate. The movement stream it integrates runs faster than real time, and the keepalive echo (C00) and its latency measurement ride the same accelerated clock. After 25 hops the multiplier returns to 1 and the module toggles itself off; onDisable restores the static Timer.timerSpeed regardless of where the burst stopped.

Architecture

The module keeps two fields: jumped, the hop counter, and y, the altitude captured in onEnable. The single MotionEvent listener runs the whole loop, and the module toggles itself off from inside its own listener after the 25th hop, an unusual self-disable pattern. onEnable resets the counter and captures the current Y; onDisable restores the static Timer.timerSpeed to 1 so a manual toggle-off never leaves the multiplier applied.

Hop-and-pin loop

While on the ground with jumped at or below 25, each tick sets motionY = 0.11 (a small hop impulse), increments the counter, and re-pins posY to the enable-time Y. The net client-side motion is a vertical oscillation around a fixed altitude: hop up 0.11 velocity, get pulled back to the pin, hop again. The server sees the corresponding stream of small vertical moves: legible, plausible movement, but arriving at an accelerated cadence.

Timer acceleration

The loop drives mc.timer.timerSpeed to 2.25. The vanilla Timer.updateTimer accumulates elapsedPartialTicks += d2 * timerSpeed * ticksPerSecond (capped at 10 elapsed ticks), so 2.25 means the client runs 2.25 game ticks per real tick: every tick-driven send compresses to 2.25 times its real-time rate, and the movement packets the server integrates arrive faster than real time. The keepalive echo is the protocol's timing anchor: the C00 round trip is what server latency ledgers are keyed to, so the accelerated client clock shows up in the timing model even though the module itself never constructs a packet. Note that the module writes the instance field through mc.timer in the loop and the static Timer.timerSpeed in onDisable, the same static field in vanilla 1.8.9.

Teardown

After 25 hops the branch sets timerSpeed back to 1 and calls toggle(), turning the module off from within its own event handler. onDisable then runs as part of that toggle and re-asserts timerSpeed = 1 through the static reference, so the multiplier is restored exactly once per burst. The bounded design is deliberate: 25 hops at 2.25x is roughly eleven real seconds of accelerated movement, after which the client returns to a normal clock and the server's rate windows see the burst as a bounded anomaly rather than a sustained one.

source ResetVL.java

ResetVL.java48 lines · JavaOriginal ↗
1
package dev.tenacity.module.impl.exploit;
2
3
import dev.tenacity.event.IEventListener;
4
import dev.tenacity.module.ModuleCategory;
5
import dev.tenacity.module.Module;
6
import dev.tenacity.event.impl.player.MotionEvent;
7
import dev.tenacity.util.misc.ChatUtil;
8
import dev.tenacity.util.player.MovementUtil;
9
import net.minecraft.util.Timer;
10
11
public final class ResetVL extends Module {
12
13
    private int jumped;
14
    private double y;
15
16
    public ResetVL() {
17
        super("ResetVL", "Unflags you on servers", ModuleCategory.EXPLOIT);
18
    }
19
20
    private final IEventListener<MotionEvent> onMotion = e -> {
21
        if (mc.thePlayer.onGround) {
22
            if (jumped <= 25) {
23
                mc.thePlayer.motionY = 0.11;
24
                jumped++;
25
            }
26
        }
27
        if (jumped <= 25) {
28
            mc.thePlayer.posY = y;
29
            mc.timer.timerSpeed = 2.25f;
30
        } else {
31
            mc.timer.timerSpeed = 1;
32
            toggle();
33
        }
34
    };
35
36
    @Override
37
    public void onEnable() {
38
        jumped = 0;
39
        y = mc.thePlayer.posY;
40
        super.onEnable();
41
    }
42
43
    @Override
44
    public void onDisable() {
45
        Timer.timerSpeed = 1f;
46
        super.onDisable();
47
    }
48
}

What this file does

The whole module: the jumped counter and captured y, the onEnable capture, and the MotionEvent listener that runs the hop-and-pin loop, drives timerSpeed to 2.25, and toggles itself off after 25 hops. The onDisable override restores the static Timer.timerSpeed to 1. The module constructs no packets of its own; its entire effect is the accelerated client clock and the vertical oscillation the movement path then serializes.

source Timer.java (vanilla tick multiplier)

Timer.java108 lines · JavaOriginal ↗
1
package net.minecraft.util;
2
3
import net.minecraft.client.Minecraft;
4
5
public class Timer
6
{
7
    /** The number of timer ticks per second of real time */
8
    float ticksPerSecond;
9
10
    /**
11
     * The time reported by the high-resolution clock at the last call of updateTimer(), in seconds
12
     */
13
    private double lastHRTime;
14
15
    /**
16
     * How many full ticks have turned over since the last call to updateTimer(), capped at 10.
17
     */
18
    public int elapsedTicks;
19
20
    /**
21
     * How much time has elapsed since the last tick, in ticks, for use by display rendering routines (range: 0.0 -
22
     * 1.0).  This field is frozen if the display is paused to eliminate jitter.
23
     */
24
    public float renderPartialTicks;
25
26
    /**
27
     * A multiplier to make the timer (and therefore the game) go faster or slower.  0.5 makes the game run at half-
28
     * speed.
29
     */
30
    public static float timerSpeed = 1.0F;
31
32
    /**
33
     * How much time has elapsed since the last tick, in ticks (range: 0.0 - 1.0).
34
     */
35
    public float elapsedPartialTicks;
36
37
    /**
38
     * The time reported by the system clock at the last sync, in milliseconds
39
     */
40
    private long lastSyncSysClock;
41
42
    /**
43
     * The time reported by the high-resolution clock at the last sync, in milliseconds
44
     */
45
    private long lastSyncHRClock;
46
    private long field_74285_i;
47
48
    /**
49
     * A ratio used to sync the high-resolution clock to the system clock, updated once per second
50
     */
51
    private double timeSyncAdjustment = 1.0D;
52
53
    public Timer(float p_i1018_1_)
54
    {
55
        this.ticksPerSecond = p_i1018_1_;
56
        this.lastSyncSysClock = Minecraft.getSystemTime();
57
        this.lastSyncHRClock = System.nanoTime() / 1000000L;
58
    }
59
60
    /**
61
     * Updates all fields of the Timer using the current time
62
     */
63
    public void updateTimer()
64
    {
65
        long i = Minecraft.getSystemTime();
66
        long j = i - this.lastSyncSysClock;
67
        long k = System.nanoTime() / 1000000L;
68
        double d0 = (double)k / 1000.0D;
69
70
        if (j <= 1000L && j >= 0L)
71
        {
72
            this.field_74285_i += j;
73
74
            if (this.field_74285_i > 1000L)
75
            {
76
                long l = k - this.lastSyncHRClock;
77
                double d1 = (double)this.field_74285_i / (double)l;
78
                this.timeSyncAdjustment += (d1 - this.timeSyncAdjustment) * 0.20000000298023224D;
79
                this.lastSyncHRClock = k;
80
                this.field_74285_i = 0L;
81
            }
82
83
            if (this.field_74285_i < 0L)
84
            {
85
                this.lastSyncHRClock = k;
86
            }
87
        }
88
        else
89
        {
90
            this.lastHRTime = d0;
91
        }
92
93
        this.lastSyncSysClock = i;
94
        double d2 = (d0 - this.lastHRTime) * this.timeSyncAdjustment;
95
        this.lastHRTime = d0;
96
        d2 = MathHelper.clamp_double(d2, 0.0D, 1.0D);
97
        this.elapsedPartialTicks = (float)((double)this.elapsedPartialTicks + d2 * (double)this.timerSpeed * (double)this.ticksPerSecond);
98
        this.elapsedTicks = (int)this.elapsedPartialTicks;
99
        this.elapsedPartialTicks -= (float)this.elapsedTicks;
100
101
        if (this.elapsedTicks > 10)
102
        {
103
            this.elapsedTicks = 10;
104
        }
105
106
        this.renderPartialTicks = this.elapsedPartialTicks;
107
    }
108
}

What this file does

The vanilla timer the module drives. updateTimer folds the real-time delta d2 through the static timerSpeed and ticksPerSecond into elapsedPartialTicks, then elapsedTicks = (int) elapsedPartialTicks, so timerSpeed 2.25 makes the client run 2.25 game ticks per real tick, capped at 10 elapsed ticks per frame. Every tick-driven send (the movement C03 stream, and the keepalive path) inherits that cadence, which is why the module needs no packet code: the multiplier does the work. The field is static in 1.8.9, which is why ResetVL's onDisable can write Timer.timerSpeed directly.

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

NoCheatPlus's MorePackets scores every serverbound move packet into morePacketsFreq and compares the window against cc.morePacketsEPSMax, default 22 packets per second (ideal 20), with a half-second burst path (default 15 packets) and lag adaption, returning the morePacketsSetBack location on violation.\n\nAt 2.25x the moving client emits ~45 move packets per second (twice the ceiling), and because the hop loop keeps the player moving, the elevated rate holds for the entire ~11-second burst, so the window accumulator stays positive and the set-back fires mid-burst. The check is content-blind, so the small hop deltas and the pinned Y contribute nothing toward leniency; the only relief is the bounded design, which ends the burst before a long run of flagged windows accumulates. The set-back itself is what the 25-hop limit is racing.

anticheat MorePackets (per-second packet rate)

MorePackets.java49 lines · Java
1
package me.vrekt.arc.check.moving;
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.moving.MovingData;
7
import org.bukkit.Bukkit;
8
import org.bukkit.ChatColor;
9
import org.bukkit.entity.Player;
10
11
public class MorePackets extends Check {
12
13
    private int maxPackets, kickThreshold = 0;
14
15
    public MorePackets() {
16
        super(CheckType.MOREPACKETS);
17
18
        maxPackets = Arc.getCheckManager().getValueInt(CheckType.MOREPACKETS, "max-packets");
19
        kickThreshold = Arc.getCheckManager().getValueInt(CheckType.MOREPACKETS, "max-packets-kick");
20
    }
21
22
    public boolean check(Player player, MovingData data) {
23
24
        int flyingPackets = data.getFlyingPackets();
25
        int movingPackets = data.getPositionPackets();
26
27
        // check if we are sending more packets then allowed.
28
        if (flyingPackets > maxPackets || movingPackets > maxPackets) {
29
            checkViolation(player, "sending too many packets");
30
            if (flyingPackets > kickThreshold || movingPackets > kickThreshold) {
31
                // we are sending over the limit, kick.
32
                Bukkit.getScheduler().runTaskLater(Arc.getPlugin(), () -> {
33
                    // broadcast to staff.
34
                    Bukkit.broadcast(ChatColor.DARK_GRAY + "[" + ChatColor.RED + "Arc" + ChatColor.DARK_GRAY + "] " + ChatColor.BLUE
35
                            + player.getName() + ChatColor.WHITE + " was kicked for sending too many packets. ", "arc.violations");
36
                    // prevent async player kick.
37
                    player.kickPlayer("You are sending too many packets.");
38
                }, 5);
39
                return false;
40
            }
41
            data.setCancelMovingPackets(true);
42
            return true;
43
        }
44
45
        data.setCancelMovingPackets(false);
46
        return false;
47
    }
48
49
}

How it counteracts this module

Vrekt's MorePackets counts flying and position packets per second against max-packets 30 and max-packets-kick 70. Exceeding 30/s triggers a violation and cancels movement packets; exceeding 70/s schedules a broadcast and a kick.\n\nAt 2.25x the accelerated client sits at roughly 45 move packets per second (inside the kick threshold but above the violation threshold), so the check flags and starts cancelling movement packets for the whole burst, which quietly removes the hop stream the module needs to look legitimate. The 30/s line is the real counter: the module's own hop cadence at 2.25x cannot stay under it. The kick line is the safety margin the bounded 25-hop design stays below, which is why the check cancels rather than bans the burst.

anticheat TickRate (inter-move clock drift)

TickRate.java147 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.tick;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.MovementCheck;
23
import me.islandscout.hawk.event.MoveEvent;
24
import me.islandscout.hawk.util.MathPlus;
25
import org.bukkit.ChatColor;
26
import org.bukkit.Location;
27
import org.bukkit.entity.Player;
28
import org.bukkit.event.EventHandler;
29
import org.bukkit.event.EventPriority;
30
import org.bukkit.event.Listener;
31
import org.bukkit.event.player.PlayerChangedWorldEvent;
32
import org.bukkit.event.player.PlayerTeleportEvent;
33
34
import java.util.*;
35
36
/**
37
 * The Tickrate check enforces a limit to clients' tickrates.
38
 * Minecraft runs at 20 TPS, and some of the server logic for
39
 * each player is dependent on their PacketPlayInFlying rates
40
 * (eg: health regeneration, status effect, item consuming
41
 * duration). Hackers can exploit this by modifying the tickrate
42
 * of their client, thus creating cheats such as "instant"
43
 * regeneration or eating, movement speed, "lag-switching",
44
 * anti-potion, etc. Tickrate just alerts and prevents this.
45
 * It can detect at least a 3% increase in tickrate frequency
46
 * almost immediately under default settings.
47
 */
48
public class TickRate extends MovementCheck implements Listener {
49
50
    private final Map<UUID, Long> prevNanoTime;
51
    private final Map<UUID, Long> clockDrift;
52
    private final Map<UUID, Long> lastBigTeleportTime;
53
    private final boolean DEBUG;
54
    private final double THRESHOLD;
55
    private final long MAX_CATCHUP_TIME;
56
    private final double MIN_RATE;
57
    private final double MAX_RATE;
58
    private final boolean RUBBERBAND;
59
    private final int WARM_UP;
60
61
    public TickRate() {
62
        super("tickrate", true, 10, 50, 0.995, 10000, "%player% failed tickrate. VL: %vl%, ping: %ping%, TPS: %tps%", null);
63
        prevNanoTime = new HashMap<>();
64
        clockDrift = new HashMap<>();
65
        lastBigTeleportTime = new HashMap<>();
66
        THRESHOLD = -(int) customSetting("clockDriftThresholdMillis", "", 50);
67
        MAX_CATCHUP_TIME = 1000000 * (int) customSetting("maxCatchupTimeMillis", "", 2000);
68
        DEBUG = (boolean) customSetting("debug", "", false);
69
        MIN_RATE = (50 - (50 / (double)customSetting("minRateMultiplier", "", 0.999))) / 1E-6;
70
        MAX_RATE = (50 - (50 / (double)customSetting("maxRateMultiplier", "", 1.005))) / 1E-6;
71
        RUBBERBAND = (boolean)customSetting("rubberband", "", true);
72
        WARM_UP = (int)customSetting("ignoreTicksAfterLongTeleport", "", 150) - 1;
73
    }
74
75
    @Override
76
    protected void check(MoveEvent event) {
77
78
        if(event.isTeleportAccept())
79
            return;
80
81
        Player p = event.getPlayer();
82
        HawkPlayer pp = event.getHawkPlayer();
83
84
        long time = System.nanoTime();
85
        if (!prevNanoTime.containsKey(p.getUniqueId())) {
86
            prevNanoTime.put(p.getUniqueId(), time);
87
            return;
88
        }
89
        long timeElapsed = time - prevNanoTime.get(p.getUniqueId());
90
        prevNanoTime.put(p.getUniqueId(), time);
91
92
        if (pp.getCurrentTick() - lastBigTeleportTime.getOrDefault(p.getUniqueId(), 0L) < WARM_UP) {
93
            if(DEBUG)
94
                p.sendMessage(ChatColor.GRAY + "Tickrate check warming up. Please wait a moment...");
95
            clockDrift.put(p.getUniqueId(), 0L);
96
            return;
97
        }
98
99
        //if drift > 0, then player's clock is behind
100
        //if drift < 0, then player's clock is ahead
101
        //Debug messages have drift multiplied by -1 so,
102
        //drift > 0: clock is ahead
103
        //drift < 0: clock is behind
104
        long drift = clockDrift.getOrDefault(p.getUniqueId(), 0L);
105
        long delta = timeElapsed - 50000000L;
106
        drift += delta;
107
        if (drift > MAX_CATCHUP_TIME)
108
            drift = MAX_CATCHUP_TIME;
109
        if (DEBUG) {
110
            double msOffset = drift * 1E-6;
111
            p.sendMessage((msOffset < 0 ? (msOffset < THRESHOLD ? ChatColor.RED : ChatColor.YELLOW) : ChatColor.BLUE) + "CLOCK DRIFT: " + MathPlus.round(-msOffset, 2) + "ms");
112
        }
113
        if (drift * 1E-6 < THRESHOLD) {
114
            if(RUBBERBAND && pp.getCurrentTick() - pp.getLastTeleportAcceptTick() > 20) //Don't rubberband so often. You're already cancelling a ton of moves. TODO use real system time to actually stop teleport spam?
115
                punishAndTryRubberband(pp, event);
116
            else
117
                punish(pp, true, event);
118
            drift = (long) (THRESHOLD / 1E-6);
119
        } else
120
            reward(pp);
121
        if (drift < 0)
122
            drift = (long) Math.min(0, drift + MAX_RATE);
123
        else
124
            drift = (long) Math.max(0, drift + MIN_RATE);
125
        clockDrift.put(p.getUniqueId(), drift);
126
    }
127
128
    @Override
129
    public void removeData(Player p) {
130
        prevNanoTime.remove(p.getUniqueId());
131
        clockDrift.remove(p.getUniqueId());
132
        lastBigTeleportTime.remove(p.getUniqueId());
133
    }
134
135
    @EventHandler(priority = EventPriority.MONITOR)
136
    public void onWorldChange(PlayerChangedWorldEvent e) {
137
        lastBigTeleportTime.put(e.getPlayer().getUniqueId(), hawk.getHawkPlayer(e.getPlayer()).getCurrentTick());
138
    }
139
140
    @EventHandler(priority = EventPriority.MONITOR)
141
    public void onTeleport(PlayerTeleportEvent e) {
142
        Location loc = e.getTo();
143
        if(!loc.getWorld().isChunkLoaded(loc.getBlockX() >> 4, loc.getBlockZ() >> 4)) {
144
            lastBigTeleportTime.put(e.getPlayer().getUniqueId(), hawk.getHawkPlayer(e.getPlayer()).getCurrentTick());
145
        }
146
    }
147
}

How it counteracts this module

Hawk's TickRate measures real time between MoveEvents. Each move adds (timeElapsed - 50ms) to a per-player clock-drift accumulator; drift below the -50ms threshold (clockDriftThresholdMillis) punishes with a rubber-band, and per-move MIN_RATE/MAX_RATE clamps (50/0.999 and 50/1.005 millisecond adjustments) keep the accumulator from unbounded growth. A 2000ms catch-up cap absorbs lag spikes, and a 150-tick warm-up after big teleports prevents post-teleport falses.\n\nAt 2.25x, moves arrive every ~22ms instead of 50ms, so each move subtracts ~28ms from the drift; after two or three hops the accumulator crosses the -50ms threshold and the check punishes with a rubber-band, which resets the client position mid-burst. The catch-up and warm-up windows are the module's only cover: a lag spike that stretches inter-move gaps can repay the drift, and the burst after a teleport is ignored, but a sustained 2.25x hop loop in open ground has no such cover.

anticheat Timer (player-clock balance)

Timer.java113 lines · Java
1
package ac.grim.grimac.checks.impl.timer;
2
3
import ac.grim.grimac.api.config.ConfigManager;
4
import ac.grim.grimac.checks.Check;
5
import ac.grim.grimac.checks.CheckData;
6
import ac.grim.grimac.checks.type.PrePredictionPacketReceiveListener;
7
import ac.grim.grimac.player.GrimPlayer;
8
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
9
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
10
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
11
import org.jetbrains.annotations.NotNull;
12
13
@CheckData(name = "Timer", stableKey = "grim.timer.timer", configName = "TimerA", description = "The players game is running faster than normal", setback = 10)
14
public class Timer extends Check implements PrePredictionPacketReceiveListener {
15
    protected long timerBalanceRealTime = 0;
16
17
    // Default value is real time minus max keep-alive time
18
    protected long knownPlayerClockTime = (long) (System.nanoTime() - 6e10);
19
    protected long lastMovementPlayerClock = (long) (System.nanoTime() - 6e10);
20
21
    // How long should the player be able to fall back behind their ping? (nanos)
22
    // Default: 120 milliseconds
23
    protected long clockDrift;
24
25
    protected boolean hasGottenMovementAfterTransaction = false;
26
27
    // Proof for this timer check
28
    // https://i.imgur.com/Hk2Wb6c.png
29
    //
30
    // The largest gap will always be the transaction ping (server -> client -> server)
31
    // Proof lies that client -> server ping will always be lower
32
    //
33
    // The largest gap is the floor for movements
34
    // If the smaller gap surpasses the larger gap, the player is cheating
35
    //
36
    // This usually flags 1.01 on low ping extremely quickly
37
    // Higher ping/low fps scales proportionately, and will flag less quickly but will still always flag 1.01
38
    // Players standing still will reset this amount of time
39
    //
40
    // This is better than traditional timer checks because ping fluctuations will never affect this check
41
    // As we are tying this check to the player's ping, rather than real time.
42
    //
43
    // Tested 10/20/30 fps and f3 + t spamming for lag spikes at 0 ping localhost/200 ping clumsy, no falses
44
    // Also didn't false when going from 0 -> 2000 ms ping, and 2000 ms -> 0 ms ping
45
    // it's a very nice check, in my opinion.  I guess I will find out if netty lag can false it
46
47
    // You might notice that we deviate a bit from this to handle lag
48
    // We take the FIRST transaction after each movement, to avoid issues with this packet order at low FPS:
49
    // TRANSACTION TRANSACTION TRANSACTION MOVEMENT MOVEMENT MOVEMENT
50
    // TRANSACTION TRANSACTION TRANSACTION MOVEMENT MOVEMENT MOVEMENT
51
    //
52
    // We then take the last transaction before this to increase stability with these lag spikes and
53
    // to guarantee that we are at least 50 ms back before adding the time
54
    public Timer(GrimPlayer player) {
55
        super(player);
56
    }
57
58
    @Override
59
    public void onPrePredictionPacketReceive(final PacketReceiveEvent event) {
60
        if (hasGottenMovementAfterTransaction && checkForTransaction(event.getPacketType())) {
61
            knownPlayerClockTime = lastMovementPlayerClock;
62
            lastMovementPlayerClock = player.getPlayerClockAtLeast();
63
            hasGottenMovementAfterTransaction = false;
64
        }
65
66
        if (!shouldCountPacketForTimer(event.getPacketType())) return;
67
68
        hasGottenMovementAfterTransaction = true;
69
        timerBalanceRealTime += 50e6;
70
71
        doCheck(event);
72
    }
73
74
    public void doCheck(final PacketReceiveEvent event) {
75
        if (timerBalanceRealTime > System.nanoTime()) {
76
            if (flag()) {
77
                // Cancel the packet
78
                if (shouldModifyPackets()) {
79
                    event.setCancelled(true);
80
                    player.onPacketCancel();
81
                }
82
83
                if (shouldSetback()) {
84
                    player.getSetbackTeleportUtil().executeNonSimulatingSetback();
85
                }
86
            }
87
88
            // Reset the violation by 1 movement
89
            timerBalanceRealTime -= 50e6;
90
        }
91
92
        limitFallBehind();
93
    }
94
95
    protected void limitFallBehind() {
96
        timerBalanceRealTime = Math.max(timerBalanceRealTime, lastMovementPlayerClock - clockDrift);
97
    }
98
99
    public boolean checkForTransaction(PacketTypeCommon packetType) {
100
        return packetType == PacketType.Play.Client.PONG ||
101
                packetType == PacketType.Play.Client.WINDOW_CONFIRMATION;
102
    }
103
104
    public boolean shouldCountPacketForTimer(PacketTypeCommon packetType) {
105
        // If not flying, or this was a teleport, or this was a duplicate 1.17 mojang stupidity packet
106
        return isTickPacket(packetType);
107
    }
108
109
    @Override
110
    public void onReload(@NotNull ConfigManager config) {
111
        clockDrift = (long) (config.getDoubleElse(getConfigName() + ".drift", 120.0) * 1e6);
112
    }
113
}

How it counteracts this module

Grim's Timer adds 50ms of player-clock balance per counted tick packet and flags whenever the balance outruns System.nanoTime, anchored to the player's ping through C0F transactions and PONG so ping fluctuation cannot false it. The check's own notes state it flags a 1.01 multiplier almost immediately on low ping.\n\nAt 2.25x the client emits 2.25 tick packets per 50ms of real time, so the balance gains 112.5ms per 50ms tick. The clock leads by ~62.5ms per tick and the check flags within the first few ticks of the burst, cancelling the offending packets and executing a non-simulating setback. The 25-hop cap means the burst is over before a long violation string accumulates, but the setback itself lands mid-burst and the cancelled packets already broke the hop rhythm the module needs.

← Back to Analysis Hub