From 4da16ed12b73237590067511239ed601f40007ff Mon Sep 17 00:00:00 2001 From: funkemunky Date: Mon, 7 Sep 2020 18:55:26 -0400 Subject: [PATCH 1/3] Fixing errors --- .../dev/brighten/anticheat/commands/KauriCommand.java | 2 +- .../dev/brighten/anticheat/listeners/PacketListener.java | 9 ++++----- pom.xml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Impl/src/main/java/dev/brighten/anticheat/commands/KauriCommand.java b/Impl/src/main/java/dev/brighten/anticheat/commands/KauriCommand.java index 291174eb4..8ecb4bc53 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/commands/KauriCommand.java +++ b/Impl/src/main/java/dev/brighten/anticheat/commands/KauriCommand.java @@ -18,7 +18,7 @@ public class KauriCommand { private static List testers = new ArrayList<>(); @Command(name = "kauri", description = "The Kauri main command.", display = "Kauri", aliases = {"anticheat"}, - permission = "kauri.command", + permission = "kauri.command", async = false, noPermissionMessage = "&cThis server is running Kauri by funkemunky, Elevated, and Abigail.") public void onCommand(CommandAdapter cmd) { Atlas.getInstance().getCommandManager(Kauri.INSTANCE).runHelpMessage(cmd, diff --git a/Impl/src/main/java/dev/brighten/anticheat/listeners/PacketListener.java b/Impl/src/main/java/dev/brighten/anticheat/listeners/PacketListener.java index 626673b63..99edaf7a5 100644 --- a/Impl/src/main/java/dev/brighten/anticheat/listeners/PacketListener.java +++ b/Impl/src/main/java/dev/brighten/anticheat/listeners/PacketListener.java @@ -35,9 +35,8 @@ public void onEvent(PacketReceiveEvent event) { if(data == null || data.checkManager == null) return; - data.getThread().execute(() -> - Kauri.INSTANCE.packetProcessor.processClient(event, - data, event.getPacket(), event.getType(), event.getTimeStamp())); + Kauri.INSTANCE.packetProcessor.processClient(event, + data, event.getPacket(), event.getType(), event.getTimeStamp()); switch(event.getType()) { case Packet.Client.USE_ENTITY: { @@ -74,8 +73,8 @@ public void onEvent(PacketSendEvent event) { if(data == null || data.checkManager == null) return; - data.getThread().execute(() -> Kauri.INSTANCE.packetProcessor.processServer(event, - data, event.getPacket(), event.getType(), event.getTimeStamp())); + Kauri.INSTANCE.packetProcessor.processServer(event, + data, event.getPacket(), event.getType(), event.getTimeStamp()); switch(event.getType()) { case Packet.Server.REL_LOOK: diff --git a/pom.xml b/pom.xml index 662d71e25..711365a3d 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ cc.funkemunky.utils Atlas - 1.8.4 + 1.9 provided From d544248fc88e6479978992f7c16fa19526c5879f Mon Sep 17 00:00:00 2001 From: Dawson Hessler Date: Tue, 8 Sep 2020 12:38:34 -0400 Subject: [PATCH 2/3] added cancellable in speed --- .../brighten/anticheat/check/impl/movement/speed/SpeedA.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java index 31727ff51..7749efacd 100644 --- a/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java +++ b/Free/src/main/java/dev/brighten/anticheat/check/impl/movement/speed/SpeedA.java @@ -4,6 +4,7 @@ import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; import cc.funkemunky.api.tinyprotocol.packet.out.WrappedOutVelocityPacket; import cc.funkemunky.api.utils.PlayerUtils; +import dev.brighten.anticheat.check.api.Cancellable; import dev.brighten.anticheat.check.api.Check; import dev.brighten.anticheat.check.api.CheckInfo; import dev.brighten.anticheat.check.api.Packet; @@ -14,6 +15,7 @@ @CheckInfo(name = "Speed (A)", description = "Minecraft code speed acceleration check.", checkType = CheckType.SPEED, developer = true) +@Cancellable public class SpeedA extends Check { private double ldxz = .12f; From 4f3056144fee46dbb6e7dfebd1c2010ca00c2600 Mon Sep 17 00:00:00 2001 From: Dawson Hessler Date: Tue, 8 Sep 2020 13:03:41 -0400 Subject: [PATCH 3/3] Fixed false positives and errors. changed version to 2.10.0 --- API/pom.xml | 2 +- Free/pom.xml | 2 +- Impl/pom.xml | 2 +- Premium/pom.xml | 4 +- .../anticheat/premium/PremiumChecks.java | 12 ++--- Regular/pom.xml | 2 +- .../anticheat/check/impl/combat/aim/AimB.java | 2 +- .../check/impl/combat/killaura/KillauraA.java | 49 ++++++++++++++----- .../check/impl/movement/fly/FlyB.java | 2 +- pom.xml | 2 +- 10 files changed, 51 insertions(+), 28 deletions(-) diff --git a/API/pom.xml b/API/pom.xml index 3bfe20108..f9bb6524b 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.9.2 + 2.10.0 4.0.0 diff --git a/Free/pom.xml b/Free/pom.xml index dc293228e..c341189ae 100644 --- a/Free/pom.xml +++ b/Free/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.9.2 + 2.10.0 4.0.0 diff --git a/Impl/pom.xml b/Impl/pom.xml index 8175cf001..716aa21fc 100644 --- a/Impl/pom.xml +++ b/Impl/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.9.2 + 2.10.0 4.0.0 diff --git a/Premium/pom.xml b/Premium/pom.xml index b1b1d6018..459d061b8 100644 --- a/Premium/pom.xml +++ b/Premium/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.9.2 + 2.10.0 4.0.0 @@ -59,7 +59,7 @@ dev.brighten.anticheat Impl ${parent.version} - provided + compile diff --git a/Premium/src/main/java/dev/brighten/anticheat/premium/PremiumChecks.java b/Premium/src/main/java/dev/brighten/anticheat/premium/PremiumChecks.java index 638bd4855..8f15e03c4 100644 --- a/Premium/src/main/java/dev/brighten/anticheat/premium/PremiumChecks.java +++ b/Premium/src/main/java/dev/brighten/anticheat/premium/PremiumChecks.java @@ -23,15 +23,15 @@ public void registerChecks() { Check.register(new ReachB()); //Check.register(new ReachC()); //Check.register(new Motion()); - Check.register(new AimG()); - Check.register(new AimH()); - Check.register(new AimI()); + //Check.register(new AimG()); + //Check.register(new AimH()); + //Check.register(new AimI()); Check.register(new HealthSpoof()); Check.register(new AutoclickerD()); Check.register(new AutoclickerF()); - Check.register(new AutoclickerE()); - Check.register(new InventoryB()); - Check.register(new InventoryC()); + //Check.register(new AutoclickerE()); + // Check.register(new InventoryB()); + // Check.register(new InventoryC()); Check.register(new AutoclickerH()); Check.register(new AutoclickerI()); Check.register(new AutoclickerJ()); diff --git a/Regular/pom.xml b/Regular/pom.xml index c71f1702d..2d00dbbb1 100644 --- a/Regular/pom.xml +++ b/Regular/pom.xml @@ -5,7 +5,7 @@ Kauri dev.brighten.anticheat - 2.9.2 + 2.10.0 4.0.0 diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/aim/AimB.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/aim/AimB.java index 6158cde20..625cc50ca 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/aim/AimB.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/aim/AimB.java @@ -16,7 +16,7 @@ public void onFlying(WrappedInFlyingPacket packet) { && Math.abs(data.playerInfo.deltaPitch) > 1E-5) { if(data.playerInfo.pitchGCD < 100000 && !data.playerInfo.cinematicMode - && data.moveProcessor.sensitivityX < 0.44) { + && Math.abs(data.playerInfo.to.pitch) < 80) { if(++vl > 28) { flag("offset=%v deltaPitch=%v", data.playerInfo.pitchGCD, data.playerInfo.deltaPitch); } diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java index e18e3a646..d7774772e 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/combat/killaura/KillauraA.java @@ -1,6 +1,8 @@ package dev.brighten.anticheat.check.impl.combat.killaura; +import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInFlyingPacket; import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInUseEntityPacket; +import cc.funkemunky.api.utils.Color; import cc.funkemunky.api.utils.KLocation; import cc.funkemunky.api.utils.MathUtils; import cc.funkemunky.api.utils.math.cond.MaxInteger; @@ -10,10 +12,13 @@ import cc.funkemunky.api.utils.world.types.SimpleCollisionBox; import dev.brighten.anticheat.check.api.*; import dev.brighten.api.check.CheckType; +import org.bukkit.Location; +import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.Optional; @CheckInfo(name = "Killaura (A)", description = "Checks for block collisions on player hits.", checkType = CheckType.KILLAURA, developer = true) @@ -22,26 +27,44 @@ public class KillauraA extends Check { private MaxInteger verbose = new MaxInteger(10); + private int lastAttack; + + @Packet + public void onUse(WrappedInUseEntityPacket packet, int current) { + if(data.target == null || packet.getAction() != WrappedInUseEntityPacket.EnumEntityUseAction.ATTACK) return; + + lastAttack = current; + } + @Packet - public void onUse(WrappedInUseEntityPacket packet, long current) { - if(data.target == null) return; - KLocation origin = data.playerInfo.to.clone(); - origin.y+= data.playerInfo.sneaking ? 1.54f : 1.62f; + public void onFlying(WrappedInFlyingPacket packet, int current) { + if(current - lastAttack == 0) { + Location toLoc = data.playerInfo.to.toLocation(data.getPlayer().getWorld()) + .add(0, data.playerInfo.sneaking ? 1.54f : 1.62f, 0); - RayCollision ray = new RayCollision(origin.toVector(), MathUtils.getDirection(origin)); + RayCollision from = new RayCollision(data.getPlayer().getEyeLocation().toVector(), + data.getPlayer().getEyeLocation().getDirection()), + to = new RayCollision(toLoc.toVector(), toLoc.getDirection()); - List targetBoxes = new ArrayList<>(); + Vector sixNineVector = toLoc.toVector().subtract(new Vector(69, 69, 69)); - data.targetPastLocation.getEstimatedLocation(data.lagInfo.transPing + 50, 150) - .forEach(loc -> EntityData.getEntityBox(loc, data.target).downCast(targetBoxes)); + double distance = data.targetPastLocation.getEstimatedLocation(System.currentTimeMillis(), + (data.lagInfo.transPing + 3) * 50, 100L).stream().mapToDouble(loc -> { + SimpleCollisionBox box = (SimpleCollisionBox) EntityData.getEntityBox(loc, data.target); - double distance = targetBoxes.stream().map(ray::collisionPoint) - .filter(Objects::nonNull).mapToDouble(vec -> vec.distance(origin.toVector())).min().orElse(-1); + return Math.min(Optional.ofNullable(from.collisionPoint(box)).orElse(sixNineVector) + .distance(data.getPlayer().getEyeLocation().toVector()), + Optional.ofNullable(to.collisionPoint(box)).orElse(sixNineVector) + .distance(toLoc.toVector())); + }).min().orElse(0); - if(distance == -1) return; - List boxes = ray.boxesOnRay(packet.getPlayer().getWorld(), distance); + int fromBox = from.boxesOnRay(data.getPlayer().getWorld(), distance).size() + , toBox = to.boxesOnRay(data.getPlayer().getWorld(), distance).size(); - debug("boxSize=%v", boxes.size()); + if(fromBox > 0 && toBox > 0) { + debug(Color.Green + "Flag"); + } + } } } diff --git a/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyB.java b/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyB.java index a4be4d64c..bba69d248 100644 --- a/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyB.java +++ b/Regular/src/main/java/dev/brighten/anticheat/check/impl/movement/fly/FlyB.java @@ -51,7 +51,7 @@ public void onFlying(WrappedInFlyingPacket packet, long timeStamp) { && (!data.playerInfo.clientGround || data.playerInfo.deltaY < predicted) && data.playerInfo.blockAboveTimer.hasPassed(5) && deltaPredict > 0.016) { - if(++buffer > 2 || (deltaPredict > 0.3 && !data.blockInfo.blocksNear)) { + if(++buffer > 2) { ++vl; flag("dY=%v.3 p=%v.3 dx=%v.3", data.playerInfo.deltaY, predicted, data.playerInfo.deltaXZ); } diff --git a/pom.xml b/pom.xml index 711365a3d..f0e9ad346 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ dev.brighten.anticheat Kauri pom - 2.9.2 + 2.10.0 API Impl