Rise 5.99 ComboOneHit module 1 files, 27 lines

Rise 5.99 ComboOneHit: Full Source Analysis

Rise 5.99's ComboOneHit is a 27-line multiplier for the Combo duels gamemode: on every AttackEvent it re-sends the same C02PacketUseEntity ATTACK against the event's target a configurable number…

dev/rise/module/impl/combat/ComboOneHit.java · GitHub source ↗

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

Packets This Module Uses

Analysis

Overview

Rise 5.99's ComboOneHit is a 27-line multiplier for the Combo duels gamemode: on every AttackEvent it re-sends the same C02PacketUseEntity ATTACK against the event's target a configurable number of times, 50 by default and up to 1000, all in the same tick. The packets go out through PacketUtil.sendPacketWithoutEvent, which bypasses the client's own PacketSendEvent bus, so no other Rise module sees or filters them, but they reach the wire like any other packet. The module has no aim logic, no range check and no target filtering of its own: it multiplies whatever attack produced the event, which is what makes it a one-tick burst of identical attack packets against a single entity id. The only setting is the packet count, and the wire fingerprint is the burst itself: dozens of C02 ATTACK packets with no swing packet, no rotation change and no intervening move between them.

Burst multiplication

sendPacketWithoutEvent is the deliberate detail: it pushes the packet straight to the net handler instead of firing the client's PacketSendEvent, so listeners that cancel or rewrite outgoing packets in other modules never see the burst. The server does see it, which is the point: in the Combo gamemode the module multiplies the hits a single swing yields. Because the loop runs inside the event handler, all 50 packets are queued before the client sends anything else, so the burst occupies the same tick as the swing that triggered it.

Wire fingerprint

There is no client-side bot filter anywhere in the module, and the countering checks below therefore do not need to argue around one: the server receives every packet in the burst and validates geometry and timing from its own world state, never from the client's entity list. The module inherits the target from the event, so the burst always names an entity the player actually attacked, which keeps reach and line-of-sight checks quiet while the rate checks fire.

source ComboOneHit.java

ComboOneHit.java27 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.combat;
7
8
import dev.rise.event.impl.other.AttackEvent;
9
import dev.rise.module.Module;
10
import dev.rise.module.api.ModuleInfo;
11
import dev.rise.module.enums.Category;
12
import dev.rise.setting.impl.NumberSetting;
13
import dev.rise.util.player.PacketUtil;
14
import net.minecraft.network.play.client.C02PacketUseEntity;
15
16
@ModuleInfo(name = "ComboOneHit", description = "Instantly kills people in the Combo gamemode", category = Category.COMBAT)
17
public final class ComboOneHit extends Module {
18
19
    public final NumberSetting packets = new NumberSetting("Packets", this, 50, 1, 1000, 25);
20
21
    @Override
22
    public void onAttackEvent(final AttackEvent event) {
23
        for (int i = 0; i < (int) packets.getValue(); i++) {
24
            PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(event.getTarget(), C02PacketUseEntity.Action.ATTACK));
25
        }
26
    }
27
}

What this file does

The entire module is the NumberSetting at line 19 (Packets, default 50, range 1 to 1000, step 25) and the onAttackEvent handler at lines 22-26. The loop count is cast from the setting's double value to int, so fractional settings truncate toward the lower bound. Each iteration builds a new C02PacketUseEntity with the event's target and the ATTACK action and hands it to PacketUtil.sendPacketWithoutEvent, which queues it outside the client's own send event stream. There is no onEnable, no state, no other handler: the module exists only to inflate one attack event into N wire packets.

The absence of other traffic is part of the analysis: no C0A swing, no C02 INTERACT, no C03 movement, no rotation write. Everything the server can measure about the burst is in the C02 stream itself, which is why the countering checks below are all attack-rate and attack-shape checks rather than geometry checks. The file is self-contained and has no supporting utilities beyond PacketUtil.

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 AttackFrequency (use-entity rate ledger)

AttackFrequency.java114 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.net;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.actions.ParameterName;
20
import fr.neatmonster.nocheatplus.checks.Check;
21
import fr.neatmonster.nocheatplus.checks.CheckType;
22
import fr.neatmonster.nocheatplus.checks.ViolationData;
23
import fr.neatmonster.nocheatplus.players.IPlayerData;
24
import fr.neatmonster.nocheatplus.utilities.TickTask;
25
26
public class AttackFrequency extends Check {
27
28
    public AttackFrequency() {
29
        super(CheckType.NET_ATTACKFREQUENCY);
30
    }
31
32
    /**
33
     * Checks a player
34
     * (Checks hasBypass on violation only)
35
     * 
36
     * @param player
37
     * @param time milliseconds
38
     * @param data
39
     * @param cc
40
     * @param pData
41
     * @return true if successful
42
     */
43
    public boolean check(final Player player, final long time, final NetData data, final NetConfig cc, final IPlayerData pData) {
44
        // Update frequency.
45
        data.attackFrequencySeconds.add(time, 1f);
46
        double maxVL = 0.0;
47
        float maxLimit = 0f;
48
        String tags = null;
49
        // TODO: option to normalize the vl / stats to per second? 
50
        // HALF
51
        float sum = data.attackFrequencySeconds.bucketScore(0); // HALF
52
        float limit = cc.attackFrequencyLimitSecondsHalf;
53
        if (sum - limit > maxVL) {
54
            maxVL = sum - limit;
55
            maxLimit = limit;
56
            tags = "sec_half";
57
        }
58
        // ONE (update sum).
59
        sum += data.attackFrequencySeconds.bucketScore(1);
60
        limit = cc.attackFrequencyLimitSecondsOne;
61
        if (sum - limit > maxVL) {
62
            maxVL = sum - limit;
63
            maxLimit = limit;
64
            tags = "sec_one";
65
        }
66
        // TWO (update sum).
67
        sum += data.attackFrequencySeconds.sliceScore(2, 4, 1f);
68
        limit = cc.attackFrequencyLimitSecondsTwo;
69
        if (sum - limit > maxVL) {
70
            maxVL = sum - limit;
71
            maxLimit = limit;
72
            tags = "sec_two";
73
        }
74
        // FOUR (update sum).
75
        sum += data.attackFrequencySeconds.sliceScore(4, 8, 1f);
76
        limit = cc.attackFrequencyLimitSecondsFour;
77
        if (sum - limit > maxVL) {
78
            maxVL = sum - limit;
79
            maxLimit = limit;
80
            tags = "sec_four";
81
        }
82
        // EIGHT (update sum).
83
        sum += data.attackFrequencySeconds.sliceScore(8, 16, 1f);
84
        limit = cc.attackFrequencyLimitSecondsEight;
85
        if (sum - limit > maxVL) {
86
            maxVL = sum - limit;
87
            maxLimit = limit;
88
            tags = "sec_eight";
89
        }
90
91
        if (pData.isDebugActive(CheckType.NET_ATTACKFREQUENCY)) {
92
            player.sendMessage("AttackFrequency: " + data.attackFrequencySeconds.toLine());
93
        }
94
95
        boolean cancel = false;
96
        if (maxVL > 0.0) {
97
            // Trigger a violation.
98
            final ViolationData vd = new ViolationData(this, player, maxVL, 1.0, cc.attackFrequencyActions);
99
            if (pData.isDebugActive(type) || vd.needsParameters()) {
100
                vd.setParameter(ParameterName.PACKETS, Integer.toString((int) sum));
101
                vd.setParameter(ParameterName.LIMIT, Integer.toString((int) maxLimit));
102
                vd.setParameter(ParameterName.TAGS, tags);
103
            }
104
            cancel = executeActions(vd).willCancel();
105
            // Feed Improbable.
106
            if (cc.attackFrequencyImprobableWeight > 0.0f) {
107
            	TickTask.requestImprobableUpdate(player.getUniqueId(), cc.attackFrequencyImprobableWeight);
108
            }
109
        }
110
111
        return cancel;
112
    }
113
114
}

How it counteracts this module

NCP feeds AttackFrequency from the ProtocolLib UseEntityAdapter, which is the file the C02 corpus mines for NCP, and every incoming C02 adds 1f to data.attackFrequencySeconds, an ActionFrequency covering half, one, two, four and eight second windows (AttackFrequency.java lines 44-89). The default limits are 8 attacks in a half second, 15 in one second, 30 in two, 60 in four and 95 in eight (DefaultConfig lines 548-552). The check takes the largest excess across the windows and raises a violation with that amount, feeding the Improbable tracker when configured.

ComboOneHit's default burst of 50 C02 packets in a single tick puts 50 in the half-second bucket against a limit of 8, an excess of 42 with the sec_half tag, and the same 50 keeps the one-second window at 50 against its 15 limit. The violation executes the configured actions, which by default cancel the packet stream once the level crosses the action thresholds. The check counts every packet, so even a setting of 9 trips the half-second window, and the maximum setting of 1000 saturates every window including the eight-second one. The burst cannot be hidden by spacing, because the loop is synchronous inside the event handler: all packets land in the same processing burst.

anticheat FightSpeed (attack interval envelope)

FightSpeed.java90 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.combat;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.EntityInteractionCheck;
23
import me.islandscout.hawk.event.InteractAction;
24
import me.islandscout.hawk.event.InteractEntityEvent;
25
import me.islandscout.hawk.util.MathPlus;
26
import me.islandscout.hawk.util.Placeholder;
27
import org.bukkit.entity.Player;
28
29
import java.util.*;
30
31
public class FightSpeed extends EntityInteractionCheck {
32
33
    //This check is very similar to the FightSpeedConsistency check, however I will
34
    //not be merging these, because their SAMPLES variable may vary
35
    //based on configuration. For instance, FightSpeedConsistency relies on samples
36
    //of 5, yet this check relies on samples of 10.
37
38
    private final Map<UUID, Long> lastClickTime; //in client ticks
39
    private final Map<UUID, List<Long>> deltaTimes;
40
    private static final double RECORD_SENSITIVITY = 4; //don't log click if it took longer than these ticks
41
    private static int SAMPLES;
42
    private final double MAX_CPS;
43
44
    public FightSpeed() {
45
        super("fightspeed", "%player% failed attack speed. CPS: %cps%, VL: %vl%");
46
        lastClickTime = new HashMap<>();
47
        deltaTimes = new HashMap<>();
48
        SAMPLES = (int)customSetting("sampleSize", "", 10);
49
        MAX_CPS = (double)customSetting("maxCps", "", 16D);
50
    }
51
52
    @Override
53
    protected void check(InteractEntityEvent e) {
54
        if (e.getInteractAction() == InteractAction.INTERACT)
55
            return;
56
        UUID uuid = e.getPlayer().getUniqueId();
57
        HawkPlayer pp = e.getHawkPlayer();
58
        if (lastClickTime.containsKey(uuid)) {
59
            List<Long> deltaTs = deltaTimes.getOrDefault(uuid, new ArrayList<>());
60
            long deltaT = (pp.getCurrentTick() - lastClickTime.get(uuid));
61
            if (deltaT <= RECORD_SENSITIVITY) {
62
                deltaTs.add(deltaT);
63
                if (deltaTs.size() >= SAMPLES) {
64
                    double avgCps = 0;
65
                    for (double entry : deltaTs) {
66
                        avgCps += entry;
67
                    }
68
                    double divisor = (avgCps / SAMPLES / 20);
69
                    avgCps = 1 / divisor;
70
                    //if someone manages to get an Infinity, they're dumb af
71
                    if (avgCps > MAX_CPS) {
72
                        punish(pp, 1, true, e, new Placeholder("cps", (Double.isInfinite(avgCps) ? avgCps : MathPlus.round(avgCps, 2) + "")));
73
                    } else {
74
                        reward(pp);
75
                    }
76
                    deltaTs.remove(0);
77
                }
78
                deltaTimes.put(uuid, deltaTs);
79
            }
80
        }
81
        lastClickTime.put(uuid, pp.getCurrentTick());
82
    }
83
84
    @Override
85
    public void removeData(Player p) {
86
        UUID uuid = p.getUniqueId();
87
        lastClickTime.remove(uuid);
88
        deltaTimes.remove(uuid);
89
    }
90
}

How it counteracts this module

Hawk's FightSpeed records the tick delta between consecutive attacks and only logs deltas of 4 ticks or less, then averages the last 10 samples into an estimated CPS and punishes when the average exceeds maxCps, default 16 (FightSpeed.java lines 40-77). The samples are taken per InteractEntityEvent with the ATTACK action, so each of ComboOneHit's 50 packets is its own event. The delta between consecutive packets in the burst is 0 ticks, the average of ten zeros is zero, and the CPS estimate becomes 1 divided by 0, which the check explicitly anticipates with the comment 'if someone manages to get an Infinity, they're dumb af' and punishes on the spot.

The punish is per-sample with a VL of 1 each, so the burst racks up violations faster than the configurable VL decay can drain them. The RECORD_SENSITIVITY guard that normally filters out slow clicking is irrelevant because every delta in the burst is zero. The check sees the burst exactly as the wire presents it: ten or more attacks with no time between them, which is mechanically impossible for a human and immediately distinguishable from even the fastest autoclicker, whose inter-click deltas are at least a few ticks.

anticheat KillAura (attack packet frequency and swing gate)

KillAura.java114 lines · Java
1
package me.vrekt.arc.check.combat;
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.combat.FightData;
7
import me.vrekt.arc.utilties.LocationHelper;
8
import org.bukkit.ChatColor;
9
import org.bukkit.entity.Entity;
10
import org.bukkit.entity.Player;
11
import org.bukkit.util.Vector;
12
13
public class KillAura extends Check {
14
15
    private double maxAngle, maxReach;
16
    private int maxSwingTime, maxAttacks, maxAttackPackets;
17
18
    public KillAura() {
19
        super(CheckType.KILLAURA);
20
21
        maxAngle = Arc.getCheckManager().getValueDouble(CheckType.KILLAURA, "max-direction-angle");
22
        maxSwingTime = Arc.getCheckManager().getValueInt(CheckType.KILLAURA, "max-swing-time");
23
        maxReach = Arc.getCheckManager().getValueDouble(CheckType.KILLAURA, "max-reach");
24
        maxAttacks = Arc.getCheckManager().getValueInt(CheckType.KILLAURA, "max-attacks");
25
        maxAttackPackets = Arc.getCheckManager().getValueInt(CheckType.KILLAURA, "max-attack-packets");
26
27
    }
28
29
    public boolean check(FightData data, Player player) {
30
        result.reset();
31
32
        Entity last = data.getLastAttackedEntity();
33
        Entity entity = data.getAttackedEntity();
34
35
        // Calculate angle stuff.
36
        Vector playerLocation = player.getLocation().toVector();
37
        Vector entityLocation = entity.getLocation().toVector();
38
        double angle = entityLocation.subtract(playerLocation).angle(player.getLocation().getDirection());
39
40
        if (last != null && !entity.equals(last)) {
41
            // check the angle between the two entities
42
            Vector lastLocation = last.getLocation().toVector();
43
            double angleToLast = lastLocation.subtract(playerLocation).angle(player.getLocation().getDirection());
44
            double angleDifference = Math.abs(angleToLast - angle);
45
            double distanceDifference = LocationHelper.distance(last.getLocation(), entity.getLocation());
46
            if (angleDifference > maxAngle && distanceDifference <= maxReach) {
47
                getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Multi)");
48
                result.set(checkViolation(player, "Angle difference greater than allowed. a=" + angleDifference + " e=" + maxAngle));
49
            }
50
        }
51
52
        // check yaw difference.
53
        if (angle > maxAngle) {
54
            getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Direction)");
55
            result.set(checkViolation(player, "Angle distance greater than allowed. a=" + angle + " e=" + maxAngle));
56
        }
57
58
        // check swing time.
59
        long time = System.currentTimeMillis() - data.getLastArmSwing();
60
        if (time > maxSwingTime) {
61
            getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(NoSwing)");
62
            result.set(checkViolation(player, "Player did not swing their arm in time."));
63
        }
64
65
        // distance to entity excluding knockback.
66
        double distance = LocationHelper.distance(player.getLocation(), entity.getLocation().subtract(entity.getVelocity()));
67
        // check for reach
68
        if (distance > maxReach) {
69
            getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Reach)");
70
            result.set(checkViolation(player, "Entity is out of players range. d=" + distance + " e=" + maxReach));
71
        }
72
73
        // check max attacks
74
        if (data.getLastAttackCheck() == 0) {
75
            data.setLastAttackCheck(System.currentTimeMillis());
76
        }
77
        long lastAttack = System.currentTimeMillis() - data.getLastAttackCheck();
78
        if (lastAttack >= 1000) {
79
            // check if we exceeded the max attacks in the last second.
80
            int totalAttacks = data.getTotalAttacks();
81
            if (totalAttacks > maxAttacks) {
82
                getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Speed)");
83
                result.set(checkViolation(player, "Attacking too fast. a=" + totalAttacks + " e=" + maxAttacks));
84
            }
85
            // reset data for next check.
86
            data.setTotalAttacks(0);
87
            data.setLastAttackCheck(System.currentTimeMillis());
88
        }
89
90
        getCheck().setCheckName("KillAura");
91
        return result.failed();
92
    }
93
94
    public boolean checkFrequency(FightData data, Player player) {
95
        if (data.getLastAttackCheck() == 0) {
96
            data.setLastAttackCheck(System.currentTimeMillis());
97
            return false;
98
        }
99
100
        long time = System.currentTimeMillis() - data.getLastAttackCheck();
101
        if (time >= 1000) {
102
            data.setLastAttackCheck(System.currentTimeMillis());
103
            int totalPackets = data.getAttackPackets();
104
            if (totalPackets > maxAttackPackets) {
105
                data.setAttackPackets(0);
106
                getCheck().setCheckName("Kill Aura " + ChatColor.GRAY + "(Speed)");
107
                return checkViolation(player, "Attacking too fast a=" + totalPackets + " e=" + maxAttackPackets);
108
            }
109
        }
110
111
        return false;
112
    }
113
114
}

How it counteracts this module

Arc v2's KillAura check has two independent paths that both hit the burst. checkFrequency counts attack packets per second and flags when the count passes max-attack-packets, default 20 (config.yml killaura section), so the default 50-packet burst exceeds the ceiling two and a half times over, and the check's kick path applies at the configured violation level. The main check additionally enforces a swing deadline: time since the last arm swing must stay under max-swing-time, default 80ms (KillAura.java lines 58-63). ComboOneHit never swings, so once the player's last real swing ages past 80ms, every subsequent burst triggers the NoSwing violation as well as the Speed violation.

The direction and reach branches stay quiet, and that is the honest boundary: the burst always names the entity the player actually attacked, and the player's last movement packet aimed at it, so the angle and distance checks pass. The check still scores the module through the two rate and animation gates, which need none of the client's entity knowledge: the server counts packets and watches for swings from its own event stream. A setting of 20 or fewer packets per burst would slip under the attack-packet ceiling but still trip NoSwing the moment the swing deadline passes.

anticheat Direction (aim geometry, missed)

Direction.java239 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 org.bukkit.Location;
18
import org.bukkit.entity.Entity;
19
import org.bukkit.entity.LivingEntity;
20
import org.bukkit.entity.Player;
21
import org.bukkit.util.Vector;
22
23
import fr.neatmonster.nocheatplus.checks.Check;
24
import fr.neatmonster.nocheatplus.checks.CheckType;
25
import fr.neatmonster.nocheatplus.checks.moving.location.tracking.LocationTrace.ITraceEntry;
26
import fr.neatmonster.nocheatplus.compat.MCAccess;
27
import fr.neatmonster.nocheatplus.utilities.collision.CollisionUtil;
28
import fr.neatmonster.nocheatplus.utilities.math.TrigUtil;
29
30
/**
31
 * The Direction check will find out if a player tried to interact with something that's not in their field of view.
32
 */
33
public class Direction extends Check {
34
35
    /**
36
     * Instantiates a new direction check.
37
     */
38
    public Direction() {
39
        super(CheckType.FIGHT_DIRECTION);
40
    }
41
42
    /**
43
     * "Classic" check.
44
     * 
45
     * @param player
46
     *            the player
47
     * @param damaged
48
     *            the damaged
49
     * @return true, if successful
50
     */
51
    public boolean check(final Player player, final Location loc, 
52
            final Entity damaged, final boolean damagedIsFake, final Location dLoc, 
53
            final FightData data, final FightConfig cc) {
54
        boolean cancel = false;
55
56
        final MCAccess mcAccess = this.mcAccess.getHandle();
57
58
        // Safeguard, if entity is complex, this check will fail due to giant and hard to define hitboxes.
59
        //        if (damaged instanceof EntityComplex || damaged instanceof EntityComplexPart)
60
        if (!damagedIsFake && mcAccess.isComplexPart(damaged)) {
61
            return false;
62
        }
63
64
        // Find out how wide the entity is.
65
        final double width = damagedIsFake ? 0.6 : mcAccess.getWidth(damaged);
66
67
        // entity.height is broken and will always be 0, therefore. Calculate height instead based on boundingBox.
68
        final double height = damagedIsFake ? (damaged instanceof LivingEntity ? ((LivingEntity) damaged).getEyeHeight() : 1.75) : mcAccess.getHeight(damaged);
69
        
70
71
        // TODO: allow any hit on the y axis (might just adapt interface to use foot position + height)!
72
73
        // How far "off" is the player with their aim. We calculate from the players eye location and view direction to
74
        // the center of the target entity. If the line of sight is more too far off, "off" will be bigger than 0.
75
        final Vector direction = loc.getDirection();
76
77
        final double off;
78
		off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION);
79
        /*if (cc.directionStrict){
80
            off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION, 80.0, isPlayer);
81
        }
82
        else{
83
            // Also take into account the angle.
84
            off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), direction, dLoc.getX(), dLoc.getY() + height / 2D, dLoc.getZ(), width, height, TrigUtil.DIRECTION_PRECISION);
85
        } */
86
87
        if (off > 0.1) {
88
            // Player failed the check. Let's try to guess how far they were from looking directly to the entity...
89
            final Vector blockEyes = new Vector(dLoc.getX() - loc.getX(),  dLoc.getY() + height / 2D - loc.getY() - player.getEyeHeight(), dLoc.getZ() - loc.getZ());
90
            final double distance = blockEyes.crossProduct(direction).length() / direction.length();
91
92
            // Add the overall violation level of the check.
93
            data.directionVL += distance;
94
            // Execute whatever actions are associated with this check and the violation level and find out if we should
95
            // cancel the event.
96
            cancel = executeActions(player, data.directionVL, distance, cc.directionActions).willCancel();
97
98
            if (cancel) {
99
                // Deal an attack penalty time.
100
                data.attackPenalty.applyPenalty(cc.directionPenalty);
101
            }
102
        } else {
103
            // Reward the player by lowering their violation level.
104
            data.directionVL *= 0.8D;
105
        }
106
107
        return cancel;
108
    }
109
110
    /**
111
     * Data context for iterating over TraceEntry instances.
112
     * @param player
113
     * @param loc
114
     * @param damaged
115
     * @param damagedLoc
116
     * @param data
117
     * @param cc
118
     * @return
119
     */
120
    public DirectionContext getContext(final Player player, final Location loc, 
121
            final Entity damaged, final boolean damagedIsFake, final Location damagedLoc, 
122
            final FightData data, final FightConfig cc) {
123
        final DirectionContext context = new DirectionContext();
124
        // Find out how wide the entity is.
125
        if (damagedIsFake) {
126
            // Assume player / default.
127
            context.damagedComplex = false; // Later prefer bukkit based provider.
128
        }
129
        else {
130
            final MCAccess mcAccess = this.mcAccess.getHandle();
131
            context.damagedComplex = mcAccess.isComplexPart(damaged);
132
        }
133
        context.direction = loc.getDirection();
134
        context.lengthDirection = context.direction.length();
135
        return context;
136
    }
137
138
    /**
139
     * Check if the player fails the direction check, no change of FightData.
140
     * @param player
141
     * @param loc
142
     * @param damaged
143
     * @param dLoc
144
     * @param context
145
     * @param data
146
     * @param cc
147
     * @return
148
     */
149
    public boolean loopCheck(final Player player, final Location loc, 
150
            final Entity damaged, final ITraceEntry dLoc, 
151
            final DirectionContext context, 
152
            final FightData data, final FightConfig cc) {
153
154
        // Ignore complex entities for the moment.
155
        if (context.damagedComplex) {
156
            // TODO: Revise :p
157
            return false;
158
        }
159
        boolean cancel = false;
160
        boolean isPlayer = damaged instanceof Player;
161
162
        // TODO: allow any hit on the y axis (might just adapt interface to use foot position + height)!
163
164
        // How far "off" is the player with their aim. We calculate from the players eye location and view direction to
165
        // the center of the target entity. If the line of sight is more too far off, "off" will be bigger than 0.
166
        final double damagedBoxMarginHorizontal = dLoc.getBoxMarginHorizontal();
167
        final double damagedBoxMarginVertical = dLoc.getBoxMarginVertical();
168
        final double off;
169
        if (cc.directionStrict){
170
            off = CollisionUtil.combinedDirectionCheck(loc, player.getEyeHeight(), context.direction, dLoc.getX(), dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(), damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical, cc.directionloopprecision, cc.directionangleprecision, isPlayer);
171
        }
172
        else {
173
            // Also take into account the angle.
174
            off = CollisionUtil.directionCheck(loc, player.getEyeHeight(), 
175
                    context.direction, dLoc.getX(), 
176
                    dLoc.getY() + damagedBoxMarginVertical / 2D, dLoc.getZ(), 
177
                    damagedBoxMarginHorizontal * 2.0, damagedBoxMarginVertical, 
178
                    cc.directionloopprecision);
179
        }
180
181
        if (off > 0.0) {
182
            if (dLoc.isInside(loc.getX(), loc.getY() + player.getEyeHeight(), loc.getZ())) { // Inside box.
183
                context.minResult = 0.0;
184
            }
185
            else {
186
                if (off > 0.11) {
187
                    // Player failed the check. Let's try to guess how far they were from looking directly to the entity...
188
                    final Vector blockEyes = new Vector(dLoc.getX() - loc.getX(),  dLoc.getY() + damagedBoxMarginVertical / 2D - loc.getY() - player.getEyeHeight(), dLoc.getZ() - loc.getZ());
189
                    final double distance = blockEyes.crossProduct(context.direction).length() / context.lengthDirection;
190
                    context.minViolation = Math.min(context.minViolation, distance);
191
                    cancel = true;
192
                }
193
                context.minResult = Math.min(context.minResult, off);
194
            }
195
        } 
196
        else if (cc.directionFailAll) {
197
            context.minResult = 0.0;
198
        }
199
200
        return cancel;
201
    }
202
203
    /**
204
     * Apply changes to FightData according to check results (context), trigger violations.
205
     * @param player
206
     * @param loc
207
     * @param damaged
208
     * @param context
209
     * @param forceViolation
210
     * @param data
211
     * @param cc
212
     * @return
213
     */
214
    public boolean loopFinish(final Player player, final Location loc, final Entity damaged, final DirectionContext context, final boolean forceViolation, final FightData data, final FightConfig cc) {
215
        boolean cancel = false;
216
        final double off = forceViolation && context.minViolation != Double.MAX_VALUE ? context.minViolation : context.minResult;
217
        if (off == Double.MAX_VALUE) {
218
            return false;
219
        }
220
        else if (off > 0.1) {
221
            // Add the overall violation level of the check.
222
            data.directionVL += off;
223
224
            // Execute whatever actions are associated with this check and the violation level and find out if we should
225
            // cancel the event.
226
            cancel = executeActions(player, data.directionVL, off, cc.directionActions).willCancel();
227
228
            if (cancel) {
229
                // Deal an attack penalty time.
230
                data.attackPenalty.applyPenalty(cc.directionPenalty);
231
            }
232
        }
233
        else {
234
            // Reward the player by lowering their violation level.
235
            data.directionVL *= 0.8D;
236
        }
237
        return cancel;
238
    }
239
}

How it counteracts this module

NCP's fight Direction check measures the line of sight from the player's eye along the last reported look direction against the attacked entity's bounding box, using CollisionUtil.directionCheck with the entity's width, height and the configured precision (Direction.java lines 64-78). A player looking at the target passes with an off value of zero; a silent-aim attack that hits a target outside the view cone scores a violation. ComboOneHit inherits its target from the attack event, which by definition came from a real interaction with the entity, so the player's look is already on the target when the burst fires and Direction never sees an anomaly.

The entry is the honest boundary of the set: the burst's geometry is indistinguishable from a normal attack, and Direction is blind to rate, so it cannot contribute to scoring the module. The rate checks in this set are the ones that see the burst, and they see it because they count packets and watch swing timing rather than evaluating each attack's aim. This is also the pattern to remember for any client-side bot filter: a server check like Direction validates geometry from server state, while the client's entity filters decide who gets attacked, and the two never meet.

← Back to Analysis Hub