Memeware 7.3 Aura (Kill Aura) module 5 files, 359 lines

Memeware 7.3 Aura (Kill Aura): Full Source Analysis

Memeware 7.3's Aura is a three-mode killaura dispatcher: a single onUpdate handler forwards every UpdateEvent to one of three static helper classes, and each mode runs its own attack cadence and blocking logic.

me/memewaredevs/client/module/combat/Aura.java · GitHub source ↗

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

Analysis

Overview

Memeware 7.3's Aura is a three-mode killaura dispatcher: a single onUpdate handler forwards every UpdateEvent to one of three static helper classes, and each mode runs its own attack cadence and blocking logic. Single mode is a blockhit cycle that releases the held item with a C07 dig packet, attacks with C02 on the following tick, then re-blocks with a C08 use-item placement, all clocked by a shared 1000 / Click Speed timer. Multi mode gathers every living entity in range and sweeps the whole list with a C02 attack per target on each timer cycle, preceded by a silent C18PacketSpectate carrying a hardcoded CubeCraft UUID, with blocking gated by a Block Chance roll. Hypixel mode is the server-specific implementation: it randomizes the click window to between Click Speed minus 2 and Click Speed, snaps rotationYawHead and renderYawOffset in addition to the movement-packet look, and sends its re-block C08 to a random double-precision position so the server-side block state and the client-side flag stay decoupled. All modes share static state through Aura.isBlocking and Aura.currentEntity, and the module's onDisable releases the sword with a C07 RELEASE_USE_ITEM whenever the Single path left it raised.

Architecture

Aura.java registers 'Kill Aura' with a ModeSetting holding Single, Multi and Hypixel plus Click Speed (12, 1-20), Block Chance (60, 1-100), Range (6, 1-8), Auto Block, Keep Sprint and the Players/Animals/Monsters/Invisibles/Teams toggles. Its @Handler onUpdate is one lambda that branches on isMode and calls SingleAura.doUpdate, MultiAura.doUpdate or HypixelAura.doUpdate with the module, the event and the Minecraft instance. Module state lives in two public statics on Aura itself - isBlocking and currentEntity - while each helper keeps its own private statics: SingleAura owns a Timer and the block/unblock/unblocked flags, MultiAura owns a Timer, the target list, a rotating targetIndex and a Random for the block-chance roll, and HypixelAura owns a Timer plus block and stopServerBlocking. Because the helpers are stateless classes, switching modes mid-fight hands the next event to a fresh set of flags but keeps the shared isBlocking/currentEntity that render code and onDisable read. onDisable clears both statics and, when SingleAura.unblock is set, sends a C07 RELEASE_USE_ITEM at BlockPos(0.221, 0.221, 0.213) facing UP so a disable between a release and a re-block does not leave the player stuck blocking server-side. Notably the Teams setting is read nowhere: all three modes hardcode teams = false, and the target scans ignore the Players/Monsters/Animals flags, so the module attacks any qualifying living entity regardless of the UI toggles.

Mode dispatch and Hypixel specifics

The three modes differ in cadence and in how aggressively they hide the block state. Single mode targets one entity (first match in the loaded entity list, no sorting and no visibility test) and cycles C08 re-block on post updates, C07 release plus C02 attack on timer-fired pre updates. Multi mode rotates its aim through the target list one index per cycle while attacking every entry in the list on each timer fire, so its look direction (targets.get(targetIndex)) is usually not the entity it is actually hitting (Aura.currentEntity is set to targets.get(0)). Hypixel mode is the per-server special: it computes the effective click speed as MathUtils.getRandom(cps - 2, cps) when the setting is above 2, so at the default 12 the inter-attack interval is randomized between 50ms and 60ms, breaking the fixed period that consistency checks look for; below 3 the setting is used verbatim. It also writes rotations into three places at once - the UpdateEvent yaw/pitch for the movement packet plus rotationYawHead, rotationPitchHead and renderYawOffset - so the server sees the snap in the look packet while the render and head-tracking fields agree. Blocking state is tracked with the local stopServerBlocking flag: it arms when a target appears, and when the target list empties with autoBlock on, the mode sends a C07 RELEASE_USE_ITEM at BlockPos.ORIGIN facing DOWN so the server-side block is dropped on target loss, mirroring what Single mode's onDisable does on module disable.

Attack and autoblock packets

Single mode: on a post-phase update, if Aura.isBlocking (sword in hand, Auto Block on, CombatUtil.canBlock within range + 4) and the block flag is set, it sends C08PacketPlayerBlockPlacement with the fixed BlockPos(-0.2223, -0.132, -0.312), facing 255, the held item and a zero hit vector - the classic use-item-on-air right-click - and raises the unblock flag; when the timer fires on a pre update it sends C07 RELEASE_USE_ITEM at the same position offset down one block, swings (C0A), clears block, and the C02 ATTACK lands on the following update. Multi mode gates blocking on chance(Block Chance): on pre it queues C07 RELEASE_USE_ITEM at BlockPos.ORIGIN facing UP, on post it calls setItemInUse plus playerController.sendUseItem (which emits its own C08), and on each timer fire it loops the whole target list sending, per target, a silent C18PacketSpectate(CubeUtil.CUBECRAFT_UUID) followed by swingItem and a C02 ATTACK - so the sweep rate is targets-per-cycle times cycles-per-second. Hypixel mode condenses the cycle into one tick: on pre, when the randomized timer fires, it releases with C07 at BlockPos.ORIGIN facing DOWN, swings and attacks; on the same tick's post phase it re-blocks with C08 at a BlockPos built from RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE) on every axis, coordinates no real block can occupy, toggling Aura.isBlocking back on.

source Aura.java (mode dispatcher)

Aura.java60 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.module.combat;
3
4
import java.util.function.Consumer;
5
6
import me.hippo.api.lwjeb.annotation.Handler;
7
import me.memewaredevs.client.event.events.UpdateEvent;
8
import me.memewaredevs.client.module.Module;
9
import me.memewaredevs.client.module.combat.aura.HypixelAura;
10
import me.memewaredevs.client.module.combat.aura.MultiAura;
11
import me.memewaredevs.client.module.combat.aura.SingleAura;
12
import me.memewaredevs.client.util.packet.PacketUtil;
13
import net.minecraft.entity.EntityLivingBase;
14
import net.minecraft.network.play.client.C07PacketPlayerDigging;
15
import net.minecraft.util.BlockPos;
16
import net.minecraft.util.EnumFacing;
17
18
public class Aura extends Module {
19
20
	public static boolean isBlocking;
21
	public static EntityLivingBase currentEntity;
22
23
	public Aura() {
24
		super("Kill Aura", 19, Module.Category.COMBAT);
25
		addModes("Single", "Multi", "Hypixel");
26
		addInt("Click Speed", 12.0, 1.0, 20.0);
27
		addInt("Block Chance", 60.0, 1.0, 100.0);
28
		addDouble("Range", 6.0, 1.0, 8.0);
29
		addBoolean("Auto Block", true);
30
		addBoolean("Keep Sprint", true);
31
		addBoolean("Players", true);
32
		addBoolean("Animals", true);
33
		addBoolean("Monsters", true);
34
		addBoolean("Invisibles", true);
35
		addBoolean("Teams", true);
36
	}
37
38
	@Handler
39
	public Consumer<UpdateEvent> onUpdate = (event) -> {
40
		if (isMode("Single")) {
41
			SingleAura.doUpdate(this, event, mc);
42
		}
43
		if (isMode("Multi")) {
44
			MultiAura.doUpdate(this, event, mc);
45
		}
46
		if (isMode("Hypixel")) {
47
			HypixelAura.doUpdate(this, event, mc);
48
		}
49
	};
50
51
	@Override
52
	public void onDisable() {
53
		isBlocking = false;
54
		currentEntity = null;
55
		if (SingleAura.unblock) {
56
			PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,
57
					new BlockPos(0.221, 0.221, 0.213), EnumFacing.UP));
58
		}
59
	}
60
}

What this file does

The module shell: registers 'Kill Aura' with the Single/Multi/Hypixel mode selector and the Click Speed, Block Chance, Range, Auto Block, Keep Sprint and entity-type settings, then dispatches every UpdateEvent to the matching helper's static doUpdate. It owns the shared statics Aura.isBlocking and Aura.currentEntity that all three helpers write and that the rest of the client reads, and its onDisable clears them before sending a C07 RELEASE_USE_ITEM at BlockPos(0.221, 0.221, 0.213) facing UP when SingleAura.unblock is true, so a disable between a release and a re-block drops the server-side block. The Teams setting registered here is never consulted by any mode; every helper hardcodes teams = false.

source SingleAura.java (general mode)

SingleAura.java66 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.module.combat.aura;
3
4
import me.memewaredevs.client.event.events.UpdateEvent;
5
import me.memewaredevs.client.module.combat.Aura;
6
import me.memewaredevs.client.module.combat.AutoPotion;
7
import me.memewaredevs.client.util.combat.CombatUtil;
8
import me.memewaredevs.client.util.combat.RotationUtils;
9
import me.memewaredevs.client.util.misc.Timer;
10
import me.memewaredevs.client.util.packet.PacketUtil;
11
import net.minecraft.client.Minecraft;
12
import net.minecraft.entity.Entity;
13
import net.minecraft.entity.EntityLivingBase;
14
import net.minecraft.item.ItemSword;
15
import net.minecraft.network.play.client.C02PacketUseEntity;
16
import net.minecraft.network.play.client.C07PacketPlayerDigging;
17
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
18
import net.minecraft.util.BlockPos;
19
import net.minecraft.util.EnumFacing;
20
21
public class SingleAura {
22
    private static Timer timer = new Timer();
23
    private static boolean block;
24
    public static boolean unblock;
25
    private static boolean unblocked;
26
    public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {
27
        boolean invisible = aura.getBool("Invisibles");
28
        double range = aura.getDouble("Range");
29
        boolean players = aura.getBool("Players");
30
        boolean monsters = aura.getBool("Monsters");
31
        boolean teams = false;
32
        final Entity entity = CombatUtil.getTarget(teams, monsters, players, range, invisible);
33
        final boolean autoBlock = aura.getBool("Auto Block");
34
        final long clickSpeed = aura.getDouble("Click Speed").longValue();
35
        Aura.isBlocking = mc.thePlayer.getHeldItem() != null
36
                && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword && autoBlock && CombatUtil.canBlock(
37
                teams, false, true, range + 4.0, true);
38
        BlockPos a = new BlockPos(-0.2223, -0.132, -0.312);
39
        if (Aura.isBlocking) {
40
            if (e.isPost() && block) {
41
                PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(a, 255, mc.thePlayer.getHeldItem(), 0.0F, 0.0F, 0.0F));
42
                unblock = true;
43
            }
44
        }
45
        block = true;
46
        if (AutoPotion.isPotting())
47
            return;
48
        Aura.currentEntity = (EntityLivingBase) entity;
49
        if (entity != null) {
50
            final float[] rots = RotationUtils.getRotations((EntityLivingBase) entity);
51
            e.setYaw(rots[0]);
52
            e.setPitch(rots[1]);
53
            if (unblocked) {
54
                mc.thePlayer.swingItem();
55
                PacketUtil.sendPacket(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
56
                unblocked = false;
57
            }
58
            if (timer.delay(1000L / clickSpeed) && e.isPre()) {
59
                PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, a.offsetDown(), EnumFacing.UP));
60
                unblocked = true;
61
                block = false;
62
                timer.reset();
63
            }
64
        }
65
    }
66
}

What this file does

doUpdate implements the single-target blockhit state machine: it computes Aura.isBlocking from the held-item, Auto Block and canBlock(range + 4) conditions, fires the C08 use-item-on-air placement on post updates while the block flag is set, re-arms block every update, short-circuits while AutoPotion.isPotting(), snaps the event's yaw/pitch to RotationUtils.getRotations of the first in-range entity, and gated by the unblocked flag sends swingItem plus C02 ATTACK on the update after a timer-fired C07 RELEASE_USE_ITEM at the fixed position offset down one block. The C02 never fires from the blocking state, and the fixed BlockPos(-0.2223, -0.132, -0.312) with facing 255 makes the C08 a block-hold instead of a placement. It also exposes the public unblock flag that Aura.onDisable consumes.

source MultiAura.java (multi-target mode)

MultiAura.java80 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.module.combat.aura;
3
4
import me.memewaredevs.client.event.events.UpdateEvent;
5
import me.memewaredevs.client.module.combat.Aura;
6
import me.memewaredevs.client.util.CubeUtil;
7
import me.memewaredevs.client.util.combat.CombatUtil;
8
import me.memewaredevs.client.util.combat.RotationUtils;
9
import me.memewaredevs.client.util.misc.Timer;
10
import me.memewaredevs.client.util.packet.PacketUtil;
11
import net.minecraft.client.Minecraft;
12
import net.minecraft.entity.Entity;
13
import net.minecraft.entity.EntityLivingBase;
14
import net.minecraft.item.ItemSword;
15
import net.minecraft.network.play.client.C02PacketUseEntity;
16
import net.minecraft.network.play.client.C07PacketPlayerDigging;
17
import net.minecraft.network.play.client.C18PacketSpectate;
18
import net.minecraft.util.BlockPos;
19
import net.minecraft.util.EnumFacing;
20
21
import java.util.ArrayList;
22
import java.util.List;
23
import java.util.Random;
24
25
public class MultiAura {
26
    private static Timer timer = new Timer();
27
    public static List<EntityLivingBase> targets = new ArrayList<>();
28
    private static int index = 0;
29
    private static Timer t = new Timer();
30
    private static final Random RANDOM_NUMBER_GENERATOR = new Random();
31
    private static int targetIndex;
32
    public static boolean chance(int percent) {
33
        return RANDOM_NUMBER_GENERATOR.nextInt(100) <= percent;
34
    }
35
    public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {
36
        double range = aura.getDouble("Range");
37
        final int blockPercentage = aura.getDouble("Block Chance").intValue();
38
        final boolean teams = false;
39
        final List<EntityLivingBase> targets = CombatUtil.getTargets(teams, 100, false, true, range, true);
40
        final boolean autoBlock = aura.getBool("Auto Block");
41
        final long clickSpeed = aura.getDouble("Click Speed").longValue();
42
        Aura.isBlocking = chance(blockPercentage) && mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemSword
43
                && autoBlock && CombatUtil.canBlock(teams, false, true, range + 4.0, true);
44
        if (Aura.isBlocking) {
45
            if (e.isPost()) {
46
                mc.thePlayer.setItemInUse(mc.thePlayer.getHeldItem(), 140);
47
                mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, mc.thePlayer.getHeldItem());
48
            } else {
49
                mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(
50
                        C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP));
51
            }
52
        }
53
        if (!targets.isEmpty()) {
54
            if (targetIndex >= targets.size()) {
55
                targetIndex = 0;
56
            }
57
            Aura.currentEntity = targets.get(0);
58
            float[] rots = RotationUtils.getRotations(targets.get(targetIndex));
59
            e.setYaw(rots[0]);
60
            e.setPitch(rots[1]);
61
        }
62
        else {
63
            targetIndex = 0;
64
            Aura.currentEntity = null;
65
        }
66
        if (e.isPost()) {
67
            return;
68
        }
69
        if (!timer.delay(1000L / clickSpeed)) {
70
            return;
71
        }
72
        for (final Entity entity : targets) {
73
            PacketUtil.sendPacketSilent(new C18PacketSpectate(CubeUtil.CUBECRAFT_UUID));
74
            mc.thePlayer.swingItem();
75
            mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
76
        }
77
        ++targetIndex;
78
        timer.reset();
79
    }
80
}

What this file does

doUpdate collects every qualifying living entity in range via CombatUtil.getTargets, gates blocking on a Random roll against Block Chance (in addition to the sword/auto-block/canBlock conditions), releases with C07 at BlockPos.ORIGIN facing UP on pre updates and re-blocks through setItemInUse plus playerController.sendUseItem on post updates, and on each timer fire iterates the whole target list sending a silent C18PacketSpectate carrying the hardcoded CubeUtil.CUBECRAFT_UUID, swingItem and a C02 ATTACK per target. The look is aimed at targets.get(targetIndex) with targetIndex advancing once per cycle while Aura.currentEntity is set to targets.get(0), so rotation and victim diverge as the index walks, and the mode returns early on post updates so attacks only fire from the pre phase.

source HypixelAura.java (Hypixel-specific mode)

HypixelAura.java88 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.module.combat.aura;
3
4
import org.apache.commons.lang3.RandomUtils;
5
6
import me.memewaredevs.client.event.events.UpdateEvent;
7
import me.memewaredevs.client.module.combat.Aura;
8
import me.memewaredevs.client.util.combat.CombatUtil;
9
import me.memewaredevs.client.util.combat.RotationUtils;
10
import me.memewaredevs.client.util.misc.Timer;
11
import net.minecraft.client.Minecraft;
12
import net.minecraft.entity.Entity;
13
import net.minecraft.entity.EntityLivingBase;
14
import net.minecraft.item.ItemSword;
15
import net.minecraft.network.play.client.C02PacketUseEntity;
16
import net.minecraft.network.play.client.C07PacketPlayerDigging;
17
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
18
import net.minecraft.util.BlockPos;
19
import net.minecraft.util.EnumFacing;
20
import optifine.MathUtils;
21
22
public class HypixelAura {
23
	private static Timer timer = new Timer();
24
	private static boolean block, stopServerBlocking;
25
26
	public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {
27
		boolean invisible = aura.getBool("Invisibles");
28
		double range = aura.getDouble("Range");
29
		boolean players = aura.getBool("Players");
30
		boolean monsters = aura.getBool("Monsters");
31
		boolean teams = false;
32
		final Entity entity = CombatUtil.getTarget(teams, monsters, players, range, invisible);
33
		final boolean autoBlock = aura.getBool("Auto Block");
34
		final long clickSpeed = aura.getDouble("Click Speed").longValue() <= 2
35
				? aura.getDouble("Click Speed").longValue()
36
				: ((long) MathUtils.getRandom(aura.getDouble("Click Speed").longValue() - 2,
37
						aura.getDouble("Click Speed").longValue()));
38
		boolean doBlock = mc.thePlayer.getHeldItem() != null
39
				&& mc.thePlayer.getHeldItem().getItem() instanceof ItemSword && autoBlock
40
				&& CombatUtil.canBlock(teams, false, true, range + 0.3, true);
41
		boolean canBlockSword = (mc.thePlayer.getHeldItem() != null) && ((mc.thePlayer.isBlocking())
42
				|| ((mc.thePlayer.isUsingItem())
43
						&& ((mc.thePlayer.getCurrentEquippedItem().getItem() instanceof ItemSword)))
44
				|| (((mc.thePlayer.getHeldItem().getItem() instanceof ItemSword))
45
						&& (mc.gameSettings.keyBindUseItem.pressed))
46
				|| ((mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)));
47
48
		Aura.currentEntity = (EntityLivingBase) entity;
49
50
		if (entity == null && stopServerBlocking && autoBlock) {
51
			mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(
52
					C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
53
			Aura.isBlocking = false;
54
		}
55
56
		if (entity != null) {
57
			stopServerBlocking = true;
58
			float[] rotations = RotationUtils.getRotations((EntityLivingBase) entity);
59
			e.setYaw(rotations[0]);
60
			e.setPitch(rotations[1]);
61
			mc.thePlayer.rotationYawHead = rotations[0];
62
			mc.thePlayer.rotationPitchHead = rotations[1];
63
			mc.thePlayer.renderYawOffset = rotations[0];
64
			if (e.isPre()) {
65
				if (timer.delay(1000 / clickSpeed)) {
66
					if (autoBlock && Aura.isBlocking) {
67
						mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(
68
								C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
69
						Aura.isBlocking = false;
70
					}
71
					mc.thePlayer.swingItem();
72
					mc.thePlayer.sendQueue
73
							.addToSendQueue(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
74
					timer.reset();
75
				}
76
			} else if (e.isPost()) {
77
				if (autoBlock && !Aura.isBlocking && canBlockSword) {
78
					mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(
79
							new BlockPos(RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE),
80
									RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE),
81
									RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE)),
82
							255, Minecraft.getMinecraft().thePlayer.getHeldItem(), 0, 0, 0));
83
					Aura.isBlocking = true;
84
				}
85
			}
86
		}
87
	}
88
}

What this file does

The server-specific implementation. It randomizes the effective click speed with MathUtils.getRandom(Click Speed - 2, Click Speed) whenever the setting exceeds 2, so the inter-attack delay jitters instead of being a fixed 1000 / cps period; snaps rotationYawHead, rotationPitchHead and renderYawOffset alongside the event yaw/pitch so the head and render fields agree with the movement-packet look; arms stopServerBlocking while a target exists and sends a C07 RELEASE_USE_ITEM at BlockPos.ORIGIN facing DOWN when the target list empties; and on each timer-fired pre update releases, swings and attacks, then re-blocks on the same tick's post phase with a C08 whose BlockPos is built from RandomUtils.nextDouble(Double.MIN_VALUE, Double.MAX_VALUE) on all three axes - coordinates no real block can occupy - toggling Aura.isBlocking through the whole cycle. The canBlockSword expression is effectively always true with a sword equipped, which is what lets the re-block fire every cycle.

source RotationUtils.java

RotationUtils.java65 lines · JavaOriginal ↗
1
2
package me.memewaredevs.client.util.combat;
3
4
import me.memewaredevs.client.util.blocks.position.Vec3d;
5
import me.memewaredevs.client.util.misc.MinecraftUtil;
6
import net.minecraft.client.Minecraft;
7
import net.minecraft.entity.Entity;
8
import net.minecraft.entity.EntityLivingBase;
9
import net.minecraft.util.MathHelper;
10
11
public class RotationUtils {
12
13
	static {
14
15
	}
16
17
	public static float[] getRotations(EntityLivingBase ent) {
18
		double x = ent.posX;
19
		double y = ent.posY + ent.getEyeHeight() / 2.0f;
20
		double z = ent.posZ;
21
		return RotationUtils.getRotationFromPosition(x, y, z);
22
	}
23
24
	public static float[] doScaffoldRotations(Vec3d vec) {
25
		double diffX = vec.xCoord - MinecraftUtil.mc.thePlayer.posX;
26
		double diffY = vec.yCoord - (MinecraftUtil.mc.thePlayer.boundingBox.minY);
27
		double diffZ = vec.zCoord - MinecraftUtil.mc.thePlayer.posZ;
28
		double dist = MathHelper.sqrt(diffX * diffX + diffZ * diffZ);
29
		float yaw = (float) (Math.toDegrees(Math.atan2(diffZ, diffX)));
30
		float pitch = (float) -Math.toDegrees(Math.atan2(diffY, dist));
31
		return new float[] {
32
				MinecraftUtil.mc.thePlayer.rotationYaw
33
						+ MathHelper.wrapAngleTo180_float(yaw - MinecraftUtil.mc.thePlayer.rotationYaw),
34
				MinecraftUtil.mc.thePlayer.rotationPitch
35
						+ MathHelper.wrapAngleTo180_float(pitch - MinecraftUtil.mc.thePlayer.rotationPitch) };
36
	}
37
38
	public static float[] getBowAngles(Entity entity) {
39
		double xDelta = entity.posX - entity.lastTickPosX;
40
		double zDelta = entity.posZ - entity.lastTickPosZ;
41
		double d = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity) % 0.8;
42
		boolean sprint = entity.isSprinting();
43
		double xMulti = d / 0.8 * xDelta * (sprint ? 1.25 : 1.0);
44
		double zMulti = d / 0.8 * zDelta * (sprint ? 1.25 : 1.0);
45
		double x = entity.posX + xMulti - Minecraft.getMinecraft().thePlayer.posX;
46
		double z = entity.posZ + zMulti - Minecraft.getMinecraft().thePlayer.posZ;
47
		double y = Minecraft.getMinecraft().thePlayer.posY + Minecraft.getMinecraft().thePlayer.getEyeHeight()
48
				- (entity.posY + entity.getEyeHeight());
49
		double dist = Minecraft.getMinecraft().thePlayer.getDistanceToEntity(entity);
50
		float yaw = (float) Math.toDegrees(Math.atan2(z, x)) - 90.0f;
51
		float pitch = (float) Math.toDegrees(Math.atan2(y, dist));
52
		return new float[] { yaw, pitch };
53
	}
54
55
	public static float[] getRotationFromPosition(double x, double y, double z) {
56
		double xDiff = x - Minecraft.getMinecraft().thePlayer.posX;
57
		double zDiff = z - Minecraft.getMinecraft().thePlayer.posZ;
58
		double yDiff = y - Minecraft.getMinecraft().thePlayer.posY - 1.2;
59
60
		double dist = MathHelper.sqrt_double(xDiff * xDiff + zDiff * zDiff);
61
		float yaw = (float) (Math.atan2(zDiff, xDiff) * 180.0D / 3.141592653589793D) - 90.0F;
62
		float pitch = (float) -(Math.atan2(yDiff, dist) * 180.0D / 3.141592653589793D);
63
		return new float[] { yaw, pitch };
64
	}
65
}

What this file does

getRotations aims at the target's position plus half its eye height and hands the delta to getRotationFromPosition, which subtracts a fixed 1.2-block eye offset from the player's posY and converts the horizontal and vertical deltas into yaw and pitch with atan2, returning both as an instant snap with no smoothing or turn-speed limit. Every mode writes these values into the UpdateEvent, so the next movement packet carries the full snap, and Hypixel mode additionally copies them into the head and render fields. doScaffoldRotations and getBowAngles are unrelated helpers sharing the same atan2 math, used by other modules, not by Aura.

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 FightSpeed (attack-rate window)

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 measures the gap between consecutive C02 ATTACK interactions in client ticks. It only logs a click when the gap is at most RECORD_SENSITIVITY (4) ticks, accumulates 10 samples, and computes the average CPS as 1 / ((sum / 10) / 20); an average above MAX_CPS (16 by default) punishes and rewards otherwise. Against Multi mode this is a guaranteed flag: the mode sends one C02 per target in the same tick, so consecutive deltas are 0, the sum is 0, and the CPS computation divides by zero and produces Infinity, which the check punishes outright. Single and Hypixel modes hit the same wall at the top of the range: a sustained 18-20 CPS trips the 16 CPS cap after 10 samples, and Hypixel's randomized window (cps - 2 to cps) does not help because the average still lands at the setting. The default 12 CPS with a roughly 50ms per-tick jitter sits under the cap, which is the config the module ships with.

anticheat FightHitbox (lag-compensated hitbox ray trace)

FightHitbox.java232 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.Cancelless;
23
import me.islandscout.hawk.check.CustomCheck;
24
import me.islandscout.hawk.event.Event;
25
import me.islandscout.hawk.event.InteractEntityEvent;
26
import me.islandscout.hawk.event.MoveEvent;
27
import me.islandscout.hawk.util.*;
28
import me.islandscout.hawk.wrap.block.WrappedBlock;
29
import me.islandscout.hawk.wrap.entity.WrappedEntity;
30
import org.bukkit.GameMode;
31
import org.bukkit.Location;
32
import org.bukkit.Material;
33
import org.bukkit.block.Block;
34
import org.bukkit.entity.Entity;
35
import org.bukkit.entity.Player;
36
import org.bukkit.util.BlockIterator;
37
import org.bukkit.util.Vector;
38
39
import java.util.HashMap;
40
import java.util.Map;
41
import java.util.UUID;
42
43
/**
44
 * The hit detection in Minecraft is mostly determined by the client,
45
 * thus servers are left to trust the client. (There are a few exceptions
46
 * for the unmodified Notchian server such as preventing hits exceeding 6
47
 * blocks from the target entity). This poses a problem for players and
48
 * server owners since players can modify the client to manipulate hit
49
 * detection and allow for cheating when in combat with other players.
50
 *
51
 * Hawk’s hitbox checking aims to detect cheating during player vs.
52
 * player combat by validating hits on the server. When the server
53
 * receives an interaction packet from the client, Hawk gets the client’s
54
 * last known position and next direction, and uses it to perform a ray
55
 * trace test on the victim’s hitbox. Before the ray-trace test begins,
56
 * though, Hawk must factor in latency by rewinding the victim’s hitbox
57
 * to an appropriate time based on the client’s ping latency. To
58
 * accomplish this, Hawk keeps a history of players’ positions and
59
 * timestamps in a table and it retrieves a position that best
60
 * approximates where it appeared to the client when the client attacked
61
 * it. Hawk then performs the ray-trace test to determine whether the
62
 * client landed the hit or not. Although the system may produce false
63
 * positives with clients on unstable connections, it is a fair tradeoff
64
 * between user experience and cheat prevention.
65
 *
66
 * There are other sources of error which will probably not be accounted
67
 * for in Hawk anytime soon. Other sources of error include:
68
 *   - The client receives entity relative moves in 1/32 block precision.
69
 *   - The client holds off one tick to smoothly animate other players
70
 *     on the screen in the case of slight network jitter. It will
71
 *     linearly interpolate from the last position to the latest
72
 *     position up to 3 ticks if it doesn't receive a relative move
73
 *     packet to update the player's position.
74
 *   - The client will predict the motion of some entities, such as
75
 *     arrows. If there is latency and something unexpected happens
76
 *     to the entity, the client may desynchronize from the server.
77
 *
78
 * In most cases, the client uses the current frame's yaw and pitch to
79
 * compute the direction vector for the attack hit-scan. Fortunately,
80
 * ticking and rendering is done in the same thread. Unfortunately, in
81
 * the tick stack, attacking is done before sending yaw/pitch updates
82
 * to the server, which means that we must wait until the next flying
83
 * packet to get the direction of the hit-scan.
84
 *
85
 * For realtime protection, it's best to use the EntityInteractDirection
86
 * check. It actively enforces directions, but it extrapolates the
87
 * yaw/pitch because of how the client hit-scanning works.
88
 */
89
public class FightHitbox extends CustomCheck implements Cancelless {
90
91
    private final double MAX_REACH;
92
    private final int PING_LIMIT;
93
    private final boolean CHECK_OTHER_ENTITIES;
94
    private final boolean LAG_COMPENSATION;
95
    private final boolean DEBUG_HITBOX;
96
    private final boolean DEBUG_RAY;
97
    private final boolean CHECK_OCCLUSION;
98
    private final boolean CHECK_BOX_INTERSECTION;
99
    private final double BOX_EPSILON = 0.005;
100
101
    private Map<UUID, InteractEntityEvent> lastInteractionMap;
102
103
    public FightHitbox() {
104
        super("fighthitbox", false, 5, 10000, 0.95, 5000, "%player% failed combat hitbox. %type% VL: %vl%", null);
105
        CHECK_BOX_INTERSECTION = (boolean) customSetting("checkBoxIntersection", "", true);
106
        CHECK_OCCLUSION = (boolean) customSetting("checkOccluding", "", false);
107
        MAX_REACH = (double) customSetting("maxReach", "", 3.1);
108
        CHECK_OTHER_ENTITIES = (boolean) customSetting("checkOtherEntities", "", false);
109
        LAG_COMPENSATION = (boolean) customSetting("lagCompensation", "", true);
110
        PING_LIMIT = (int) customSetting("pingLimit", "", -1);
111
        DEBUG_HITBOX = (boolean) customSetting("hitbox", "debug", false);
112
        DEBUG_RAY = (boolean) customSetting("ray", "debug", false);
113
        lastInteractionMap = new HashMap<>();
114
    }
115
116
    @Override
117
    protected void check(Event event) {
118
        if(event instanceof InteractEntityEvent)
119
            processHit((InteractEntityEvent)event);
120
        else if(event instanceof MoveEvent) {
121
            InteractEntityEvent interactEntityEvent = lastInteractionMap.get(event.getHawkPlayer().getUuid());
122
            if(interactEntityEvent != null) {
123
                MoveEvent move = (MoveEvent) event;
124
125
                float yaw;
126
                float pitch;
127
                //In 1.8, the yaw of the cursor is behind by one tick.
128
                if(event.getHawkPlayer().getClientVersion() == 8) {
129
                    yaw = event.getHawkPlayer().getYaw();
130
                } else {
131
                    yaw = move.getTo().getYaw();
132
                }
133
                pitch = move.getTo().getPitch();
134
135
                processDirection(interactEntityEvent, yaw, pitch);
136
            }
137
            lastInteractionMap.put(event.getHawkPlayer().getUuid(), null);
138
        }
139
    }
140
141
    private void processHit(InteractEntityEvent e) {
142
        lastInteractionMap.put(e.getHawkPlayer().getUuid(), e);
143
    }
144
145
    private void processDirection(InteractEntityEvent e, float yaw, float pitch) {
146
        Entity entity = e.getEntity();
147
        if (!(entity instanceof Player) && !CHECK_OTHER_ENTITIES)
148
            return;
149
        Player attacker = e.getPlayer();
150
        int ping = ServerUtils.getPing(attacker);
151
        if (ping > PING_LIMIT && PING_LIMIT != -1)
152
            return;
153
154
        HawkPlayer att = e.getHawkPlayer();
155
        Location attackerEyeLocation = att.getPosition().clone().add(new Vector(0, 1.62, 0)).toLocation(att.getWorld());
156
        Vector attackerDirection = MathPlus.getDirection(yaw, pitch);
157
158
        double maxReach = MAX_REACH;
159
        if (attacker.getGameMode() == GameMode.CREATIVE)
160
            maxReach += 1.9;
161
162
        Vector victimLocation;
163
        if (LAG_COMPENSATION)
164
            //No need to add 50ms; the move and attack are already chronologically so close together
165
            victimLocation = hawk.getLagCompensator().getHistoryLocation(ping, e.getEntity()).toVector();
166
        else
167
            victimLocation = e.getEntity().getLocation().toVector();
168
169
        Vector eyePos;
170
        if(e.getHawkPlayer().isInVehicle()) {
171
            eyePos = hawk.getLagCompensator().getHistoryLocation(ping, e.getPlayer()).toVector();
172
            eyePos.setY(eyePos.getY() + e.getPlayer().getEyeHeight());
173
        }
174
        else {
175
            eyePos = new Vector(attackerEyeLocation.getX(), attacker.isSneaking() ? attackerEyeLocation.getY() - 0.08 : attackerEyeLocation.getY(), attackerEyeLocation.getZ());
176
        }
177
        Vector direction = new Vector(attackerDirection.getX(), attackerDirection.getY(), attackerDirection.getZ());
178
        Ray attackerRay = new Ray(eyePos, direction);
179
180
        AABB victimAABB;
181
        victimAABB = WrappedEntity.getWrappedEntity(entity).getHitbox(victimLocation);
182
        victimAABB.expand(BOX_EPSILON, BOX_EPSILON, BOX_EPSILON);
183
184
        Vector intersectVec3d = victimAABB.intersectsRay(attackerRay, 0, Float.MAX_VALUE);
185
186
        if (DEBUG_HITBOX) {
187
            victimAABB.highlight(hawk, attacker.getWorld(), 0.29);
188
        }
189
190
        if (DEBUG_RAY) {
191
            attackerRay.highlight(hawk, attacker.getWorld(), maxReach, 0.1);
192
        }
193
194
        if (intersectVec3d != null) {
195
            Location intersect = new Location(attacker.getWorld(), intersectVec3d.getX(), intersectVec3d.getY(), intersectVec3d.getZ());
196
            double interDistance = intersect.distance(attackerEyeLocation);
197
            if (interDistance > maxReach) {
198
                punish(att, 1, true, e, new Placeholder("type", "Reach: " + MathPlus.round(interDistance, 2) + "m"));
199
                return;
200
            }
201
            if (CHECK_OCCLUSION && interDistance > 1D) {
202
                BlockIterator iter = new BlockIterator(attacker.getWorld(), eyePos, attackerDirection, 0, (int) interDistance + 1);
203
                while (iter.hasNext()) {
204
                    Block bukkitBlock = iter.next();
205
206
                    if (bukkitBlock.getType() == Material.AIR || bukkitBlock.isLiquid())
207
                        continue;
208
209
                    WrappedBlock b = WrappedBlock.getWrappedBlock(bukkitBlock, att.getClientVersion());
210
                    Vector intersection = b.getHitBox().intersectsRay(new Ray(attackerEyeLocation.toVector(), attackerDirection), 0, Float.MAX_VALUE);
211
                    if (intersection != null) {
212
                        if (intersection.distance(eyePos) < interDistance) {
213
                            punish(att, 1, true, e, new Placeholder("type", "Interacted through " + b.getBukkitBlock().getType()));
214
                            return;
215
                        }
216
                    }
217
                }
218
219
            }
220
        } else if (CHECK_BOX_INTERSECTION) {
221
            punish(att, 1, true, e, new Placeholder("type", "Did not hit hitbox."));
222
            return;
223
        }
224
225
        reward(att); //reward player
226
    }
227
228
    @Override
229
    public void removeData(Player p) {
230
        lastInteractionMap.remove(p.getUniqueId());
231
    }
232
}

How it counteracts this module

FightHitbox re-derives hit validity server-side instead of trusting the client. It defers each attack to the next MoveEvent so the ray uses the yaw the client actually attacked with (1.8 sends the C02 before the look update that describes it), then casts from the attacker's eye location along that direction against the victim's hitbox, rewound through Hawk's lag compensator by the attacker's ping and expanded by a 0.005 epsilon. maxReach defaults to 3.1 blocks (5.0 in creative); an intersection beyond it punishes the measured reach, a miss punishes 'Did not hit hitbox.', and with occlusion enabled a block before the victim punishes 'Interacted through <block>'. Every mode here attacks at Range 6-8 with no canEntityBeSeen call, so each hit is 3-5 blocks over the cap and every wall hit is a block occlusion, which means the check fires on essentially every C02 from any of the three modes until the user drops Range to 3 or below.

anticheat MultiAction (interact while blocking)

MultiAction.java68 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;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.CustomCheck;
23
import me.islandscout.hawk.event.*;
24
import me.islandscout.hawk.util.Debug;
25
import me.islandscout.hawk.util.Pair;
26
import me.islandscout.hawk.util.ServerUtils;
27
import me.islandscout.hawk.wrap.entity.MetaData;
28
29
public class MultiAction extends CustomCheck {
30
31
    public MultiAction() {
32
        super("multiaction", false, 0, 10, 0.95, 5000, "%player% failed multi-action, VL: %vl%", null);
33
    }
34
35
    @Override
36
    protected void check(Event event) {
37
38
        //trigger only if we send dig status, interact with entity, terrain, or held-item
39
        if(!(event instanceof InteractEntityEvent ||
40
                event instanceof InteractWorldEvent ||
41
                event instanceof BlockDigEvent ||
42
                event instanceof InteractItemEvent))
43
            return;
44
45
        HawkPlayer pp = event.getHawkPlayer();
46
47
        //interacting while using item (not a use item event and not using item)
48
        if(!(event instanceof InteractItemEvent) && pp.getClientVersion() == 8 &&
49
                (pp.isBlocking() || pp.isConsumingOrPullingBowMetadataIncluded())) {
50
            punish(pp, 1, true, event);
51
            event.resync();
52
        }
53
        //interacting while digging (digging and not a non-start dig event. implies that you cannot start digging while already digging)
54
        else if(pp.getClientVersion() == 8 && pp.isDigging() &&
55
                !(event instanceof BlockDigEvent && ((BlockDigEvent) event).getDigAction() != BlockDigEvent.DigAction.START)) {
56
            punish(pp, 1, true, event);
57
            //TODO this is where high efficiency tools flag. The dig packet is START.
58
            // One way to fix this is to set HawkPlayer#isDigging() to false on Event#preProcess() if dig packet is START,
59
            // though, this will require studying the server logic to avoid opening exploits.
60
            // Another way is to compute the dig speed of the item in hand and see whether this warrants an exception.
61
            // This is much harder to do.
62
            event.resync();
63
        }
64
        else {
65
            reward(pp);
66
        }
67
    }
68
}

How it counteracts this module

MultiAction flags interactions that arrive while the server-side item-use state says the player is blocking or using an item. It triggers on InteractEntityEvent, InteractWorldEvent, BlockDigEvent and InteractItemEvent, and for 1.8 clients punishes and resyncs when a C02 or C08 arrives while HawkPlayer.isBlocking() or isConsumingOrPullingBowMetadataIncluded() is true. The module's blockhit order is built to dodge exactly this: every mode sends the C07 RELEASE_USE_ITEM before the C02 sweep, clearing the use-item state first, which is why default-configured Hawk stays quiet. The hole is in Multi mode: the release only fires inside the isBlocking gate, and when the Block Chance roll or canBlock fails, no release is queued while the C02s still sweep, leaving the previous re-block active server-side so the attacks land while blocking. The check is disabled by default in this tree (enabled = false in the constructor), so it only bites on servers that turn it on.

anticheat Angle (attack-stream window)

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's Angle builds an AttackLocation per damage event with the player's position, yaw, the victim id and the deltas to the previous entry, keeps a 1000ms window, and scores four signals: average movement below 0.2 blocks, average time between attacks below 150ms, average yaw change above 50 degrees, and switch speed counted whenever the victim id changes with a yaw jump over 30 degrees. Each signal that exceeds its configured threshold feeds data.angleVL, which decays by 0.98 on clean checks and executes actions past its violation level. Multi mode scores maximum on every signal: the whole sweep happens in one tick (time near 0), the player does not move between victims (movement near 0), and consecutive victims are different entities in different directions (id changes with large yaw jumps), so with detection-tuned thresholds the accumulated VL crosses the cancel line within a handful of cycles. The stock thresholds in this tree (move 100, time 150, yaw 60, switch 50) sit above the 20-30 maximum per-call scores, so the check only acts when an admin lowers them, which standard NCP detection configs do.

anticheat KillAura (multi-target / reach / speed)

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 composite check runs on the damage event and scores four sub-conditions. The Multi branch is the direct hit on MultiAura: when two consecutive attacked entities differ, it measures the angle difference between their vectors from the player and flags 'Kill Aura (Multi)' if it exceeds max-direction-angle (1.2 radians default) while the victims are within max-reach (4.2). MultiAura attacks every target in the same tick regardless of where the look points, so consecutive victims sit at different angles and the branch fires on the first sweep. The Reach branch measures the distance to the entity minus its current velocity, so the module's 6-8 block Range exceeds the 4.2 cap on every hit even mid-knockback. The Speed branch counts attacks per second (max-attacks 16) and, via checkFrequency, attack packets per second (max-attack-packets 20): Multi mode with two or more targets at 12-20 cycles per second blows past both. Direction and NoSwing pass because the module snaps the look onto the target and swings before every C02.

← Back to Analysis Hub