Tenacity 6.0 TPAura module 2 files, 177 lines

Tenacity 6.0 TPAura: Full Source Analysis

TPAura is a long-range kill aura that attacks the nearest visible player from the client's current position.

dev/tenacity/module/impl/combat/TPAura.java · GitHub source ↗

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

Packets This Module Uses

Analysis

Overview

TPAura is a long-range kill aura that attacks the nearest visible player from the client's current position. Despite the name there is no teleportation in this build: a MotionEvent pre handler rebuilds a target list from every EntityPlayer within the Range setting (8 to 300 blocks, default 50) that canEntityBeSeen returns true for, sorts it by distance, and on a randomized 1 to 25 CPS gate (default 10) swings and sends C02PacketUseEntity ATTACK without ever changing the view direction. The two rotation modes are empty switch cases, so the attack vector is whatever position and facing the vanilla C03 stream last reported; the optional autoblock layer sends C08 (facing 255, BlockPos(-1,-1,-1)) once per block cycle and C07 RELEASE_USE_ITEM to drop it.

Architecture

The module is one MotionEvent pre listener plus an UpdateEvent suffix setter. sortAndAddTargets clears targetList and scans mc.theWorld.getLoadedEntityList each pre-motion, keeping EntityPlayer instances that are within reach, not the local player, visible to canEntityBeSeen, not invisible, and not registered as friends, then sorts by getDistanceToEntity ascending. currentTarget is the first entry and blocking is computed as autoBlock enabled with a sword held and a target present. When the list empties mid-flight the handler only releases a pending block, so the attack machinery never runs without a target.

Attack cadence and the empty rotation modes

The attack branch is gated by rotate and by timerUtil.hasTimeElapsed(1000 / cps, true) where cps is Math.round(MathUtil.getRandomInRange(minimumCPS, maximumCps)) re-rolled on every fire, so each interval is a fresh random value between 40ms at 25 CPS and 1000ms at 1 CPS. Both rotationMode cases ("Nope lol" and "Not needed") are empty switch branches and no yaw or pitch write exists anywhere in the file, so the module attacks with the player's actual view. swingItem and addToSendQueue(C02 ATTACK) are the whole send path; the enchantParticle and criticalParticle settings call onEnchantmentCritical and onCriticalHit, which are client-side visual effects only.

Autoblock and the wire picture

The autoblock state machine is a wasBlocked latch. Vanilla mode sends one C08(new BlockPos(-1,-1,-1), 255, heldItem, 0, 0, 0) when the latch flips, Hurt Time mode waits for hurtTime == 9, and the release C07 (RELEASE_USE_ITEM at BlockPos.ORIGIN, DOWN) fires when hurtTime returns to 0, when the target list empties, or in onDisable. The C02 attacks therefore arrive from the position the vanilla C03 movement stream reports; at default range 50 the server measures hits roughly 50 blocks from the victim with no rotation change preceding them, which is the whole detection surface.

source TPAura.java (module)

TPAura.java150 lines · JavaOriginal ↗
1
package dev.tenacity.module.impl.combat;
2
3
import dev.tenacity.command.impl.FriendCommand;
4
import dev.tenacity.event.IEventListener;
5
import dev.tenacity.event.impl.player.MotionEvent;
6
import dev.tenacity.event.impl.player.UpdateEvent;
7
import dev.tenacity.module.Module;
8
import dev.tenacity.module.ModuleCategory;
9
import dev.tenacity.setting.impl.BooleanSetting;
10
import dev.tenacity.setting.impl.ModeSetting;
11
import dev.tenacity.setting.impl.NumberSetting;
12
import dev.tenacity.util.misc.MathUtil;
13
import dev.tenacity.util.misc.TimerUtil;
14
import dev.tenacity.util.player.RotationUtil;
15
import net.minecraft.entity.EntityLivingBase;
16
import net.minecraft.entity.player.EntityPlayer;
17
import net.minecraft.item.ItemSword;
18
import net.minecraft.network.play.client.C02PacketUseEntity;
19
import net.minecraft.network.play.client.C07PacketPlayerDigging;
20
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
21
import net.minecraft.util.BlockPos;
22
import net.minecraft.util.EnumFacing;
23
24
import java.util.ArrayList;
25
import java.util.Comparator;
26
import java.util.List;
27
28
public final class TPAura extends Module {
29
30
    private EntityLivingBase currentTarget;
31
    private final List<EntityLivingBase> targetList = new ArrayList<>();
32
33
    private final TimerUtil timerUtil = new TimerUtil();
34
35
    private boolean blocking, wasBlocked;
36
37
    private final NumberSetting minimumCPS = new NumberSetting("Minimum CPS", 10, 1, 25, 0.1),
38
            maximumCps = new NumberSetting("Maximum CPS", 10, 1, 25, 0.1),
39
            reach = new NumberSetting("Range", 50, 8, 300, 1);
40
41
    private final BooleanSetting autoBlock = new BooleanSetting("Auto Block", false),
42
            rotate = new BooleanSetting("Rotate", true),
43
            enchantParticle = new BooleanSetting("Enchant Particle", false),
44
            criticalParticle = new BooleanSetting("Critical Particle", false);
45
46
    private final ModeSetting autoBlockMode = new ModeSetting("Auto Block Mode", "Vanilla", "Hurt Time", "Fake"),
47
            rotationMode = new ModeSetting("Rotation Mode", "Nope lol", "Not needed");
48
49
    public TPAura() {
50
        super("TPAura", "Don't HvH people with this :(", ModuleCategory.COMBAT);
51
        initializeSettings(minimumCPS, maximumCps, reach, autoBlock, autoBlockMode, rotate, rotationMode, enchantParticle, criticalParticle);
52
    }
53
54
    private final IEventListener<MotionEvent> onMotionEvent = event -> {
55
        sortAndAddTargets();
56
57
        currentTarget = !targetList.isEmpty() ? targetList.get(0) : null;
58
        blocking = autoBlock.isEnabled() && currentTarget != null && (mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword);
59
        if(currentTarget == null) {
60
            if(event.isPre() && wasBlocked) {
61
                mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
62
                wasBlocked = false;
63
            }
64
            return;
65
        }
66
67
        if(event.isPre()) {
68
            if(rotate.isEnabled()) {
69
                switch (rotationMode.getCurrentMode()) {
70
                    case "Nope lol":
71
                        break;
72
                }
73
                switch (rotationMode.getCurrentMode()) {
74
                    case "Not needed":
75
                        break;
76
                }
77
78
                final long cps = Math.round(MathUtil.getRandomInRange(minimumCPS.getCurrentValue(), maximumCps.getCurrentValue()));
79
                if(timerUtil.hasTimeElapsed(1000 / cps, true)) {
80
81
                    if(enchantParticle.isEnabled())
82
                        mc.thePlayer.onEnchantmentCritical(currentTarget);
83
                    if(criticalParticle.isEnabled())
84
                        mc.thePlayer.onCriticalHit(currentTarget);
85
86
                    mc.thePlayer.swingItem();
87
                    mc.getNetHandler().addToSendQueue(new C02PacketUseEntity(currentTarget, C02PacketUseEntity.Action.ATTACK));
88
                }
89
            }
90
91
            if(blocking) {
92
                switch(autoBlockMode.getCurrentMode()) {
93
                    case "Hurt Time":
94
                        if(event.isPre() && mc.thePlayer.hurtTime == 0 && wasBlocked && !mc.thePlayer.isSwingInProgress) {
95
                            mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
96
                            wasBlocked = false;
97
                        }
98
                        break;
99
                }
100
            }
101
        }
102
103
        if(blocking) {
104
            switch(autoBlockMode.getCurrentMode()) {
105
                case "Vanilla":
106
                    if(!wasBlocked) {
107
                        mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, mc.thePlayer.getHeldItem(), 0, 0, 0));
108
                        wasBlocked = true;
109
                    }
110
                    break;
111
                case "Hurt Time":
112
                    if(mc.thePlayer.hurtTime == 9 && !wasBlocked) {
113
                        mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, mc.thePlayer.getHeldItem(), 0, 0, 0));
114
                        wasBlocked = true;
115
                    }
116
                    break;
117
            }
118
        }
119
    };
120
121
    @Override
122
    public void onDisable() {
123
        if(wasBlocked && !mc.thePlayer.isSwingInProgress)
124
            mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
125
126
        wasBlocked = blocking = false;
127
128
        currentTarget = null;
129
        targetList.clear();
130
131
        super.onDisable();
132
    }
133
134
    private void sortAndAddTargets() {
135
        targetList.clear();
136
        mc.theWorld.getLoadedEntityList().forEach(entity -> {
137
            if(entity instanceof EntityPlayer && mc.thePlayer.getDistanceToEntity(entity) <= reach.getCurrentValue() && entity != mc.thePlayer && mc.thePlayer.canEntityBeSeen(entity) && !entity.isInvisible() && !FriendCommand.isFriend(((EntityPlayer) entity).getName())) {
138
                final EntityPlayer entityPlayer = (EntityPlayer) entity;
139
                targetList.add(entityPlayer);
140
            }
141
        });
142
        targetList.sort(Comparator.comparingDouble(mc.thePlayer::getDistanceToEntity));
143
    }
144
    private final IEventListener<UpdateEvent> onUpdateEvent = event -> {
145
        setSuffix(String.valueOf(reach.getCurrentValue()));
146
    };
147
    public boolean isBlocking() {
148
        return blocking;
149
    }
150
}

What this file does

The module is the onMotionEvent listener plus the target-sorting helper. sortAndAddTargets filters the loaded entity list by range, visibility, invisibility and friend status and sorts by distance, currentTarget is the nearest survivor, and the pre-motion branch runs the CPS gate, the swing, the C02 send, and the autoblock latch. onDisable releases a pending block and clears both targetList and the blocking flags. The two rotationMode cases are empty, which is the key finding: the Rotate toggle gates the attack loop but no mode ever writes yaw or pitch, so the attacks go out with the unmodified view.

source TimerUtil.java (CPS gate)

TimerUtil.java27 lines · JavaOriginal ↗
1
package dev.tenacity.util.misc;
2
3
public final class TimerUtil {
4
5
    private long lastMS = System.currentTimeMillis();
6
7
    public void reset() {
8
        lastMS = System.currentTimeMillis();
9
    }
10
11
    public boolean hasTimeElapsed(final long time, final boolean reset) {
12
        if(System.currentTimeMillis() - lastMS > time) {
13
            if(reset) reset();
14
            return true;
15
        }
16
        return false;
17
    }
18
19
    public long getTime() {
20
        return System.currentTimeMillis() - lastMS;
21
    }
22
23
    public void setTime(final long time) {
24
        lastMS = time;
25
    }
26
27
}

What this file does

TimerUtil is a millisecond gate: hasTimeElapsed(time, reset) returns true once System.currentTimeMillis() minus lastMS exceeds time and, when reset is true, re-arms lastMS. The module calls it with 1000 / cps and reset true on every fire, so the gate re-arms immediately after each attack and the next interval is a fresh roll of the random CPS. This per-fire re-roll is what makes the attack stream irregular rather than a fixed metronome, which matters for the countering story: the cadence variance is the only human-like quality the module has.

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 NCP fight Reach (survival distance limit)

Reach.java372 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.fight;
16
17
18
import org.bukkit.GameMode;
19
import org.bukkit.Location;
20
import org.bukkit.entity.EnderDragon;
21
import org.bukkit.entity.Entity;
22
import org.bukkit.entity.Giant;
23
import org.bukkit.entity.LivingEntity;
24
import org.bukkit.entity.Player;
25
import org.bukkit.util.Vector;
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.checks.moving.location.tracking.LocationTrace.ITraceEntry;
33
import fr.neatmonster.nocheatplus.permissions.Permissions;
34
import fr.neatmonster.nocheatplus.players.IPlayerData;
35
import fr.neatmonster.nocheatplus.utilities.StringUtil;
36
import fr.neatmonster.nocheatplus.utilities.TickTask;
37
import fr.neatmonster.nocheatplus.utilities.math.TrigUtil;
38
39
/**
40
 * The Reach check will find out if a player interacts with something that's too far away.
41
 */
42
public class Reach extends Check {
43
44
    /** The maximum distance allowed to interact with an entity in creative mode. */
45
    public static final double CREATIVE_DISTANCE = 6D;
46
47
48
    /** Additum for distance, based on entity. */
49
    private static double getDistMod(final Entity damaged) {
50
        // Handle the EnderDragon differently.
51
        if (damaged instanceof EnderDragon)
52
            return 6.5D;
53
        else if (damaged instanceof Giant){
54
            return 1.5D;
55
        }
56
        else return 0;
57
    }
58
59
60
    /**
61
     * Instantiates a new reach check.
62
     */
63
    public Reach() {
64
        super(CheckType.FIGHT_REACH);
65
    }
66
67
68
    /**
69
     * "Classic" check.
70
     * 
71
     * @param player
72
     *            the player
73
     * @param damaged
74
     *            the damaged
75
     * @return true, if successful
76
     */
77
    public boolean check(final Player player, final Location pLoc, 
78
                         final Entity damaged, final boolean damagedIsFake, final Location dRef, 
79
                         final FightData data, final FightConfig cc, final IPlayerData pData) {
80
81
        boolean cancel = false;
82
        // The maximum distance allowed to interact with an entity in survival mode.
83
        final double SURVIVAL_DISTANCE = cc.reachSurvivalDistance; 
84
        // Amount which can be reduced by reach adaption.
85
        final double DYNAMIC_RANGE = cc.reachReduceDistance; 
86
        // Adaption amount for dynamic range.
87
        final double DYNAMIC_STEP = cc.reachReduceStep / SURVIVAL_DISTANCE; 
88
        final double distanceLimit = player.getGameMode() == GameMode.CREATIVE ? CREATIVE_DISTANCE : SURVIVAL_DISTANCE + getDistMod(damaged);
89
        final double distanceMin = (distanceLimit - DYNAMIC_RANGE) / distanceLimit;
90
        final double height = damagedIsFake ? (damaged instanceof LivingEntity ? ((LivingEntity) damaged).getEyeHeight() : 1.75) : mcAccess.getHandle().getHeight(damaged);
91
        final double width = damagedIsFake ? 0.6 : mcAccess.getHandle().getWidth(damaged);
92
        double centertoedge = 0.0;
93
        
94
        if (cc.reachPrecision) {
95
            centertoedge = getinset(pLoc, dRef, width / 2, 0.0);
96
        }
97
98
        // Refine y position.
99
        final double pY = pLoc.getY() + player.getEyeHeight();
100
        final double dY = dRef.getY();
101
        if (pY <= dY) {
102
            // Keep the foot level y.
103
        } 
104
        // Highest ref y
105
        else if (pY >= dY + height) {
106
             dRef.setY(dY + height);
107
        }
108
        // Level with damaged.
109
        else dRef.setY(pY);
110
111
        final Vector pRel = dRef.toVector().subtract(pLoc.toVector().setY(pY)); // TODO: Run calculations on numbers only :p.
112
        // Distance is calculated from eye location to center of targeted. If the player is further away from their target
113
        // than allowed, the difference will be assigned to "distance".
114
        final double lenpRel = pRel.length() - centertoedge;
115
        double violation = lenpRel - distanceLimit;
116
        final double reachMod = data.reachMod; 
117
118
119
        if (violation > 0) {
120
            if (TickTask.getLag(1000, true) < 1.5f){ // Do not increase the vl in case of server lag (1.5 is a magic value)
121
                data.reachVL += violation;
122
                final ViolationData vd = new ViolationData(this, player, data.reachVL, violation, cc.reachActions);
123
                vd.setParameter(ParameterName.REACH_DISTANCE, StringUtil.fdec3.format(lenpRel));
124
                // Execute whatever actions are associated with this check and the violation level and find out if we should
125
                // cancel the event.
126
                cancel = executeActions(vd).willCancel();
127
            }
128
129
            if (Improbable.check(player, (float) violation / 2f, System.currentTimeMillis(), "fight.reach", pData)){
130
                cancel = true;
131
            }
132
133
            if (cancel && cc.reachPenalty > 0){
134
                // Apply an attack penalty time.
135
                data.attackPenalty.applyPenalty(cc.reachPenalty);
136
            }
137
        }
138
        else if (lenpRel - distanceLimit * reachMod > 0){
139
            // Silent cancel.
140
            if (cc.reachPenalty > 0) {
141
                data.attackPenalty.applyPenalty(cc.reachPenalty / 2);
142
            }
143
            cancel = true;
144
            Improbable.feed(player, (float) (lenpRel - distanceLimit * reachMod) / 4f, System.currentTimeMillis());
145
        }
146
        else data.reachVL *= 0.8D; // Player passed the check, reward them.
147
            
148
149
        if (!cc.reachReduce){
150
            data.reachMod = 1d;
151
        }
152
        else if (lenpRel > distanceLimit - DYNAMIC_RANGE){
153
            data.reachMod = Math.max(distanceMin, data.reachMod - DYNAMIC_STEP);
154
        }
155
        else data.reachMod = Math.min(1.0, data.reachMod + DYNAMIC_STEP);
156
157
        if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
158
            player.sendMessage("NC+: Attack/reach " + damaged.getType()+ " height="+ StringUtil.fdec3.format(height) + " dist=" + StringUtil.fdec3.format(lenpRel) +" @" + StringUtil.fdec3.format(reachMod));
159
        }
160
161
        return cancel;
162
    }
163
164
    /**
165
     * Data context for iterating over ITraceEntry instances.
166
     * @param player
167
     * @param pLoc
168
     * @param damaged
169
     * @param damagedLoc
170
     * @param data
171
     * @param cc
172
     * @return
173
     */
174
    public ReachContext getContext(final Player player, final Location pLoc, 
175
                                   final Entity damaged, final Location damagedLoc, 
176
                                   final FightData data, final FightConfig cc) {
177
178
        final ReachContext context = new ReachContext();
179
        context.distanceLimit = player.getGameMode() == GameMode.CREATIVE ? CREATIVE_DISTANCE : cc.reachSurvivalDistance + getDistMod(damaged);
180
        context.distanceMin = (context.distanceLimit - cc.reachReduceDistance) / context.distanceLimit;
181
        //context.eyeHeight = player.getEyeHeight();
182
        context.pY = pLoc.getY() + player.getEyeHeight();
183
        return context;
184
    }
185
186
    /**
187
     * Check if the player fails the reach check, no change of FightData.
188
     * @param player
189
     * @param pLoc
190
     * @param damaged
191
     * @param dRef
192
     * @param context
193
     * @param data
194
     * @param cc
195
     * @return
196
     */
197
    public boolean loopCheck(final Player player, final Location pLoc, final Entity damaged, 
198
                             final ITraceEntry dRef, final ReachContext context, 
199
                             final FightData data, final FightConfig cc) {
200
201
        boolean cancel = false;
202
203
        // Refine y position.
204
        final double dY = dRef.getY();
205
        double y = dRef.getY();
206
207
        if (context.pY <= dY) {
208
            // Keep the foot level y.
209
        }
210
        else if (context.pY >= dY + dRef.getBoxMarginVertical()) {
211
            y = dY + dRef.getBoxMarginVertical(); // Highest ref y.
212
        }
213
        else {
214
            y = context.pY; // Level with damaged.
215
        }
216
217
        double centertoedge = 0.0;
218
        if (cc.reachPrecision) centertoedge = getinset(pLoc, new Location(null, dRef.getX(), dRef.getY(), dRef.getZ()), dRef.getBoxMarginHorizontal(), y - context.pY);
219
        
220
        // Distance is calculated from eye location to center of targeted. If the player is further away from their target
221
        // than allowed, the difference will be assigned to "distance".
222
        // TODO: Run check on squared distances (quite easy to change to stored boundary-sq values).
223
        final double lenpRel = TrigUtil.distance(dRef.getX(), y, dRef.getZ(), pLoc.getX(), context.pY, pLoc.getZ()) - centertoedge;
224
        double violation = lenpRel - context.distanceLimit;
225
226
        if (violation > 0 || lenpRel - context.distanceLimit * data.reachMod > 0){
227
            // TODO: The silent cancel parts should be sen as "no violation" ?
228
            // Set minimum violation in context
229
            context.minViolation = Math.min(context.minViolation, lenpRel);
230
            cancel = true;
231
        }
232
        context.minResult = Math.min(context.minResult, lenpRel);
233
234
        return cancel;
235
236
    }
237
238
    /**
239
     * Apply changes to FightData according to check results (context), trigger violations.
240
     * @param player
241
     * @param pLoc
242
     * @param damaged
243
     * @param context
244
     * @param forceViolation
245
     * @param data
246
     * @param cc
247
     * @return
248
     */
249
    public boolean loopFinish(final Player player, final Location pLoc, final Entity damaged, 
250
                              final ReachContext context, final ITraceEntry traceEntry, final boolean forceViolation, 
251
                              final FightData data, final FightConfig cc, final IPlayerData pData) {
252
253
        final double lenpRel = forceViolation && context.minViolation != Double.MAX_VALUE ? context.minViolation : context.minResult;
254
255
        if (lenpRel == Double.MAX_VALUE) {
256
            return false;
257
        }
258
259
        double violation = lenpRel - context.distanceLimit;
260
        boolean cancel = false;
261
262
        if (violation > 0) {    
263
            if (TickTask.getLag(1000, true) < 1.5f){
264
                data.reachVL += violation;
265
                final ViolationData vd = new ViolationData(this, player, data.reachVL, violation, cc.reachActions);
266
                vd.setParameter(ParameterName.REACH_DISTANCE, StringUtil.fdec3.format(lenpRel));
267
                // Execute whatever actions are associated with this check and the violation level and find out if we should
268
                // cancel the event.
269
                cancel = executeActions(vd).willCancel();
270
            }
271
            
272
            //if (Improbable.check(player, (float) violation / 2f, System.currentTimeMillis(), 
273
            //        "fight.reach", pData)){
274
            //    cancel = true;
275
            //}
276
            // TODO: New improbable weight calculations so that weight is not inverse to config weight
277
            if (cc.reachImprobableWeight > 0.0f) {
278
                if (!cc.reachImprobableFeedOnly && Improbable.check(player, (float) violation / cc.reachImprobableWeight, System.currentTimeMillis(), "fight.reach", pData)) {
279
                    cancel = true;
280
                }
281
            }
282
283
            if (cancel && cc.reachPenalty > 0){
284
                // Apply an attack penalty time.
285
                data.attackPenalty.applyPenalty(cc.reachPenalty);
286
            }
287
        }
288
        else if (lenpRel - context.distanceLimit * data.reachMod > 0){
289
            // Silent cancel.
290
            if (cc.reachPenalty > 0) {
291
                data.attackPenalty.applyPenalty(cc.reachPenalty / 2);
292
            }
293
294
            cancel = true;
295
296
            if (cc.reachImprobableWeight > 0.0f) {
297
                Improbable.feed(player, (float) (lenpRel - context.distanceLimit * data.reachMod) / cc.reachImprobableWeight, System.currentTimeMillis());
298
            }
299
            // Improbable.feed(player, (float) (lenpRel - context.distanceLimit * data.reachMod) / 4f, System.currentTimeMillis());
300
        }
301
        else {
302
            // Player passed the check, reward them.
303
            data.reachVL *= 0.8D;
304
305
        }
306
307
        // Adaption amount for dynamic range.
308
        final double DYNAMIC_STEP = cc.reachReduceStep / cc.reachSurvivalDistance;
309
310
        if (!cc.reachReduce){
311
            data.reachMod = 1d;
312
        }
313
        else if (lenpRel > context.distanceLimit - cc.reachReduceDistance){
314
            data.reachMod = Math.max(context.distanceMin, data.reachMod - DYNAMIC_STEP);
315
        }
316
        else {
317
            data.reachMod = Math.min(1.0, data.reachMod + DYNAMIC_STEP);
318
        }
319
320
        if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)){
321
            // TODO: Height: remember successful ITraceEntry
322
            player.sendMessage("NC+: Attack/reach " + damaged.getType()+ (traceEntry == null ? "" : (" height=" + traceEntry.getBoxMarginVertical())) + " dist=" + StringUtil.fdec3.format(lenpRel) +" @" + StringUtil.fdec3.format(data.reachMod));
323
        }
324
325
        return cancel;
326
    }
327
328
329
    private boolean isSameXZ(final Location loc1, final Location loc2) {
330
        return loc1.getX() == loc2.getX() && loc1.getZ() == loc2.getZ();
331
    }
332
333
334
    /**
335
     *
336
     * @param pLoc
337
     *            the player location
338
     * @param dRef
339
     *            the target location
340
     * @param damagedBoxMarginHorizontal
341
     *            the target Width / 2
342
     * @param diffY the Y different
343
     * @return the double represent for the distance from target location to the edge of target hitbox
344
     */
345
    private double getinset(final Location pLoc, final Location dRef, final double damagedBoxMarginHorizontal, final double diffY) {
346
347
        if (!isSameXZ(pLoc, dRef)) {
348
            final Location dRefc = dRef.clone();
349
            final Vector vec1 = new Vector(pLoc.getX() - dRef.getX(), diffY , pLoc.getZ() - dRef.getZ());
350
            if (vec1.length() < damagedBoxMarginHorizontal * Math.sqrt(2)) return 0.0;
351
            if (vec1.getZ() > 0.0) {
352
                dRefc.setZ(dRefc.getZ() + damagedBoxMarginHorizontal);
353
            } 
354
            else if (vec1.getZ() < 0.0) {
355
                dRefc.setZ(dRefc.getZ() - damagedBoxMarginHorizontal);
356
            } 
357
            else if (vec1.getX() > 0.0) {
358
                dRefc.setX(dRefc.getX() + damagedBoxMarginHorizontal);
359
            } 
360
            else dRefc.setX(dRefc.getX() - damagedBoxMarginHorizontal);
361
362
            final Vector vec2 = new Vector(dRefc.getX() - dRef.getX(), 0.0 , dRefc.getZ() - dRef.getZ());
363
            double angle = TrigUtil.angle(vec1, vec2);
364
            // Require < 45deg, if not 90deg-angel
365
            if (angle > Math.PI / 4) angle = Math.PI / 2 - angle;
366
            if (angle >= 0.0 && angle <= Math.PI / 4) { // TODO: Dose this one necessary?
367
                return damagedBoxMarginHorizontal / Math.cos(angle);
368
            }
369
        }
370
        return 0.0;
371
    }
372
}

How it counteracts this module

NCP fight Reach measures the attack distance from the server-tracked player position to the victim at the moment the C02 is processed. The survival distance limit in this tree is 4.02 (DefaultConfig line 366) with a reachMod reduce band between 3.22 and 4.02 that silently cancels repeat hits instead of flagging. The module attacks from its own position with no teleport assistance, so a default-range hit measures roughly 46 blocks over the limit and the violation fires on the first attack. The honest both-sides point: unlike teleport-based TP auras there is no C04 stream to revert, so the reach measurement is against the true position every time.

anticheat Hawk EntityInteractReach (interaction distance)

EntityInteractReach.java88 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.entity;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.EntityInteractionCheck;
23
import me.islandscout.hawk.event.InteractEntityEvent;
24
import me.islandscout.hawk.util.*;
25
import me.islandscout.hawk.wrap.entity.WrappedEntity;
26
import org.bukkit.GameMode;
27
import org.bukkit.Location;
28
import org.bukkit.entity.Entity;
29
import org.bukkit.entity.Player;
30
import org.bukkit.util.Vector;
31
32
public class EntityInteractReach extends EntityInteractionCheck {
33
34
    //PASSED (6/24/2019)
35
36
    private final double MAX_REACH;
37
    private final double MAX_REACH_CREATIVE;
38
    private final int PING_LIMIT;
39
    private final boolean LAG_COMPENSATION;
40
    private final boolean CHECK_OTHER_ENTITIES;
41
42
    public EntityInteractReach() {
43
        super("entityinteractreach", "%player% failed entity interact reach. Reach: %distance%m VL: %vl%");
44
        MAX_REACH = (double) customSetting("maxReach", "", 3.1);
45
        MAX_REACH_CREATIVE = (double) customSetting("maxReachCreative", "", 5.0);
46
        PING_LIMIT = (int) customSetting("pingLimit", "", -1);
47
        LAG_COMPENSATION = (boolean) customSetting("lagCompensation", "", true);
48
        CHECK_OTHER_ENTITIES = (boolean) customSetting("checkOtherEntities", "", false);
49
    }
50
51
    @Override
52
    protected void check(InteractEntityEvent e) {
53
        Entity victimEntity = e.getEntity();
54
        if (!(victimEntity instanceof Player) && !CHECK_OTHER_ENTITIES)
55
            return;
56
        int ping = ServerUtils.getPing(e.getPlayer());
57
        if (PING_LIMIT > -1 && ping > PING_LIMIT)
58
            return;
59
        Player p = e.getPlayer();
60
        HawkPlayer att = e.getHawkPlayer();
61
62
        Location victimLocation;
63
        if (LAG_COMPENSATION)
64
            victimLocation = hawk.getLagCompensator().getHistoryLocation(ping, victimEntity);
65
        else
66
            victimLocation = victimEntity.getLocation();
67
68
        AABB victimAABB = WrappedEntity.getWrappedEntity(victimEntity).getHitbox(victimLocation.toVector());
69
70
        Vector attackerPos;
71
        if(att.isInVehicle()) {
72
            attackerPos = hawk.getLagCompensator().getHistoryLocation(ServerUtils.getPing(p), p).toVector();
73
            attackerPos.setY(attackerPos.getY() + p.getEyeHeight());
74
        }
75
        else {
76
            attackerPos = att.getHeadPosition();
77
        }
78
79
        double maxReach = att.getPlayer().getGameMode() == GameMode.CREATIVE ? MAX_REACH_CREATIVE : MAX_REACH;
80
        double dist = victimAABB.distanceToPosition(attackerPos);
81
82
        if (dist > maxReach) {
83
            punish(att, 1, true, e, new Placeholder("distance", MathPlus.round(dist, 2)));
84
        } else {
85
            reward(att);
86
        }
87
    }
88
}

How it counteracts this module

Hawk EntityInteractReach enforces a 3.1 block interaction limit with lag compensation enabled by default, scoring each C02 against the attacker's position history. Because the module never emits a teleport, the history is the honest vanilla movement stream and no extrapolation or rewind can bring a 50-block default hit into range; every attack flags immediately. The same distance applies to the autoblock C08 placement, which travels with the same absurd separation when the module is used at long range.

anticheat Hawk EntityInteractDirection (facing cone ray)

EntityInteractDirection.java95 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.entity;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.EntityInteractionCheck;
23
import me.islandscout.hawk.event.InteractEntityEvent;
24
import me.islandscout.hawk.util.*;
25
import me.islandscout.hawk.wrap.entity.WrappedEntity;
26
import org.bukkit.Location;
27
import org.bukkit.entity.Entity;
28
import org.bukkit.entity.Player;
29
import org.bukkit.util.Vector;
30
31
public class EntityInteractDirection extends EntityInteractionCheck {
32
33
    private final int PING_LIMIT;
34
    private final boolean LAG_COMPENSATION;
35
    private final boolean CHECK_OTHER_ENTITIES;
36
    private final double BOX_EXPAND;
37
38
    public EntityInteractDirection() {
39
        super("entityinteractdirection", true, 0, 10, 0.9, 5000, "%player% failed entity interact direction, VL: %vl%", null);
40
        PING_LIMIT = (int) customSetting("pingLimit", "", -1);
41
        LAG_COMPENSATION = (boolean) customSetting("lagCompensation", "", true);
42
        CHECK_OTHER_ENTITIES = (boolean) customSetting("checkOtherEntities", "", true);
43
        BOX_EXPAND = (double) customSetting("boxExpand", "", 0.2);
44
    }
45
46
    @Override
47
    protected void check(InteractEntityEvent e) {
48
        Player p = e.getPlayer();
49
        HawkPlayer pp = e.getHawkPlayer();
50
        Entity victimEntity = e.getEntity();
51
        if (!(victimEntity instanceof Player) && !CHECK_OTHER_ENTITIES)
52
            return;
53
        int ping = ServerUtils.getPing(e.getPlayer());
54
        if (PING_LIMIT > -1 && ping > PING_LIMIT)
55
            return;
56
        Vector pos;
57
        if(pp.isInVehicle()) {
58
            pos = hawk.getLagCompensator().getHistoryLocation(ping, p).toVector();
59
            pos.setY(pos.getY() + p.getEyeHeight());
60
        }
61
        else {
62
            pos = pp.getHeadPosition();
63
        }
64
        //As I always say in math class, converting polar coordinates to rectangular coordinates is a pain in
65
        //the ass. If you want to use the previous direction vector, you cannot make an accurate cut through the AABB
66
        //using only the previous and extrapolated direction vectors. You'd think you could since the extrapolation
67
        //on yaw and pitch is linear, but the current direction vector won't lie between the other two. Remember Non-
68
        //Euclidean geometry!
69
        Vector dir = MathPlus.getDirection(pp.getYaw(), pp.getPitch());
70
        //Note: in MC 1.8, the cursor yaw is not updated per frame, but rather per tick.
71
        //For ray-hitbox checks, this means that we do not need to extrapolate the yaw,
72
        //but for this check it does not matter whether we do it or not.
73
        Vector extraDir = MathPlus.getDirection(pp.getYaw() + pp.getDeltaYaw(), pp.getPitch() + pp.getDeltaPitch());
74
75
        Location victimLoc;
76
        if(LAG_COMPENSATION)
77
            victimLoc = hawk.getLagCompensator().getHistoryLocation(ping, victimEntity);
78
        else
79
            victimLoc = e.getEntity().getLocation();
80
81
        AABB victimAABB = WrappedEntity.getWrappedEntity(e.getEntity()).getHitbox(victimLoc.toVector());
82
        victimAABB.expand(BOX_EXPAND, BOX_EXPAND, BOX_EXPAND);
83
84
        //this is a crappy workaround to one of the issues with AABB#betweenRays. I'll keep this here until it is rewritten.
85
        Vector toVictim = victimLoc.toVector().setY(0).subtract(pos.clone().setY(0));
86
        boolean behind = toVictim.clone().normalize().dot(dir.clone().setY(0).normalize()) < 0 && toVictim.lengthSquared() > victimAABB.getMax().clone().setY(0).subtract(victimAABB.getMin().clone().setY(0)).lengthSquared();
87
88
        if(victimAABB.betweenRays(pos, dir, extraDir) && !behind) {
89
            reward(pp);
90
        }
91
        else {
92
            punish(pp, true, e);
93
        }
94
    }
95
}

How it counteracts this module

EntityInteractDirection expands the player hitbox by 0.2 and ray traces from the server-observed yaw and pitch to the target; a hit outside the facing cone fails. The module never rotates, so the server-observed facing is whatever the player last moved with, and every victim off that cone fails direction regardless of distance. Only targets standing inside the current facing cone pass, which makes the check a second independent filter on top of the reach checks.

anticheat NCP fight Angle (attack stream rotation)

Angle.java255 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.fight;
16
17
import java.util.Iterator;
18
import java.util.LinkedList;
19
import java.util.List;
20
import java.util.UUID;
21
22
import org.bukkit.ChatColor;
23
import org.bukkit.Location;
24
import org.bukkit.entity.Entity;
25
import org.bukkit.entity.Player;
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.permissions.Permissions;
32
import fr.neatmonster.nocheatplus.players.IPlayerData;
33
import fr.neatmonster.nocheatplus.utilities.StringUtil;
34
import fr.neatmonster.nocheatplus.utilities.TickTask;
35
import fr.neatmonster.nocheatplus.utilities.math.TrigUtil;
36
37
/**
38
 * A check used to verify if the player isn't using a forcefield in order to attack multiple entities at the same time.
39
 * 
40
 * Thanks @asofold for the original idea!
41
 */
42
public class Angle extends Check {
43
  
44
45
  private final List<String> tags = new LinkedList<String>();
46
47
48
    public static class AttackLocation {
49
        public final double x, y, z;
50
        /** Yaw of the attacker. */
51
        public final float yaw;
52
        public long time;
53
        public final UUID damagedId;
54
        /** Squared distance to the last location (0 if none given). */
55
        public final double distSqLast;
56
        /** Difference in yaw to the last location (0 if none given). */
57
        public final double yawDiffLast;
58
        /** Time difference to the last location (0 if none given). */
59
        public final long timeDiff;
60
        /** If the id differs from the last damaged entity (true if no lastLoc is given). */
61
        public final boolean idDiffLast;
62
        public AttackLocation(final Location loc, final UUID damagedId, final long time, final AttackLocation lastLoc) {
63
            x = loc.getX();
64
            y = loc.getY();
65
            z = loc.getZ();
66
            yaw = loc.getYaw();
67
            this.time = time;
68
            this.damagedId = damagedId;
69
70
            if (lastLoc != null) {
71
                distSqLast = TrigUtil.distanceSquared(x, y, z, lastLoc.x, lastLoc.y, lastLoc.z);
72
                yawDiffLast = TrigUtil.yawDiff(yaw, lastLoc.yaw);
73
                timeDiff = Math.max(0L, time - lastLoc.time);
74
                idDiffLast = !damagedId.equals(lastLoc.damagedId);
75
            } 
76
            else {
77
                distSqLast = 0.0;
78
                yawDiffLast = 0f;
79
                timeDiff = 0L;
80
                idDiffLast = true;
81
            }
82
        }
83
    }
84
    
85
    /** Used to also monitor lag-time */
86
    public static long maxTimeDiff = 1000L;
87
88
89
    /**
90
     * Instantiates a new angle check.
91
     */
92
    public Angle() {
93
        super(CheckType.FIGHT_ANGLE);
94
    }
95
96
97
    /**
98
     * The Angle check.
99
     * @param player
100
     * @param loc Location of the player.
101
     * @param worldChanged
102
     * @param data
103
     * @param cc
104
     * @return
105
     */
106
    public boolean check(final Player player, final Location loc, 
107
                         final Entity damagedEntity, final boolean worldChanged, 
108
                         final FightData data, final FightConfig cc, final IPlayerData pData) {
109
110
        if (worldChanged) {
111
            data.angleHits.clear();
112
        }
113
114
        boolean cancel = false;
115
        tags.clear();
116
117
        // Quick check for expiration of all entries.
118
        final long time = System.currentTimeMillis();
119
        AttackLocation lastLoc = data.angleHits.isEmpty() ? null : data.angleHits.getLast();
120
        if (lastLoc != null && time - lastLoc.time > maxTimeDiff) {
121
            data.angleHits.clear();
122
            lastLoc = null;
123
        }
124
125
        // Add the new location.
126
        data.angleHits.add(new AttackLocation(loc, damagedEntity.getUniqueId(), System.currentTimeMillis(), lastLoc));
127
128
        // Calculate the sums of differences.
129
        double deltaMove = 0D;
130
        long deltaTime = 0L;
131
        float deltaYaw = 0f;
132
        int deltaSwitchTarget = 0;
133
        final Iterator<AttackLocation> it = data.angleHits.iterator();
134
        while (it.hasNext()) {
135
            final AttackLocation refLoc = it.next();
136
            if (time - refLoc.time > maxTimeDiff) {
137
                it.remove();
138
                continue;
139
            }
140
            deltaMove += refLoc.distSqLast;
141
            final double yawDiff = Math.abs(refLoc.yawDiffLast);
142
            deltaYaw += yawDiff;
143
            deltaTime += refLoc.timeDiff;
144
            if (refLoc.idDiffLast && yawDiff > 30.0) {
145
                // TODO: Configurable sensitivity ? Scale with yawDiff?
146
                deltaSwitchTarget += 1;
147
            }
148
        }
149
150
        // Check if there is enough data present.
151
        if (data.angleHits.size() < 2) {
152
            return false;
153
        }
154
155
        final double n = (double) (data.angleHits.size() - 1);
156
157
        // Let's calculate the average move.
158
        double averageMove = deltaMove / n;
159
        // Adjust to server-sided lag
160
        averageMove *= TickTask.getLag(maxTimeDiff, true);
161
162
        // And the average time elapsed.
163
        double averageTime = (double) deltaTime / n;
164
        // Adjust to server-sided lag
165
        averageTime *= TickTask.getLag(maxTimeDiff, true);
166
167
        // And the average yaw delta.
168
        double averageYaw = (double) deltaYaw / n;
169
        // Adjust to server-sided lag
170
        averageYaw /= TickTask.getLag(maxTimeDiff, true);
171
172
        // Average target switching.
173
        double averageSwitching = (double) deltaSwitchTarget / n;
174
        // Adjust to server-sided lag
175
        averageSwitching /= TickTask.getLag(maxTimeDiff, true);
176
177
        // Declare the variables.
178
        double violation = 0.0;
179
        double violationMove = 0.0;
180
        double violationTime = 0.0;
181
        double violationYaw = 0.0;
182
        double violationSwitchSpeed = 0.0;
183
184
        // If the average move is between 0 and 0.2 block(s), add it to the violation.
185
        if (averageMove >= 0.0 && averageMove < 0.2D) {
186
            violationMove += 20.0 * (0.2 - averageMove) / 0.2;
187
            tags.add("avgmove");
188
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
189
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgMove: " + averageMove + " avgMove VL: " + violationMove + "/" + cc.angleMove);
190
            }
191
        }
192
193
        // If the average time elapsed is between 0 and 150 millisecond(s), add it to the violation.
194
        if (averageTime >= 0.0 && averageTime < 150.0) {
195
            violationTime += 30.0 * (150.0 - averageTime) / 150.0;
196
            tags.add("avgtime");
197
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
198
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgTime: " + averageTime + " avgTime VL: " + violationTime + "/" + cc.angleTime);
199
            }
200
        }
201
202
        // If the average difference of yaw is superior to 50 degrees, add it to the violation.
203
        if (averageYaw > 50.0) {
204
            violationYaw += 30.0 * averageYaw / 180.0;
205
            tags.add("avgyaw");
206
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
207
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgYaw: " + averageYaw + " avgYaw VL: " + violationYaw + "/" + cc.angleYaw);
208
            }
209
        }
210
        
211
        // Check for too quick target switch speed
212
        if (averageSwitching > 0.0) {
213
            violationSwitchSpeed += 20.0 * averageSwitching;
214
            tags.add("switchspeed");
215
            if (pData.isDebugActive(type) && pData.hasPermission(Permissions.ADMINISTRATION_DEBUG, player)) {
216
                player.sendMessage(ChatColor.RED + "NC+ Debug: " + ChatColor.RESET + "avgSwitch: " + averageSwitching + " avgSwitch VL: " + violationSwitchSpeed + "/" + cc.angleSwitch);
217
            }
218
        }
219
220
221
        if (violationMove > cc.angleMove) {
222
            violation = violationMove;
223
            data.angleVL += violation;
224
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
225
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
226
            cancel = executeActions(vd).willCancel();
227
        }
228
        else if (violationTime > cc.angleTime) {
229
            violation = violationTime;
230
            data.angleVL += violation;
231
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
232
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
233
            cancel = executeActions(vd).willCancel();
234
        }
235
        else if (violationYaw > cc.angleYaw) {
236
            violation = violationYaw;
237
            data.angleVL += violation;
238
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
239
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
240
            cancel = executeActions(vd).willCancel();
241
        } 
242
        else if (violationSwitchSpeed > cc.angleSwitch) {
243
            violation = violationSwitchSpeed;
244
            data.angleVL += violation;
245
            final ViolationData vd = new ViolationData(this, player, data.angleVL, violation, cc.angleActions);
246
            if (vd.needsParameters()) vd.setParameter(ParameterName.TAGS, StringUtil.join(tags, "+"));
247
            cancel = executeActions(vd).willCancel();
248
        } 
249
        else {
250
            // Reward the player by lowering their violation level.
251
            data.angleVL *= 0.98D;  
252
        }
253
        return cancel;
254
    }
255
}

How it counteracts this module

NCP fight Angle scores the attack stream inside a 1000ms window with angleVL accumulation and a 0.98 decay, testing how much the player moved, how fast attacks follow each other, how far yaw changes between attacks, and how often the target switches. The module maximizes every signal: zero yaw change, sub-50ms gaps at high CPS, and nearest-first target switches with no turn. At the stock thresholds in this tree (move 100, time 150, yaw 60, switch 50) per-call scores cap at 20 to 30 and never trip, so the check is dormant until an admin lowers the thresholds; on detection configs the same stream flags immediately.

← Back to Analysis Hub