From 6d4ae166e1317133140bc971e86ed1bea09b3390 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Thu, 19 Dec 2024 01:08:43 -0500 Subject: [PATCH] Refactor type hiearchy to make masking check types easier --- build.gradle.kts | 7 +- settings.gradle.kts | 8 ++ .../checks/impl/aim/AimDuplicateLook.java | 4 +- .../grimac/checks/impl/aim/AimModulo360.java | 4 +- .../impl/aim/processor/AimProcessor.java | 4 +- .../checks/impl/badpackets/BadPacketsA.java | 4 +- .../checks/impl/badpackets/BadPacketsB.java | 4 +- .../checks/impl/badpackets/BadPacketsC.java | 4 +- .../checks/impl/badpackets/BadPacketsD.java | 4 +- .../checks/impl/badpackets/BadPacketsE.java | 4 +- .../checks/impl/badpackets/BadPacketsF.java | 4 +- .../checks/impl/badpackets/BadPacketsG.java | 4 +- .../checks/impl/badpackets/BadPacketsI.java | 4 +- .../checks/impl/badpackets/BadPacketsJ.java | 4 +- .../checks/impl/badpackets/BadPacketsK.java | 4 +- .../checks/impl/badpackets/BadPacketsL.java | 4 +- .../checks/impl/badpackets/BadPacketsN.java | 4 +- .../checks/impl/badpackets/BadPacketsO.java | 4 +- .../checks/impl/badpackets/BadPacketsP.java | 4 +- .../checks/impl/badpackets/BadPacketsQ.java | 4 +- .../checks/impl/badpackets/BadPacketsR.java | 4 +- .../checks/impl/badpackets/BadPacketsS.java | 4 +- .../checks/impl/badpackets/BadPacketsT.java | 4 +- .../checks/impl/badpackets/BadPacketsU.java | 4 +- .../checks/impl/badpackets/BadPacketsW.java | 4 +- .../checks/impl/badpackets/BadPacketsX.java | 4 +- .../checks/impl/badpackets/BadPacketsY.java | 4 +- .../checks/impl/badpackets/BadPacketsZ.java | 4 +- .../grimac/checks/impl/baritone/Baritone.java | 4 +- .../checks/impl/combat/HitboxBlock.java | 4 +- .../checks/impl/combat/HitboxEntity.java | 4 +- .../grimac/checks/impl/combat/HitboxMiss.java | 4 +- .../checks/impl/combat/MultiInteractA.java | 5 +- .../checks/impl/combat/MultiInteractB.java | 5 +- .../grim/grimac/checks/impl/combat/Reach.java | 10 +- .../grim/grimac/checks/impl/crash/CrashA.java | 4 +- .../grim/grimac/checks/impl/crash/CrashB.java | 4 +- .../grim/grimac/checks/impl/crash/CrashC.java | 4 +- .../grim/grimac/checks/impl/crash/CrashD.java | 4 +- .../grim/grimac/checks/impl/crash/CrashE.java | 4 +- .../grim/grimac/checks/impl/crash/CrashF.java | 4 +- .../grim/grimac/checks/impl/crash/CrashG.java | 4 +- .../grim/grimac/checks/impl/crash/CrashH.java | 4 +- .../grimac/checks/impl/exploit/ExploitA.java | 4 +- .../grimac/checks/impl/exploit/ExploitB.java | 4 +- .../grimac/checks/impl/exploit/ExploitC.java | 4 +- .../grimac/checks/impl/flight/FlightA.java | 4 +- .../checks/impl/groundspoof/NoFallA.java | 4 +- .../checks/impl/inventory/InventoryD.java | 6 + .../grimac/checks/impl/misc/ClientBrand.java | 4 +- .../grimac/checks/impl/misc/FastBreak.java | 4 +- .../checks/impl/movement/EntityControl.java | 5 +- .../impl/movement/NegativeTimerCheck.java | 10 +- .../grimac/checks/impl/movement/NoSlowA.java | 5 +- .../grimac/checks/impl/movement/NoSlowB.java | 4 +- .../grimac/checks/impl/movement/NoSlowC.java | 12 +- .../grimac/checks/impl/movement/NoSlowD.java | 5 +- .../grimac/checks/impl/movement/NoSlowE.java | 5 +- .../impl/movement/PredictionRunner.java | 4 +- .../checks/impl/movement/SetbackBlocker.java | 4 +- .../checks/impl/movement/TickTimer.java | 4 +- .../checks/impl/movement/TimerCheck.java | 4 +- .../movement/VehiclePredictionRunner.java | 4 +- .../impl/multiactions/MultiActionsA.java | 4 +- .../impl/multiactions/MultiActionsB.java | 4 +- .../impl/multiactions/MultiActionsC.java | 4 +- .../impl/multiactions/MultiActionsD.java | 4 +- .../impl/multiactions/MultiActionsE.java | 4 +- .../checks/impl/packetorder/PacketOrderA.java | 6 +- .../checks/impl/packetorder/PacketOrderB.java | 4 +- .../checks/impl/packetorder/PacketOrderC.java | 4 +- .../checks/impl/packetorder/PacketOrderD.java | 4 +- .../checks/impl/packetorder/PacketOrderE.java | 6 +- .../checks/impl/packetorder/PacketOrderF.java | 5 +- .../checks/impl/packetorder/PacketOrderG.java | 5 +- .../checks/impl/packetorder/PacketOrderH.java | 5 +- .../checks/impl/packetorder/PacketOrderI.java | 5 +- .../checks/impl/packetorder/PacketOrderJ.java | 5 +- .../checks/impl/packetorder/PacketOrderK.java | 5 +- .../checks/impl/packetorder/PacketOrderL.java | 5 +- .../checks/impl/packetorder/PacketOrderM.java | 5 +- .../checks/impl/packetorder/PacketOrderO.java | 4 +- .../checks/impl/packetorder/PacketOrderP.java | 4 +- .../packetorder/PacketOrderProcessor.java | 4 +- .../ac/grim/grimac/checks/impl/post/Post.java | 12 +- .../checks/impl/prediction/DebugHandler.java | 5 +- .../checks/impl/prediction/NoFallB.java | 5 +- .../checks/impl/prediction/OffsetHandler.java | 5 +- .../grimac/checks/impl/prediction/Phase.java | 6 +- .../impl/velocity/ExplosionHandler.java | 7 +- .../impl/velocity/KnockbackHandler.java | 7 +- .../grimac/checks/type/BlockPlaceCheck.java | 11 +- .../grimac/checks/type/InventoryCheck.java | 3 +- .../AbstractPostPredictionCheck.java | 17 +++ .../BlockBreakCheckI.java} | 6 +- .../type/interfaces/BlockPlaceCheckI.java | 15 +++ .../PacketCheckI.java} | 4 +- .../PositionCheckI.java} | 4 +- .../PostPredictionCheckI.java} | 5 +- .../RotationCheckI.java} | 4 +- .../VehicleCheckI.java} | 4 +- .../events/packets/PacketChangeGameState.java | 4 +- .../packets/PacketEntityReplication.java | 4 +- .../events/packets/PacketPlayerAbilities.java | 4 +- .../events/packets/PacketWorldBorder.java | 4 +- .../ac/grim/grimac/manager/ActionManager.java | 4 +- .../ac/grim/grimac/manager/CheckManager.java | 127 +++++++++--------- .../grimac/manager/LastInstanceManager.java | 5 +- .../grimac/manager/SetbackTeleportUtil.java | 5 +- .../grimac/manager/init/start/SuperDebug.java | 5 +- .../predictionengine/GhostBlockDetector.java | 6 +- .../predictionengine/MovementCheckRunner.java | 4 +- .../predictionengine/SneakingEstimator.java | 5 +- .../utils/latency/CompensatedCooldown.java | 4 +- .../utils/latency/CompensatedFireworks.java | 5 +- .../utils/latency/CompensatedInventory.java | 4 +- .../grim/grimac/utils/team/TeamHandler.java | 4 +- 117 files changed, 399 insertions(+), 298 deletions(-) create mode 100644 src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPostPredictionCheck.java rename src/main/java/ac/grim/grimac/checks/type/{BlockBreakCheck.java => interfaces/BlockBreakCheckI.java} (57%) create mode 100644 src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java rename src/main/java/ac/grim/grimac/checks/type/{PacketCheck.java => interfaces/PacketCheckI.java} (81%) rename src/main/java/ac/grim/grimac/checks/type/{PositionCheck.java => interfaces/PositionCheckI.java} (75%) rename src/main/java/ac/grim/grimac/checks/type/{PostPredictionCheck.java => interfaces/PostPredictionCheckI.java} (73%) rename src/main/java/ac/grim/grimac/checks/type/{RotationCheck.java => interfaces/RotationCheckI.java} (75%) rename src/main/java/ac/grim/grimac/checks/type/{VehicleCheck.java => interfaces/VehicleCheckI.java} (75%) diff --git a/build.gradle.kts b/build.gradle.kts index 67ae2eeac3..62ff0c29e4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,6 +7,7 @@ plugins { id("io.freefair.lombok") version "8.6" id("net.minecrell.plugin-yml.bukkit") version "0.6.0" id("com.diffplug.spotless") version "6.25.0" + kotlin("jvm") } spotless { @@ -28,8 +29,6 @@ spotless { group = "ac.grim.grimac" version = "2.3.69" description = "Libre simulation anticheat designed for 1.21 with 1.8-1.21 support, powered by PacketEvents 2.0." -java.sourceCompatibility = JavaVersion.VERSION_1_8 -java.targetCompatibility = JavaVersion.VERSION_1_8 // Set to false for debug builds // You cannot live reload classes if the jar relocates dependencies @@ -77,6 +76,7 @@ dependencies { compileOnly("com.viaversion:viaversion-api:5.1.1-SNAPSHOT") // compileOnly("io.netty:netty-all:4.1.85.Final") + implementation(kotlin("stdlib-jdk8")) } bukkit { @@ -194,3 +194,6 @@ tasks.shadowJar { relocate("com.zaxxer", "ac.grim.rgimac.shaded.zaxxer") } } +kotlin { + jvmToolchain(8) +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 1fcf0541e3..ba23872683 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,9 @@ +pluginManagement { + plugins { + kotlin("jvm") version "2.0.21" + } +} +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} rootProject.name = "grimac" diff --git a/src/main/java/ac/grim/grimac/checks/impl/aim/AimDuplicateLook.java b/src/main/java/ac/grim/grimac/checks/impl/aim/AimDuplicateLook.java index 54090cef38..ddd8eb42f9 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/aim/AimDuplicateLook.java +++ b/src/main/java/ac/grim/grimac/checks/impl/aim/AimDuplicateLook.java @@ -2,12 +2,12 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.RotationCheck; +import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; @CheckData(name = "AimDuplicateLook") -public class AimDuplicateLook extends Check implements RotationCheck { +public class AimDuplicateLook extends Check implements RotationCheckI { public AimDuplicateLook(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/aim/AimModulo360.java b/src/main/java/ac/grim/grimac/checks/impl/aim/AimModulo360.java index c2a141a906..f089f0c61a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/aim/AimModulo360.java +++ b/src/main/java/ac/grim/grimac/checks/impl/aim/AimModulo360.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.RotationCheck; +import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; @@ -10,7 +10,7 @@ // I also discovered this flaw before open source Kauri, but did not want to open source its detection. // It works on clients who % 360 their rotation. @CheckData(name = "AimModulo360", decay = 0.005) -public class AimModulo360 extends Check implements RotationCheck { +public class AimModulo360 extends Check implements RotationCheckI { private float lastDeltaYaw; diff --git a/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java b/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java index 52da60283d..747f983f4e 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java +++ b/src/main/java/ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java @@ -1,7 +1,7 @@ package ac.grim.grimac.checks.impl.aim.processor; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.RotationCheck; +import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; import ac.grim.grimac.utils.data.Pair; @@ -9,7 +9,7 @@ import ac.grim.grimac.utils.math.GrimMath; -public class AimProcessor extends Check implements RotationCheck { +public class AimProcessor extends Check implements RotationCheckI { private static final int SIGNIFICANT_SAMPLES_THRESHOLD = 15; private static final int TOTAL_SAMPLES_THRESHOLD = 80; diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsA.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsA.java index c3c8a71854..54d1451c64 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsA.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange; @CheckData(name = "BadPacketsA", description = "Sent duplicate slot id") -public class BadPacketsA extends Check implements PacketCheck { +public class BadPacketsA extends Check implements PacketCheckI { int lastSlot = -1; public BadPacketsA(final GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsB.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsB.java index 22707fb5f9..10812213cd 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsB.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSteerVehicle; @CheckData(name = "BadPacketsB", description = "Sent impossible steer vehicle packet") -public class BadPacketsB extends Check implements PacketCheck { +public class BadPacketsB extends Check implements PacketCheckI { public BadPacketsB(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsC.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsC.java index 3ab7ccd2e0..cf4eac7e3a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsC.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; @CheckData(name = "BadPacketsC", description = "Interacted with self") -public class BadPacketsC extends Check implements PacketCheck { +public class BadPacketsC extends Check implements PacketCheckI { public BadPacketsC(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsD.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsD.java index c3f6750a97..709ae808bf 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsD.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsD.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "BadPacketsD") -public class BadPacketsD extends Check implements PacketCheck { +public class BadPacketsD extends Check implements PacketCheckI { public BadPacketsD(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsE.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsE.java index 7a5553a812..9b073fdc55 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsE.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -10,7 +10,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "BadPacketsE") -public class BadPacketsE extends Check implements PacketCheck { +public class BadPacketsE extends Check implements PacketCheckI { private int noReminderTicks; public BadPacketsE(GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsF.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsF.java index 5cc6eb0f69..1ec9abbc59 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsF.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsF.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; @CheckData(name = "BadPacketsF", description = "Sent duplicate sprinting status") -public class BadPacketsF extends Check implements PacketCheck { +public class BadPacketsF extends Check implements PacketCheckI { public boolean lastSprinting; public boolean exemptNext = true; // Support 1.14+ clients starting on either true or false sprinting, we don't know diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsG.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsG.java index 52c81dce94..f0d2d5ff05 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsG.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsG.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; @CheckData(name = "BadPacketsG", description = "Sent duplicate sneaking status") -public class BadPacketsG extends Check implements PacketCheck { +public class BadPacketsG extends Check implements PacketCheckI { private boolean lastSneaking, respawn; public BadPacketsG(GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsI.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsI.java index 36dcb03ee4..e949fee166 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsI.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsI.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerAbilities; @CheckData(name = "BadPacketsI", description = "Claimed to be flying while unable to fly") -public class BadPacketsI extends Check implements PacketCheck { +public class BadPacketsI extends Check implements PacketCheckI { public BadPacketsI(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsJ.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsJ.java index 249a57671d..2ed4ba2d80 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsJ.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsJ.java @@ -2,13 +2,13 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "BadPacketsJ", description = "Sent steer vehicle packets while not in a vehicle") -public class BadPacketsJ extends Check implements PacketCheck { +public class BadPacketsJ extends Check implements PacketCheckI { public BadPacketsJ(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsK.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsK.java index fdde9189b0..f63fb9093d 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsK.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsK.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.player.GameMode; @CheckData(name = "BadPacketsK", description = "Sent spectate packets while not in spectator mode") -public class BadPacketsK extends Check implements PacketCheck { +public class BadPacketsK extends Check implements PacketCheckI { public BadPacketsK(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsL.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsL.java index 202f3e1ecf..774ec663ba 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsL.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsL.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -14,7 +14,7 @@ import java.util.Locale; @CheckData(name = "BadPacketsL", description = "Sent impossible dig packet") -public class BadPacketsL extends Check implements PacketCheck { +public class BadPacketsL extends Check implements PacketCheckI { public BadPacketsL(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsN.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsN.java index 52c0559c2e..ab29fe2683 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsN.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsN.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "BadPacketsN") -public class BadPacketsN extends Check implements PacketCheck { +public class BadPacketsN extends Check implements PacketCheckI { public BadPacketsN(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java index ab7b79760a..25d2d960d9 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsO.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.Pair; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -15,7 +15,7 @@ import java.util.Queue; @CheckData(name = "BadPacketsO") -public class BadPacketsO extends Check implements PacketCheck { +public class BadPacketsO extends Check implements PacketCheckI { Queue> keepaliveMap = new LinkedList<>(); public BadPacketsO(GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsP.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsP.java index 763f2e3c99..df9fc2b837 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsP.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsP.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; @@ -13,7 +13,7 @@ @CheckData(name = "BadPacketsP", experimental = true) -public class BadPacketsP extends Check implements PacketCheck { +public class BadPacketsP extends Check implements PacketCheckI { public BadPacketsP(GrimPlayer playerData) { super(playerData); diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsQ.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsQ.java index a2bf00e405..78fa8bc387 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsQ.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsQ.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType.Play.Client; @@ -10,7 +10,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction.Action; @CheckData(name = "BadPacketsQ") -public class BadPacketsQ extends Check implements PacketCheck { +public class BadPacketsQ extends Check implements PacketCheckI { public BadPacketsQ(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsR.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsR.java index d9ac8e12ff..8bfe981f94 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsR.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsR.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.player.GameMode; @CheckData(name = "BadPacketsR", decay = 0.25, experimental = true) -public class BadPacketsR extends Check implements PacketCheck { +public class BadPacketsR extends Check implements PacketCheckI { public BadPacketsR(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsS.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsS.java index 3fd6b5c50d..8ae9579092 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsS.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsS.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "BadPacketsS") -public class BadPacketsS extends Check implements PacketCheck { +public class BadPacketsS extends Check implements PacketCheckI { public BadPacketsS(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java index 872682f2e2..5f16b95fc2 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsT.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -13,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; @CheckData(name = "BadPacketsT") -public class BadPacketsT extends Check implements PacketCheck { +public class BadPacketsT extends Check implements PacketCheckI { public BadPacketsT(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsU.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsU.java index 47f9387458..3bc5a508dc 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsU.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsU.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.item.ItemStack; @@ -15,7 +15,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement; @CheckData(name = "BadPacketsU", description = "Sent impossible use item packet", experimental = true) -public class BadPacketsU extends Check implements PacketCheck { +public class BadPacketsU extends Check implements PacketCheckI { public BadPacketsU(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java index fa13325460..6e6e5acbf5 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "BadPacketsW", description = "Interacted with non-existent entity", experimental = true) -public class BadPacketsW extends Check implements PacketCheck { +public class BadPacketsW extends Check implements PacketCheckI { public BadPacketsW(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java index ad7e88ec61..a9913fe1cb 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java @@ -3,7 +3,7 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.BlockBreakCheck; +import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockBreak; import ac.grim.grimac.utils.change.BlockModification; @@ -19,7 +19,7 @@ import java.util.stream.Stream; @CheckData(name = "BadPacketsX") -public class BadPacketsX extends Check implements BlockBreakCheck { +public class BadPacketsX extends Check implements BlockBreakCheckI { public BadPacketsX(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsY.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsY.java index a48d12cead..0a24eb5b78 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsY.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsY.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientHeldItemChange; @CheckData(name = "BadPacketsY", description = "Sent out of bounds slot id") -public class BadPacketsY extends Check implements PacketCheck { +public class BadPacketsY extends Check implements PacketCheckI { public BadPacketsY(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsZ.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsZ.java index 8410d6fa6a..801b79102a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsZ.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsZ.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.BlockBreakCheck; +import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.MessageUtil; import ac.grim.grimac.utils.anticheat.update.BlockBreak; @@ -15,7 +15,7 @@ import static ac.grim.grimac.utils.nmsutil.BlockBreakSpeed.getBlockDamage; @CheckData(name = "BadPacketsZ") -public class BadPacketsZ extends Check implements BlockBreakCheck { +public class BadPacketsZ extends Check implements BlockBreakCheckI { public BadPacketsZ(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/baritone/Baritone.java b/src/main/java/ac/grim/grimac/checks/impl/baritone/Baritone.java index 27a2e7f094..c190971886 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/baritone/Baritone.java +++ b/src/main/java/ac/grim/grimac/checks/impl/baritone/Baritone.java @@ -3,7 +3,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.impl.aim.processor.AimProcessor; -import ac.grim.grimac.checks.type.RotationCheck; +import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; import ac.grim.grimac.utils.data.HeadRotation; @@ -11,7 +11,7 @@ // This check has been patched by Baritone for a long time and it also seems to false with cinematic camera now, so it is disabled. @CheckData(name = "Baritone") -public class Baritone extends Check implements RotationCheck { +public class Baritone extends Check implements RotationCheckI { public Baritone(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxBlock.java b/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxBlock.java index eef6fed53d..d6232df869 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxBlock.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxBlock.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "HitboxBlock", configName = "HitboxBlock", setback = 20) -public class HitboxBlock extends Check implements PacketCheck { +public class HitboxBlock extends Check implements PacketCheckI { public HitboxBlock(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxEntity.java b/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxEntity.java index 065cd0b935..410761e4a0 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxEntity.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxEntity.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "HitboxEntity", configName = "HitboxEntity", setback = 30) -public class HitboxEntity extends Check implements PacketCheck { +public class HitboxEntity extends Check implements PacketCheckI { public HitboxEntity(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxMiss.java b/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxMiss.java index d987f95500..f67e9aefc5 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxMiss.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/HitboxMiss.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "HitboxMiss", configName = "HitboxMiss", setback = 10) -public class HitboxMiss extends Check implements PacketCheck { +public class HitboxMiss extends Check implements PacketCheckI { public HitboxMiss(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java b/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java index d85a948251..71b15f537b 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -14,7 +15,7 @@ import java.util.ArrayList; @CheckData(name = "MultiInteractA", description = "Interacted with multiple entities in the same tick", experimental = true) -public class MultiInteractA extends Check implements PostPredictionCheck { +public class MultiInteractA extends AbstractPostPredictionCheck { public MultiInteractA(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractB.java b/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractB.java index dc686bfebc..ed3940b902 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/MultiInteractB.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.MessageUtil; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; @@ -16,7 +17,7 @@ import java.util.ArrayList; @CheckData(name = "MultiInteractB", experimental = true) -public class MultiInteractB extends Check implements PostPredictionCheck { +public class MultiInteractB extends AbstractPostPredictionCheck { public MultiInteractB(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java b/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java index c39efe9848..01d1819329 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java +++ b/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java @@ -18,7 +18,7 @@ import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; import ac.grim.grimac.utils.data.BlockHitData; @@ -55,7 +55,7 @@ // You may not copy the check unless you are licensed under GPL @CheckData(name = "Reach", configName = "Reach", setback = 10) -public class Reach extends Check implements PacketCheck { +public class Reach extends Check implements PacketCheckI { // Only one flag per reach attack, per entity, per tick. // We store position because lastX isn't reliable on teleports. private final Int2ObjectMap playerAttackQueue = new Int2ObjectOpenHashMap<>(); @@ -171,9 +171,9 @@ private void tickBetterReachCheckWithAngle(boolean isFlying) { for (Int2ObjectMap.Entry attack : playerAttackQueue.int2ObjectEntrySet()) { PacketEntity reachEntity = player.compensatedEntities.entityMap.get(attack.getIntKey()); if (reachEntity != null) { - Pair, String> result = checkReach(reachEntity, attack.getValue(), false); + Pair, String> result = checkReach(reachEntity, attack.getValue(), false); if (result != null) { - PacketCheck check = player.checkManager.getPacketCheck(result.first()); + PacketCheckI check = player.checkManager.getPacketCheck(result.first()); if (reachEntity.getType() == EntityTypes.PLAYER) { ((Check)check).flagAndAlert(result.second()); } else { @@ -188,7 +188,7 @@ private void tickBetterReachCheckWithAngle(boolean isFlying) { if (isFlying) blocksChangedThisTick.clear(); } - private Pair, String> checkReach(PacketEntity reachEntity, Vector3d from, boolean isPrediction) { + private Pair, String> checkReach(PacketEntity reachEntity, Vector3d from, boolean isPrediction) { SimpleCollisionBox targetBox = reachEntity.getPossibleCollisionBoxes(); if (reachEntity.getType() == EntityTypes.END_CRYSTAL) { // Hardcode end crystal box diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashA.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashA.java index c70da81fc2..13b73735be 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashA.java @@ -2,13 +2,13 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "CrashA") -public class CrashA extends Check implements PacketCheck { +public class CrashA extends Check implements PacketCheckI { private static final double HARD_CODED_BORDER = 2.9999999E7D; public CrashA(GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashB.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashB.java index e26a6ede42..2f0d623943 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashB.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.player.GameMode; @CheckData(name = "CrashB", description = "Sent creative mode inventory click packets while not in creative mode") -public class CrashB extends Check implements PacketCheck { +public class CrashB extends Check implements PacketCheckI { public CrashB(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashC.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashC.java index 103adecdfa..1adab3e52c 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashC.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.world.Location; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "CrashC", description = "Sent non-finite position or rotation") -public class CrashC extends Check implements PacketCheck { +public class CrashC extends Check implements PacketCheckI { public CrashC(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashD.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashD.java index b8ad013f50..cf6b9f6302 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashD.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashD.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.inventory.inventory.MenuType; import com.github.retrooper.packetevents.PacketEvents; @@ -14,7 +14,7 @@ import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerOpenWindow; @CheckData(name = "CrashD", description = "Clicking slots in lectern window") -public class CrashD extends Check implements PacketCheck { +public class CrashD extends Check implements PacketCheckI { public CrashD(GrimPlayer playerData) { super(playerData); diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java index c0caabf0fe..41356197cd 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java @@ -3,14 +3,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.impl.exploit.ExploitA; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings; @CheckData(name = "CrashE", experimental = false) -public class CrashE extends Check implements PacketCheck { +public class CrashE extends Check implements PacketCheckI { public CrashE(GrimPlayer playerData) { super(playerData); diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashF.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashF.java index b3f46f9c63..fa6113ebe1 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashF.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashF.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow; @CheckData(name = "CrashF") -public class CrashF extends Check implements PacketCheck { +public class CrashF extends Check implements PacketCheckI { public CrashF(GrimPlayer playerData) { super(playerData); diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashG.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashG.java index 8723441d37..548d117e3f 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashG.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashG.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -14,7 +14,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem; @CheckData(name = "CrashG", description = "Sent negative sequence id") -public class CrashG extends Check implements PacketCheck { +public class CrashG extends Check implements PacketCheckI { public CrashG(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java index 0aa7305767..92238ecc5f 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java +++ b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete; @CheckData(name = "CrashH") -public class CrashH extends Check implements PacketCheck { +public class CrashH extends Check implements PacketCheckI { public CrashH(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitA.java b/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitA.java index 3da67ecde2..a1f6b23277 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitA.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +12,7 @@ import java.util.regex.Pattern; @CheckData(name = "ExploitA", experimental = true) -public class ExploitA extends Check implements PacketCheck { +public class ExploitA extends Check implements PacketCheckI { public ExploitA(GrimPlayer playerData) { super(playerData); diff --git a/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java b/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java index 875b613f15..1a2ee7c646 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -11,7 +11,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete; @CheckData(name = "ExploitB", experimental = true) -public class ExploitB extends Check implements PacketCheck { +public class ExploitB extends Check implements PacketCheckI { public ExploitB(GrimPlayer playerData) { super(playerData); diff --git a/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitC.java b/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitC.java index a08bd4dd9c..3ad9b1e92a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitC.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEditBook; @CheckData(name = "ExploitC", description = "Too long book title") -public class ExploitC extends Check implements PacketCheck { +public class ExploitC extends Check implements PacketCheckI { public ExploitC(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/flight/FlightA.java b/src/main/java/ac/grim/grimac/checks/impl/flight/FlightA.java index f50aa08f44..dd2deb452b 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/flight/FlightA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/flight/FlightA.java @@ -1,13 +1,13 @@ package ac.grim.grimac.checks.impl.flight; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; // This check catches 100% of cheaters. -public class FlightA extends Check implements PacketCheck { +public class FlightA extends Check implements PacketCheckI { public FlightA(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/groundspoof/NoFallA.java b/src/main/java/ac/grim/grimac/checks/impl/groundspoof/NoFallA.java index 12bc91e689..3bd3ed4ebc 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/groundspoof/NoFallA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/groundspoof/NoFallA.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.predictionengine.GhostBlockDetector; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; @@ -18,7 +18,7 @@ // Catches NoFalls for LOOK and GROUND packets // This check runs AFTER the predictions @CheckData(name = "NoFall", configName = "nofall", setback = 10) -public class NoFallA extends Check implements PacketCheck { +public class NoFallA extends Check implements PacketCheckI { public boolean flipPlayerGroundStatus = false; diff --git a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryD.java b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryD.java index 100d2aaa33..fedfe8d108 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryD.java +++ b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryD.java @@ -1,5 +1,6 @@ package ac.grim.grimac.checks.impl.inventory; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.InventoryCheck; import ac.grim.grimac.player.GrimPlayer; @@ -81,4 +82,9 @@ private MoveVectorData findMovement(VectorData vectorData) { return null; } + + @Override + public int getCheckMask() { + return CheckType.POST_PREDICTION.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java b/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java index 9d705c2dc3..b4a93d4626 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java +++ b/src/main/java/ac/grim/grimac/checks/impl/misc/ClientBrand.java @@ -3,7 +3,7 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.impl.exploit.ExploitA; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +12,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; -public class ClientBrand extends Check implements PacketCheck { +public class ClientBrand extends Check implements PacketCheckI { String brand = "vanilla"; boolean hasBrand = false; diff --git a/src/main/java/ac/grim/grimac/checks/impl/misc/FastBreak.java b/src/main/java/ac/grim/grimac/checks/impl/misc/FastBreak.java index 79e63dd83f..84f300e04a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/misc/FastBreak.java +++ b/src/main/java/ac/grim/grimac/checks/impl/misc/FastBreak.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.BlockBreakCheck; +import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockBreak; import ac.grim.grimac.utils.math.GrimMath; @@ -20,7 +20,7 @@ // Also based loosely off of NoCheatPlus FastBreak // Also based off minecraft wiki: https://minecraft.wiki/w/Breaking#Instant_breaking @CheckData(name = "FastBreak", description = "Breaking blocks too quickly") -public class FastBreak extends Check implements BlockBreakCheck { +public class FastBreak extends Check implements BlockBreakCheckI { public FastBreak(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/EntityControl.java b/src/main/java/ac/grim/grimac/checks/impl/movement/EntityControl.java index 75dd93ddc5..be6135678a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/EntityControl.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/EntityControl.java @@ -2,11 +2,12 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "Entity control", configName = "EntityControl") -public class EntityControl extends Check implements PostPredictionCheck { +public class EntityControl extends AbstractPostPredictionCheck { public EntityControl(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/NegativeTimerCheck.java b/src/main/java/ac/grim/grimac/checks/impl/movement/NegativeTimerCheck.java index 23235131ed..6c4d3be851 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/NegativeTimerCheck.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/NegativeTimerCheck.java @@ -1,14 +1,15 @@ package ac.grim.grimac.checks.impl.movement; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @CheckData(name = "NegativeTimer", configName = "NegativeTimer", setback = -1, experimental = true) -public class NegativeTimerCheck extends TimerCheck implements PostPredictionCheck { +public class NegativeTimerCheck extends TimerCheck implements PostPredictionCheckI { public NegativeTimerCheck(GrimPlayer player) { super(player); @@ -39,4 +40,9 @@ public void doCheck(final PacketReceiveEvent event) { public void onReload(ConfigManager config) { clockDrift = (long) (config.getDoubleElse(getConfigName() + ".drift", 1200.0) * 1e6); } + + @Override + public int getCheckMask() { + return CheckType.POST_PREDICTION.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowA.java b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowA.java index 113b439bf8..cc52ab5995 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowA.java @@ -3,13 +3,14 @@ import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.protocol.player.ClientVersion; @CheckData(name = "NoSlowA (Prediction)", configName = "NoSlowA", description = "Was not slowed while using an item", setback = 5) -public class NoSlowA extends Check implements PostPredictionCheck { +public class NoSlowA extends AbstractPostPredictionCheck { double offsetToFlag; double bestOffset = 1; // The player sends that they switched items the next tick if they switch from an item that can be used diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowB.java b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowB.java index 337e5c84e7..2cacb20fc2 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowB.java @@ -2,13 +2,13 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "NoSlowB", description = "Sprinting with too low hunger", setback = 5) -public class NoSlowB extends Check implements PacketCheck { +public class NoSlowB extends Check implements PacketCheckI { public NoSlowB(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowC.java b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowC.java index 50ee8ab0d1..2db42b93f2 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowC.java @@ -1,9 +1,10 @@ package ac.grim.grimac.checks.impl.movement; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -13,7 +14,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; @CheckData(name = "NoSlowC", description = "Sprinting while sneaking", setback = 5, experimental = true) -public class NoSlowC extends Check implements PostPredictionCheck, PacketCheck { +public class NoSlowC extends Check implements PostPredictionCheckI, PacketCheckI { public NoSlowC(GrimPlayer player) { super(player); } @@ -50,4 +51,9 @@ public void onPredictionComplete(final PredictionComplete predictionComplete) { } else reward(); } } + + @Override + public int getCheckMask() { + return CheckType.POST_PREDICTION.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowD.java b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowD.java index 555a5c2226..4b07d1a882 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowD.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowD.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -11,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; @CheckData(name = "NoSlowD", description = "Sprinting while using an item", setback = 5, experimental = true) -public class NoSlowD extends Check implements PostPredictionCheck { +public class NoSlowD extends AbstractPostPredictionCheck { public NoSlowD(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowE.java b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowE.java index d9ea6c1d8b..e3c1de4944 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowE.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +13,7 @@ import static com.github.retrooper.packetevents.protocol.potion.PotionTypes.BLINDNESS; @CheckData(name = "NoSlowE", description = "Started sprinting while having blindness", setback = 5, experimental = true) -public class NoSlowE extends Check implements PostPredictionCheck { +public class NoSlowE extends AbstractPostPredictionCheck { public NoSlowE(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/PredictionRunner.java b/src/main/java/ac/grim/grimac/checks/impl/movement/PredictionRunner.java index 709176ac21..cca05d468c 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/PredictionRunner.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/PredictionRunner.java @@ -1,11 +1,11 @@ package ac.grim.grimac.checks.impl.movement; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PositionCheck; +import ac.grim.grimac.checks.type.interfaces.PositionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PositionUpdate; -public class PredictionRunner extends Check implements PositionCheck { +public class PredictionRunner extends Check implements PositionCheckI { public PredictionRunner(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/SetbackBlocker.java b/src/main/java/ac/grim/grimac/checks/impl/movement/SetbackBlocker.java index 5c816c7cf9..f1d6ececb1 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/SetbackBlocker.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/SetbackBlocker.java @@ -1,14 +1,14 @@ package ac.grim.grimac.checks.impl.movement; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.util.Vector3d; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; -public class SetbackBlocker extends Check implements PacketCheck { +public class SetbackBlocker extends Check implements PacketCheckI { public SetbackBlocker(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/TickTimer.java b/src/main/java/ac/grim/grimac/checks/impl/movement/TickTimer.java index 4e687a2202..338241e9fa 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/TickTimer.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/TickTimer.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "TickTimer", setback = 1) -public class TickTimer extends Check implements PostPredictionCheck { +public class TickTimer extends Check implements PostPredictionCheckI { private boolean receivedTickEnd = true; private int flyingPackets = 0; diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/TimerCheck.java b/src/main/java/ac/grim/grimac/checks/impl/movement/TimerCheck.java index f43cb54f30..0ce378f9f7 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/TimerCheck.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/TimerCheck.java @@ -3,14 +3,14 @@ import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon; @CheckData(name = "Timer", configName = "TimerA", setback = 10) -public class TimerCheck extends Check implements PacketCheck { +public class TimerCheck extends Check implements PacketCheckI { long timerBalanceRealTime = 0; // Default value is real time minus max keep-alive time diff --git a/src/main/java/ac/grim/grimac/checks/impl/movement/VehiclePredictionRunner.java b/src/main/java/ac/grim/grimac/checks/impl/movement/VehiclePredictionRunner.java index 0f40af342c..3151b3756b 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/movement/VehiclePredictionRunner.java +++ b/src/main/java/ac/grim/grimac/checks/impl/movement/VehiclePredictionRunner.java @@ -1,12 +1,12 @@ package ac.grim.grimac.checks.impl.movement; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.VehicleCheck; +import ac.grim.grimac.checks.type.interfaces.VehicleCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PositionUpdate; import ac.grim.grimac.utils.anticheat.update.VehiclePositionUpdate; -public class VehiclePredictionRunner extends Check implements VehicleCheck { +public class VehiclePredictionRunner extends Check implements VehicleCheckI { public VehiclePredictionRunner(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsA.java b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsA.java index 77df407c99..75bdc03720 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsA.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -10,7 +10,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; @CheckData(name = "MultiActionsA", description = "Attacked while using an item", experimental = true) -public class MultiActionsA extends Check implements PacketCheck { +public class MultiActionsA extends Check implements PacketCheckI { public MultiActionsA(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsB.java b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsB.java index 8bd563e7a3..744974a0e4 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsB.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -14,7 +14,7 @@ import static ac.grim.grimac.events.packets.patch.ResyncWorldUtil.resyncPosition; @CheckData(name = "MultiActionsB", description = "Breaking blocks while using an item", experimental = true) -public class MultiActionsB extends Check implements PacketCheck { +public class MultiActionsB extends Check implements PacketCheckI { public MultiActionsB(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java index 223addbbb1..09cd14b8ea 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsC.java @@ -2,14 +2,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "MultiActionsC", description = "Clicked in inventory while performing other actions", experimental = true) -public class MultiActionsC extends Check implements PacketCheck { +public class MultiActionsC extends Check implements PacketCheckI { public MultiActionsC(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsD.java b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsD.java index b5de3b910a..4ea1f2d147 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsD.java +++ b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsD.java @@ -2,13 +2,13 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "MultiActionsD", description = "Closed inventory while performing other actions", experimental = true) -public class MultiActionsD extends Check implements PacketCheck { +public class MultiActionsD extends Check implements PacketCheckI { public MultiActionsD(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsE.java b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsE.java index f5e221c3cd..0dc6fb2b6a 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/multiactions/MultiActionsE.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -10,7 +10,7 @@ import com.github.retrooper.packetevents.protocol.player.InteractionHand; @CheckData(name = "MultiActionsE", description = "Swinging while using an item", experimental = true) -public class MultiActionsE extends Check implements PacketCheck { +public class MultiActionsE extends Check implements PacketCheckI { public MultiActionsE(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java index a34120eb56..a4764a54e6 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java @@ -1,8 +1,10 @@ package ac.grim.grimac.checks.impl.packetorder; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -11,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow.WindowClickType; @CheckData(name = "PacketOrderA", experimental = true) -public class PacketOrderA extends Check implements PostPredictionCheck { +public class PacketOrderA extends AbstractPostPredictionCheck { public PacketOrderA(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderB.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderB.java index 6491bc8ade..5efac62dbb 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderB.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; @CheckData(name = "PacketOrderB") -public class PacketOrderB extends Check implements PacketCheck { +public class PacketOrderB extends Check implements PacketCheckI { // 1.9 packet order: INTERACT -> ANIMATION // 1.8 packet order: ANIMATION -> INTERACT diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderC.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderC.java index 57c7572026..7a45e6d79d 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderC.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderC.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -14,7 +14,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "PacketOrderC", experimental = true) -public class PacketOrderC extends Check implements PacketCheck { +public class PacketOrderC extends Check implements PacketCheckI { public PacketOrderC(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java index e103e89c98..229176554f 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderD.java @@ -2,11 +2,11 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "PacketOrderD") -public class PacketOrderD extends Check implements PacketCheck { +public class PacketOrderD extends Check implements PacketCheckI { public PacketOrderD(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java index aaf111e4de..2e14b319d0 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java @@ -1,15 +1,17 @@ package ac.grim.grimac.checks.impl.packetorder; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "PacketOrderE", experimental = true) -public class PacketOrderE extends Check implements PostPredictionCheck { +public class PacketOrderE extends AbstractPostPredictionCheck { public PacketOrderE(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java index d5236b3389..ddb36c954c 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; @CheckData(name = "PacketOrderF", experimental = true) -public class PacketOrderF extends Check implements PostPredictionCheck { +public class PacketOrderF extends AbstractPostPredictionCheck { public PacketOrderF(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java index ac675e186e..f7a86342ee 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerDigging; @CheckData(name = "PacketOrderG", experimental = true) -public class PacketOrderG extends Check implements PostPredictionCheck { +public class PacketOrderG extends AbstractPostPredictionCheck { public PacketOrderG(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java index 92156adc0a..b002febe58 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -11,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; @CheckData(name = "PacketOrderH", experimental = true) -public class PacketOrderH extends Check implements PostPredictionCheck { +public class PacketOrderH extends AbstractPostPredictionCheck { public PacketOrderH(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java index b6b373fb2a..ed3c268837 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java @@ -3,7 +3,8 @@ import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.nmsutil.BlockBreakSpeed; @@ -17,7 +18,7 @@ import java.util.ArrayDeque; @CheckData(name = "PacketOrderI", experimental = true) -public class PacketOrderI extends Check implements PostPredictionCheck { +public class PacketOrderI extends AbstractPostPredictionCheck { public PacketOrderI(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java index bdded5deb7..f9dc0d5f94 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java @@ -2,14 +2,15 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @CheckData(name = "PacketOrderJ", experimental = true) -public class PacketOrderJ extends Check implements PostPredictionCheck { +public class PacketOrderJ extends AbstractPostPredictionCheck { public PacketOrderJ(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java index 82eef65b88..ca1c0d1f09 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +13,7 @@ import java.util.ArrayDeque; @CheckData(name = "PacketOrderK", experimental = true) -public class PacketOrderK extends Check implements PostPredictionCheck { +public class PacketOrderK extends AbstractPostPredictionCheck { public PacketOrderK(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java index a00a2c62b0..07b24f9bc8 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -14,7 +15,7 @@ import java.util.ArrayDeque; @CheckData(name = "PacketOrderL", experimental = true) -public class PacketOrderL extends Check implements PostPredictionCheck { +public class PacketOrderL extends AbstractPostPredictionCheck { public PacketOrderL(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java index c2cbd3158c..75c627487d 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerBlockPlacement; @CheckData(name = "PacketOrderM", experimental = true) -public class PacketOrderM extends Check implements PostPredictionCheck { +public class PacketOrderM extends AbstractPostPredictionCheck { public PacketOrderM(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java index ff35be31d9..35443b0674 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderO.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction; @CheckData(name = "PacketOrderO", experimental = true) -public class PacketOrderO extends Check implements PacketCheck { +public class PacketOrderO extends Check implements PacketCheckI { public PacketOrderO(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderP.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderP.java index e58f1e7e7d..b44cae43e0 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderP.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderP.java @@ -2,7 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -13,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "PacketOrderP", experimental = true) -public class PacketOrderP extends Check implements PacketCheck { +public class PacketOrderP extends Check implements PacketCheckI { public PacketOrderP(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java index 0506b96455..03680df695 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java +++ b/src/main/java/ac/grim/grimac/checks/impl/packetorder/PacketOrderProcessor.java @@ -1,7 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +12,7 @@ import org.jetbrains.annotations.Contract; @Getter -public final class PacketOrderProcessor extends Check implements PacketCheck { +public final class PacketOrderProcessor extends Check implements PacketCheckI { public PacketOrderProcessor(final GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/checks/impl/post/Post.java b/src/main/java/ac/grim/grimac/checks/impl/post/Post.java index 8a5786a5f7..615c769dc7 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/post/Post.java +++ b/src/main/java/ac/grim/grimac/checks/impl/post/Post.java @@ -1,9 +1,10 @@ package ac.grim.grimac.checks.impl.post; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PacketCheck; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.lists.EvictingQueue; @@ -24,7 +25,7 @@ import static com.github.retrooper.packetevents.protocol.packettype.PacketType.Play.Client.*; @CheckData(name = "Post") -public class Post extends Check implements PacketCheck, PostPredictionCheck { +public class Post extends Check implements PacketCheckI, PostPredictionCheckI { private final ArrayDeque post = new ArrayDeque<>(); // Due to 1.9+ missing the idle packet, we must queue flags // 1.8 clients will have the same logic for simplicity, although it's not needed @@ -103,4 +104,9 @@ public void onPacketReceive(final PacketReceiveEvent event) { } } } + + @Override + public int getCheckMask() { + return CheckType.POST_PREDICTION.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/prediction/DebugHandler.java b/src/main/java/ac/grim/grimac/checks/impl/prediction/DebugHandler.java index 02585e3128..9d507169e4 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/prediction/DebugHandler.java +++ b/src/main/java/ac/grim/grimac/checks/impl/prediction/DebugHandler.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.LogUtil; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; @@ -16,7 +17,7 @@ import java.util.concurrent.CopyOnWriteArraySet; @CheckData(name = "Prediction (Debug)") -public class DebugHandler extends Check implements PostPredictionCheck { +public class DebugHandler extends AbstractPostPredictionCheck { Set listeners = new CopyOnWriteArraySet<>(new HashSet<>()); boolean outputToConsole = false; diff --git a/src/main/java/ac/grim/grimac/checks/impl/prediction/NoFallB.java b/src/main/java/ac/grim/grimac/checks/impl/prediction/NoFallB.java index ead538eec9..cdefde58df 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/prediction/NoFallB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/prediction/NoFallB.java @@ -2,7 +2,8 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import com.github.retrooper.packetevents.PacketEvents; @@ -10,7 +11,7 @@ import com.github.retrooper.packetevents.protocol.player.GameMode; @CheckData(name = "GroundSpoof", configName = "GroundSpoof", setback = 10, decay = 0.01) -public class NoFallB extends Check implements PostPredictionCheck { +public class NoFallB extends AbstractPostPredictionCheck { public NoFallB(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/checks/impl/prediction/OffsetHandler.java b/src/main/java/ac/grim/grimac/checks/impl/prediction/OffsetHandler.java index c1012078bc..2cb91e7e0f 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/prediction/OffsetHandler.java +++ b/src/main/java/ac/grim/grimac/checks/impl/prediction/OffsetHandler.java @@ -4,7 +4,8 @@ import ac.grim.grimac.api.events.CompletePredictionEvent; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import org.bukkit.Bukkit; @@ -12,7 +13,7 @@ import java.util.concurrent.atomic.AtomicInteger; @CheckData(name = "Simulation", configName = "Simulation", decay = 0.02) -public class OffsetHandler extends Check implements PostPredictionCheck { +public class OffsetHandler extends AbstractPostPredictionCheck { // Config double setbackDecayMultiplier; double threshold; diff --git a/src/main/java/ac/grim/grimac/checks/impl/prediction/Phase.java b/src/main/java/ac/grim/grimac/checks/impl/prediction/Phase.java index 8cc332aa73..3ea87a3de3 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/prediction/Phase.java +++ b/src/main/java/ac/grim/grimac/checks/impl/prediction/Phase.java @@ -1,8 +1,10 @@ package ac.grim.grimac.checks.impl.prediction; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; @@ -16,7 +18,7 @@ import java.util.List; @CheckData(name = "Phase", configName = "Phase", setback = 1, decay = 0.005) -public class Phase extends Check implements PostPredictionCheck { +public class Phase extends AbstractPostPredictionCheck { SimpleCollisionBox oldBB; public Phase(GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java b/src/main/java/ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java index c336fe3882..a6a8704ebe 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java +++ b/src/main/java/ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java @@ -1,9 +1,11 @@ package ac.grim.grimac.checks.impl.velocity; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.data.VectorData; @@ -28,7 +30,7 @@ import java.util.LinkedList; @CheckData(name = "AntiExplosion", configName = "Explosion", setback = 10) -public class ExplosionHandler extends Check implements PostPredictionCheck { +public class ExplosionHandler extends AbstractPostPredictionCheck { Deque firstBreadMap = new LinkedList<>(); VelocityData lastExplosionsKnownTaken = null; @@ -274,5 +276,4 @@ public void onReload(ConfigManager config) { setbackVL = config.getDoubleElse("Explosion.setbackvl", 10); if (setbackVL == -1) setbackVL = Double.MAX_VALUE; } - } diff --git a/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java b/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java index 3db83462b5..06b87d3381 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java +++ b/src/main/java/ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java @@ -1,10 +1,12 @@ package ac.grim.grimac.checks.impl.velocity; import ac.grim.grimac.GrimAPI; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.data.Pair; @@ -23,7 +25,7 @@ // We are making a velocity sandwich between two pieces of transaction packets (bread) @CheckData(name = "AntiKB", alternativeName = "AntiKnockback", configName = "Knockback", setback = 10, decay = 0.025) -public class KnockbackHandler extends Check implements PostPredictionCheck { +public class KnockbackHandler extends AbstractPostPredictionCheck { Deque firstBreadMap = new LinkedList<>(); Deque lastKnockbackKnownTaken = new LinkedList<>(); @@ -251,5 +253,4 @@ public void onReload(ConfigManager config) { if (maxAdv < 0) maxAdv = Double.MAX_VALUE; if (immediate < 0) immediate = Double.MAX_VALUE; } - } diff --git a/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java b/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java index 3162f1417b..d6567ffa99 100644 --- a/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java @@ -3,6 +3,9 @@ import ac.grim.grimac.api.CheckType; import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.interfaces.BlockPlaceCheckI; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; +import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockPlace; import ac.grim.grimac.utils.collisions.HitboxData; @@ -17,7 +20,7 @@ import java.util.ArrayList; import java.util.List; -public class BlockPlaceCheck extends Check implements RotationCheck, PostPredictionCheck { +public class BlockPlaceCheck extends Check implements RotationCheckI, PostPredictionCheckI, BlockPlaceCheckI { private static final List weirdBoxes = new ArrayList<>(); private static final List buggyBoxes = new ArrayList<>(); private final SimpleCollisionBox[] boxes = new SimpleCollisionBox[ComplexCollisionBox.DEFAULT_MAX_COLLISION_BOX_SIZE]; @@ -29,12 +32,10 @@ public BlockPlaceCheck(GrimPlayer player) { } // Method called immediately after a block is placed, before forwarding block place to server - public void onBlockPlace(final BlockPlace place) { - } + public void onBlockPlace(final BlockPlace place) {} // Method called the flying packet after the block place - public void onPostFlyingBlockPlace(BlockPlace place) { - } + public void onPostFlyingBlockPlace(BlockPlace place) {} @Override public void onReload(ConfigManager config) { diff --git a/src/main/java/ac/grim/grimac/checks/type/InventoryCheck.java b/src/main/java/ac/grim/grimac/checks/type/InventoryCheck.java index 5c3f1ed94c..1e8ac69459 100644 --- a/src/main/java/ac/grim/grimac/checks/type/InventoryCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/InventoryCheck.java @@ -1,5 +1,6 @@ package ac.grim.grimac.checks.type; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -8,7 +9,7 @@ import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerCloseWindow; import org.jetbrains.annotations.MustBeInvokedByOverriders; -public class InventoryCheck extends BlockPlaceCheck implements PacketCheck { +public class InventoryCheck extends BlockPlaceCheck implements PacketCheckI { // Impossible transaction ID protected static final long NONE = Long.MAX_VALUE; diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPostPredictionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPostPredictionCheck.java new file mode 100644 index 0000000000..4b1e3a26cc --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPostPredictionCheck.java @@ -0,0 +1,17 @@ +package ac.grim.grimac.checks.type.abstracts; + +import ac.grim.grimac.api.CheckType; +import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; +import ac.grim.grimac.player.GrimPlayer; + +public class AbstractPostPredictionCheck extends Check implements PostPredictionCheckI { + public AbstractPostPredictionCheck(GrimPlayer player) { + super(player); + } + + @Override + public int getCheckMask() { + return CheckType.POST_PREDICTION.getMask(); + } +} diff --git a/src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java similarity index 57% rename from src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java rename to src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java index 3069774b8d..526df5db6f 100644 --- a/src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java @@ -1,13 +1,13 @@ -package ac.grim.grimac.checks.type; +package ac.grim.grimac.checks.type.interfaces; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.BlockBreak; -public interface BlockBreakCheck extends PostPredictionCheck { +public interface BlockBreakCheckI extends PostPredictionCheckI { default void onBlockBreak(final BlockBreak blockBreak) {} @Override default int getCheckMask() { - return CheckType.BLOCK_PLACE.getMask(); + return CheckType.BLOCK_BREAK.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java new file mode 100644 index 0000000000..b954539462 --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java @@ -0,0 +1,15 @@ +package ac.grim.grimac.checks.type.interfaces; + +import ac.grim.grimac.api.CheckType; +import ac.grim.grimac.utils.anticheat.update.BlockPlace; + +public interface BlockPlaceCheckI extends PostPredictionCheckI { + void onBlockPlace(final BlockPlace place); + + void onPostFlyingBlockPlace(BlockPlace place); + + @Override + default int getCheckMask() { + return CheckType.BLOCK_PLACE.getMask(); + } +} \ No newline at end of file diff --git a/src/main/java/ac/grim/grimac/checks/type/PacketCheck.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java similarity index 81% rename from src/main/java/ac/grim/grimac/checks/type/PacketCheck.java rename to src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java index cd8011b7d9..86c396e9e0 100644 --- a/src/main/java/ac/grim/grimac/checks/type/PacketCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java @@ -1,11 +1,11 @@ -package ac.grim.grimac.checks.type; +package ac.grim.grimac.checks.type.interfaces; import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.CheckType; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; -public interface PacketCheck extends AbstractCheck { +public interface PacketCheckI extends AbstractCheck { default void onPacketReceive(final PacketReceiveEvent event) {} default void onPacketSend(final PacketSendEvent event) {} @Override diff --git a/src/main/java/ac/grim/grimac/checks/type/PositionCheck.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java similarity index 75% rename from src/main/java/ac/grim/grimac/checks/type/PositionCheck.java rename to src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java index f94e8acac7..c117a52c28 100644 --- a/src/main/java/ac/grim/grimac/checks/type/PositionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java @@ -1,10 +1,10 @@ -package ac.grim.grimac.checks.type; +package ac.grim.grimac.checks.type.interfaces; import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.PositionUpdate; -public interface PositionCheck extends AbstractCheck { +public interface PositionCheckI extends AbstractCheck { default void onPositionUpdate(final PositionUpdate positionUpdate) { } diff --git a/src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java similarity index 73% rename from src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java rename to src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java index 0fe5077ed2..a15cfd1722 100644 --- a/src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java @@ -1,12 +1,13 @@ -package ac.grim.grimac.checks.type; +package ac.grim.grimac.checks.type.interfaces; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; -public interface PostPredictionCheck extends PacketCheck { +public interface PostPredictionCheckI extends PacketCheckI { default void onPredictionComplete(final PredictionComplete predictionComplete) { } + @Override default int getCheckMask() { return CheckType.POST_PREDICTION.getMask(); diff --git a/src/main/java/ac/grim/grimac/checks/type/RotationCheck.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java similarity index 75% rename from src/main/java/ac/grim/grimac/checks/type/RotationCheck.java rename to src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java index 12fcc9d8ed..75949e2a6e 100644 --- a/src/main/java/ac/grim/grimac/checks/type/RotationCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java @@ -1,10 +1,10 @@ -package ac.grim.grimac.checks.type; +package ac.grim.grimac.checks.type.interfaces; import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; -public interface RotationCheck extends AbstractCheck { +public interface RotationCheckI extends AbstractCheck { default void process(final RotationUpdate rotationUpdate) { } diff --git a/src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java similarity index 75% rename from src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java rename to src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java index e5d706ee9c..dc1228e499 100644 --- a/src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java @@ -1,10 +1,10 @@ -package ac.grim.grimac.checks.type; +package ac.grim.grimac.checks.type.interfaces; import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.VehiclePositionUpdate; -public interface VehicleCheck extends AbstractCheck { +public interface VehicleCheckI extends AbstractCheck { void process(final VehiclePositionUpdate vehicleUpdate); diff --git a/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java b/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java index 56d22eaf53..ea2f1d688a 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java @@ -2,14 +2,14 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketSendEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.player.GameMode; import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerChangeGameState; -public class PacketChangeGameState extends Check implements PacketCheck { +public class PacketChangeGameState extends Check implements PacketCheckI { public PacketChangeGameState(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java b/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java index 112af71bc0..b2af7b524f 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java @@ -2,7 +2,7 @@ import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.LogUtil; import ac.grim.grimac.utils.data.TrackerData; @@ -29,7 +29,7 @@ import java.util.List; import java.util.UUID; -public class PacketEntityReplication extends Check implements PacketCheck { +public class PacketEntityReplication extends Check implements PacketCheckI { private boolean hasSentPreWavePacket = true; diff --git a/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java b/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java index d60eabe0de..141ba8d4fc 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java @@ -2,7 +2,7 @@ import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; @@ -13,7 +13,7 @@ // The client can send ability packets out of order due to Mojang's excellent netcode design. // We must delay the second ability packet until the tick after the first is received // Else the player will fly for a tick, and we won't know about it, which is bad. -public class PacketPlayerAbilities extends Check implements PacketCheck { +public class PacketPlayerAbilities extends Check implements PacketCheckI { public PacketPlayerAbilities(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/events/packets/PacketWorldBorder.java b/src/main/java/ac/grim/grimac/events/packets/PacketWorldBorder.java index 6e23ea5bd8..225ad53475 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketWorldBorder.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketWorldBorder.java @@ -1,14 +1,14 @@ package ac.grim.grimac.events.packets; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.math.GrimMath; import com.github.retrooper.packetevents.event.PacketSendEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.server.*; -public class PacketWorldBorder extends Check implements PacketCheck { +public class PacketWorldBorder extends Check implements PacketCheckI { double centerX; double centerZ; double oldDiameter; diff --git a/src/main/java/ac/grim/grimac/manager/ActionManager.java b/src/main/java/ac/grim/grimac/manager/ActionManager.java index 3bb0694386..e2bb716ff8 100644 --- a/src/main/java/ac/grim/grimac/manager/ActionManager.java +++ b/src/main/java/ac/grim/grimac/manager/ActionManager.java @@ -1,7 +1,7 @@ package ac.grim.grimac.manager; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -9,7 +9,7 @@ import lombok.Getter; @Getter -public class ActionManager extends Check implements PacketCheck { +public class ActionManager extends Check implements PacketCheckI { private boolean attacking = false; private long lastAttack = 0; diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 9adab3ba43..74102ed5da 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -21,9 +21,7 @@ import ac.grim.grimac.checks.impl.movement.*; import ac.grim.grimac.checks.impl.packetorder.*; import ac.grim.grimac.checks.impl.multiactions.*; -import ac.grim.grimac.checks.impl.packetorder.*; import ac.grim.grimac.checks.impl.post.Post; -import ac.grim.grimac.checks.impl.multiactions.*; import ac.grim.grimac.checks.impl.prediction.DebugHandler; import ac.grim.grimac.checks.impl.prediction.NoFallB; import ac.grim.grimac.checks.impl.prediction.OffsetHandler; @@ -32,6 +30,7 @@ import ac.grim.grimac.checks.impl.velocity.ExplosionHandler; import ac.grim.grimac.checks.impl.velocity.KnockbackHandler; import ac.grim.grimac.checks.type.*; +import ac.grim.grimac.checks.type.interfaces.*; import ac.grim.grimac.events.packets.PacketChangeGameState; import ac.grim.grimac.events.packets.PacketEntityReplication; import ac.grim.grimac.events.packets.PacketPlayerAbilities; @@ -65,14 +64,14 @@ public class CheckManager { private final GrimPlayer player; // Fast arrays for iteration - private PacketCheck[] packetChecks; - private PositionCheck[] positionChecks; - private RotationCheck[] rotationChecks; - private VehicleCheck[] vehicleChecks; - private PacketCheck[] prePredictionChecks; - private BlockBreakCheck[] blockBreakChecks; + private PacketCheckI[] packetChecks; + private PositionCheckI[] positionChecks; + private RotationCheckI[] rotationChecks; + private VehicleCheckI[] vehicleChecks; + private PacketCheckI[] prePredictionChecks; + private BlockBreakCheckI[] blockBreakChecks; private BlockPlaceCheck[] blockPlaceChecks; - private PostPredictionCheck[] postPredictionChecks; + private PostPredictionCheckI[] postPredictionChecks; // Lookup map for getting specific checks public Map, AbstractCheck> loadedChecks = new HashMap<>(); @@ -81,7 +80,7 @@ public class CheckManager { public CheckManager(GrimPlayer player) { this.player = player; // Packet Checks - Map, PacketCheck> packetCheckMap = new HashMap<>(); + Map, PacketCheckI> packetCheckMap = new HashMap<>(); addCheck(PacketOrderProcessor.class, player.packetOrderProcessor, packetCheckMap); addCheck(Reach.class, new Reach(player), packetCheckMap); addCheck(HitboxMiss.class, new HitboxMiss(player), packetCheckMap); @@ -133,32 +132,32 @@ public CheckManager(GrimPlayer player) { addCheck(PacketOrderO.class, new PacketOrderO(player), packetCheckMap); addCheck(NoSlowB.class, new NoSlowB(player), packetCheckMap); addCheck(SetbackBlocker.class, new SetbackBlocker(player), packetCheckMap); - packetChecks = packetCheckMap.values().toArray(new PacketCheck[0]); + packetChecks = packetCheckMap.values().toArray(new PacketCheckI[0]); loadedChecks.putAll(packetCheckMap); // Position Checks - Map, PositionCheck> positionCheckMap = new HashMap<>(); + Map, PositionCheckI> positionCheckMap = new HashMap<>(); addCheck(PredictionRunner.class, new PredictionRunner(player), positionCheckMap); addCheck(CompensatedCooldown.class, new CompensatedCooldown(player), positionCheckMap); - positionChecks = positionCheckMap.values().toArray(new PositionCheck[0]); + positionChecks = positionCheckMap.values().toArray(new PositionCheckI[0]); loadedChecks.putAll(positionCheckMap); // Rotation Checks - Map, RotationCheck> rotationCheckMap = new HashMap<>(); + Map, RotationCheckI> rotationCheckMap = new HashMap<>(); addCheck(AimProcessor.class, new AimProcessor(player), rotationCheckMap); addCheck(AimModulo360.class, new AimModulo360(player), rotationCheckMap); addCheck(AimDuplicateLook.class, new AimDuplicateLook(player), rotationCheckMap); - rotationChecks = rotationCheckMap.values().toArray(new RotationCheck[0]); + rotationChecks = rotationCheckMap.values().toArray(new RotationCheckI[0]); loadedChecks.putAll(rotationCheckMap); // Vehicle Checks - Map, VehicleCheck> vehicleCheckMap = new HashMap<>(); + Map, VehicleCheckI> vehicleCheckMap = new HashMap<>(); addCheck(VehiclePredictionRunner.class, new VehiclePredictionRunner(player), vehicleCheckMap); - vehicleChecks = vehicleCheckMap.values().toArray(new VehicleCheck[0]); + vehicleChecks = vehicleCheckMap.values().toArray(new VehicleCheckI[0]); loadedChecks.putAll(vehicleCheckMap); // Pre Prediction Checks - Map, PacketCheck> prePredictionCheckMap = new HashMap<>(); + Map, PacketCheckI> prePredictionCheckMap = new HashMap<>(); addCheck(TimerCheck.class, new TimerCheck(player), prePredictionCheckMap); addCheck(TickTimer.class, new TickTimer(player), prePredictionCheckMap); addCheck(CrashA.class, new CrashA(player), prePredictionCheckMap); @@ -173,15 +172,15 @@ public CheckManager(GrimPlayer player) { addCheck(ExploitB.class, new ExploitB(player), prePredictionCheckMap); addCheck(ExploitC.class, new ExploitC(player), prePredictionCheckMap); addCheck(VehicleTimer.class, new VehicleTimer(player), prePredictionCheckMap); - prePredictionChecks = prePredictionCheckMap.values().toArray(new PacketCheck[0]); + prePredictionChecks = prePredictionCheckMap.values().toArray(new PacketCheckI[0]); loadedChecks.putAll(prePredictionCheckMap); // Block Break Checks - Map, BlockBreakCheck> blockBreakCheckMap = new HashMap<>(); + Map, BlockBreakCheckI> blockBreakCheckMap = new HashMap<>(); addCheck(BadPacketsX.class, new BadPacketsX(player), blockBreakCheckMap); addCheck(BadPacketsZ.class, new BadPacketsZ(player), blockBreakCheckMap); addCheck(FastBreak.class, new FastBreak(player), blockBreakCheckMap); - blockBreakChecks = blockBreakCheckMap.values().toArray(new BlockBreakCheck[0]); + blockBreakChecks = blockBreakCheckMap.values().toArray(new BlockBreakCheckI[0]); loadedChecks.putAll(blockBreakCheckMap); // Block Place Checks @@ -203,7 +202,7 @@ public CheckManager(GrimPlayer player) { loadedChecks.putAll(blockPlaceCheckMap); // Post Prediction Checks - Map, PostPredictionCheck> postPredictionCheckMap = new HashMap<>(); + Map, PostPredictionCheckI> postPredictionCheckMap = new HashMap<>(); addCheck(NegativeTimerCheck.class, new NegativeTimerCheck(player), postPredictionCheckMap); addCheck(ExplosionHandler.class, new ExplosionHandler(player), postPredictionCheckMap); addCheck(KnockbackHandler.class, new KnockbackHandler(player), postPredictionCheckMap); @@ -236,7 +235,7 @@ public CheckManager(GrimPlayer player) { addCheck(CompensatedFireworks.class, player.compensatedFireworks, postPredictionCheckMap); addCheck(SneakingEstimator.class, new SneakingEstimator(player), postPredictionCheckMap); addCheck(LastInstanceManager.class, player.lastInstanceManager, postPredictionCheckMap); - postPredictionChecks = postPredictionCheckMap.values().toArray(new PostPredictionCheck[0]); + postPredictionChecks = postPredictionCheckMap.values().toArray(new PostPredictionCheckI[0]); loadedChecks.putAll(postPredictionCheckMap); init(); @@ -351,38 +350,38 @@ private void rebuildCheckArrays() { List sorted = topologicalSort(loadedChecks.values()); // Use lists first since we don't know final size - List newPacketChecks = new ArrayList<>(); - List newPositionChecks = new ArrayList<>(); - List newRotationChecks = new ArrayList<>(); - List newVehicleChecks = new ArrayList<>(); - List newPrePredictionChecks = new ArrayList<>(); - List newBlockBreakChecks = new ArrayList<>(); + List newPacketChecks = new ArrayList<>(); + List newPositionChecks = new ArrayList<>(); + List newRotationChecks = new ArrayList<>(); + List newVehicleChecks = new ArrayList<>(); + List newPrePredictionChecks = new ArrayList<>(); + List newBlockBreakChecks = new ArrayList<>(); List newBlockPlaceChecks = new ArrayList<>(); - List newPostPredictionChecks = new ArrayList<>(); + List newPostPredictionChecks = new ArrayList<>(); // Single pass, add to all applicable lists for (AbstractCheck check : sorted) { // A check can be multiple types, so no else-if - if (check.isCheckType(CheckType.PACKET)) newPacketChecks.add((PacketCheck) check); - if (check.isCheckType(CheckType.POSITION)) newPositionChecks.add((PositionCheck) check); - if (check.isCheckType(CheckType.ROTATION)) newRotationChecks.add((RotationCheck) check); - if (check.isCheckType(CheckType.VEHICLE)) newVehicleChecks.add((VehicleCheck) check); - if (check.isCheckType(CheckType.PRE_PREDICTION)) newPrePredictionChecks.add((PacketCheck) check); - if (check.isCheckType(CheckType.BLOCK_BREAK)) newBlockBreakChecks.add((BlockBreakCheck) check); + if (check.isCheckType(CheckType.PACKET)) newPacketChecks.add((PacketCheckI) check); + if (check.isCheckType(CheckType.POSITION)) newPositionChecks.add((PositionCheckI) check); + if (check.isCheckType(CheckType.ROTATION)) newRotationChecks.add((RotationCheckI) check); + if (check.isCheckType(CheckType.VEHICLE)) newVehicleChecks.add((VehicleCheckI) check); + if (check.isCheckType(CheckType.PRE_PREDICTION)) newPrePredictionChecks.add((PacketCheckI) check); + if (check.isCheckType(CheckType.BLOCK_BREAK)) newBlockBreakChecks.add((BlockBreakCheckI) check); if (check.isCheckType(CheckType.BLOCK_PLACE)) newBlockPlaceChecks.add((BlockPlaceCheck) check); - if (check.isCheckType(CheckType.POST_PREDICTION)) newPostPredictionChecks.add((PostPredictionCheck) check); + if (check.isCheckType(CheckType.POST_PREDICTION)) newPostPredictionChecks.add((PostPredictionCheckI) check); } // Convert lists to arrays atomically - this.packetChecks = newPacketChecks.toArray(new PacketCheck[0]); - this.positionChecks = newPositionChecks.toArray(new PositionCheck[0]); - this.rotationChecks = newRotationChecks.toArray(new RotationCheck[0]); - this.vehicleChecks = newVehicleChecks.toArray(new VehicleCheck[0]); - this.prePredictionChecks = newPrePredictionChecks.toArray(new PacketCheck[0]); - this.blockBreakChecks = newBlockBreakChecks.toArray(new BlockBreakCheck[0]); + this.packetChecks = newPacketChecks.toArray(new PacketCheckI[0]); + this.positionChecks = newPositionChecks.toArray(new PositionCheckI[0]); + this.rotationChecks = newRotationChecks.toArray(new RotationCheckI[0]); + this.vehicleChecks = newVehicleChecks.toArray(new VehicleCheckI[0]); + this.prePredictionChecks = newPrePredictionChecks.toArray(new PacketCheckI[0]); + this.blockBreakChecks = newBlockBreakChecks.toArray(new BlockBreakCheckI[0]); this.blockPlaceChecks = newBlockPlaceChecks.toArray(new BlockPlaceCheck[0]); - this.postPredictionChecks = newPostPredictionChecks.toArray(new PostPredictionCheck[0]); + this.postPredictionChecks = newPostPredictionChecks.toArray(new PostPredictionCheckI[0]); } /** @@ -457,70 +456,70 @@ private boolean checkClassAppliesToPlayerVersion(Class } @SuppressWarnings("unchecked") - public T getPositionCheck(Class check) { + public T getPositionCheck(Class check) { // return (T) positionCheck.get(check); return (T) loadedChecks.get(check); } @SuppressWarnings("unchecked") - public T getRotationCheck(Class check) { + public T getRotationCheck(Class check) { // return (T) rotationCheck.get(check); return (T) loadedChecks.get(check); } @SuppressWarnings("unchecked") - public T getVehicleCheck(Class check) { + public T getVehicleCheck(Class check) { // return (T) vehicleCheck.get(check); return (T) loadedChecks.get(check); } public void onPrePredictionReceivePacket(final PacketReceiveEvent packet) { - for (PacketCheck check : prePredictionChecks) { + for (PacketCheckI check : prePredictionChecks) { check.onPacketReceive(packet); } } public void onPacketReceive(final PacketReceiveEvent packet) { - for (PacketCheck check : packetChecks) { + for (PacketCheckI check : packetChecks) { check.onPacketReceive(packet); } - for (PostPredictionCheck check : postPredictionChecks) { + for (PostPredictionCheckI check : postPredictionChecks) { check.onPacketReceive(packet); } for (BlockPlaceCheck check : blockPlaceChecks) { check.onPacketReceive(packet); } - for (BlockBreakCheck check : blockBreakChecks) { + for (BlockBreakCheckI check : blockBreakChecks) { check.onPacketReceive(packet); } } public void onPacketSend(final PacketSendEvent packet) { - for (PacketCheck check : prePredictionChecks) { + for (PacketCheckI check : prePredictionChecks) { check.onPacketSend(packet); } - for (PacketCheck check : packetChecks) { + for (PacketCheckI check : packetChecks) { check.onPacketSend(packet); } - for (PostPredictionCheck check : postPredictionChecks) { + for (PostPredictionCheckI check : postPredictionChecks) { check.onPacketSend(packet); } for (BlockPlaceCheck check : blockPlaceChecks) { check.onPacketSend(packet); } - for (BlockBreakCheck check : blockBreakChecks) { + for (BlockBreakCheckI check : blockBreakChecks) { check.onPacketSend(packet); } } public void onPositionUpdate(final PositionUpdate position) { - for (PositionCheck check : positionChecks) { + for (PositionCheckI check : positionChecks) { check.onPositionUpdate(position); } } public void onRotationUpdate(final RotationUpdate rotation) { - for (RotationCheck check : rotationChecks) { + for (RotationCheckI check : rotationChecks) { check.process(rotation); } for (BlockPlaceCheck check : blockPlaceChecks) { @@ -529,19 +528,19 @@ public void onRotationUpdate(final RotationUpdate rotation) { } public void onVehiclePositionUpdate(final VehiclePositionUpdate update) { - for (VehicleCheck check : vehicleChecks) { + for (VehicleCheckI check : vehicleChecks) { check.process(update); } } public void onPredictionFinish(final PredictionComplete complete) { - for (PostPredictionCheck check : postPredictionChecks) { + for (PostPredictionCheckI check : postPredictionChecks) { check.onPredictionComplete(complete); } for (BlockPlaceCheck check : blockPlaceChecks) { check.onPredictionComplete(complete); } - for (BlockBreakCheck check : blockBreakChecks) { + for (BlockBreakCheckI check : blockBreakChecks) { check.onPredictionComplete(complete); } } @@ -559,7 +558,7 @@ public void onPostFlyingBlockPlace(final BlockPlace place) { } public void onBlockBreak(final BlockBreak blockBreak) { - for (BlockBreakCheck check : blockBreakChecks) { + for (BlockBreakCheckI check : blockBreakChecks) { check.onBlockBreak(blockBreak); } } @@ -569,7 +568,7 @@ public ExplosionHandler getExplosionHandler() { } @SuppressWarnings("unchecked") - public T getPacketCheck(Class check) { + public T getPacketCheck(Class check) { return getCheck(check); } @@ -579,12 +578,12 @@ public T getBlockPlaceCheck(Class check) { } @SuppressWarnings("unchecked") - public T getPrePredictionCheck(Class check) { + public T getPrePredictionCheck(Class check) { return getCheck(check); } @SuppressWarnings("unchecked") - public T getPostPredictionCheck(Class check) { + public T getPostPredictionCheck(Class check) { return getCheck(check); } diff --git a/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java b/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java index 0f838c8940..a3f85b7386 100644 --- a/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java +++ b/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java @@ -1,7 +1,8 @@ package ac.grim.grimac.manager; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.data.LastInstance; @@ -9,7 +10,7 @@ import java.util.ArrayList; import java.util.List; -public class LastInstanceManager extends Check implements PostPredictionCheck { +public class LastInstanceManager extends AbstractPostPredictionCheck { private final List instances = new ArrayList<>(); public LastInstanceManager(GrimPlayer player) { diff --git a/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java b/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java index 534a5ebcec..a442d86bce 100644 --- a/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java +++ b/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java @@ -3,7 +3,8 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.impl.badpackets.BadPacketsN; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.events.packets.patch.ResyncWorldUtil; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.predictionengine.predictions.PredictionEngine; @@ -38,7 +39,7 @@ import java.util.Random; import java.util.concurrent.ConcurrentLinkedQueue; -public class SetbackTeleportUtil extends Check implements PostPredictionCheck { +public class SetbackTeleportUtil extends AbstractPostPredictionCheck { // Sync to netty public final ConcurrentLinkedQueue pendingTeleports = new ConcurrentLinkedQueue<>(); // Sync to netty, a player MUST accept a teleport to spawn into the world diff --git a/src/main/java/ac/grim/grimac/manager/init/start/SuperDebug.java b/src/main/java/ac/grim/grimac/manager/init/start/SuperDebug.java index 68727e7c4c..49600a714c 100644 --- a/src/main/java/ac/grim/grimac/manager/init/start/SuperDebug.java +++ b/src/main/java/ac/grim/grimac/manager/init/start/SuperDebug.java @@ -2,7 +2,8 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.predictionengine.UncertaintyHandler; import ac.grim.grimac.predictionengine.predictions.PredictionEngine; @@ -19,7 +20,7 @@ import java.util.*; -public final class SuperDebug extends Check implements PostPredictionCheck { +public final class SuperDebug extends AbstractPostPredictionCheck { private static final StringBuilder[] flags = new StringBuilder[256]; // 17 MB of logs in memory Object2IntMap continuedDebug = new Object2IntOpenHashMap<>(); diff --git a/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java b/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java index c6d37c9108..0ac148bfb1 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java +++ b/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java @@ -1,14 +1,16 @@ package ac.grim.grimac.predictionengine; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.protocol.player.ClientVersion; -public class GhostBlockDetector extends Check implements PostPredictionCheck { +public class GhostBlockDetector extends AbstractPostPredictionCheck { public GhostBlockDetector(GrimPlayer player) { super(player); diff --git a/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java b/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java index e38fffc470..f73e4df850 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java +++ b/src/main/java/ac/grim/grimac/predictionengine/MovementCheckRunner.java @@ -4,7 +4,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.impl.movement.EntityControl; import ac.grim.grimac.checks.impl.prediction.Phase; -import ac.grim.grimac.checks.type.PositionCheck; +import ac.grim.grimac.checks.type.interfaces.PositionCheckI; import ac.grim.grimac.manager.SetbackTeleportUtil; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.predictionengine.movementtick.MovementTickerHorse; @@ -40,7 +40,7 @@ import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes; import org.bukkit.util.Vector; -public class MovementCheckRunner extends Check implements PositionCheck { +public class MovementCheckRunner extends Check implements PositionCheckI { // Averaged over 500 predictions (Defaults set slightly above my 3600x results) public static double predictionNanos = 0.3 * 1e6; // Averaged over 20000 predictions diff --git a/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java b/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java index 32225e794e..a5a02f2768 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java +++ b/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java @@ -1,7 +1,8 @@ package ac.grim.grimac.predictionengine; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; @@ -30,7 +31,7 @@ *

* So, this is a value patch like 0.03 because it can be "close enough" that it's better just to not skip ticks **/ -public class SneakingEstimator extends Check implements PostPredictionCheck { +public class SneakingEstimator extends AbstractPostPredictionCheck { SimpleCollisionBox sneakingPotentialHiddenVelocity = new SimpleCollisionBox(); List possible = new ArrayList<>(); diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java index 3c1ee9dc3e..017df58d87 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java @@ -1,7 +1,7 @@ package ac.grim.grimac.utils.latency; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PositionCheck; +import ac.grim.grimac.checks.type.interfaces.PositionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PositionUpdate; import ac.grim.grimac.utils.data.CooldownData; @@ -16,7 +16,7 @@ // although the client will end the cooldown automatically. Can be applied to any item, // note that interactions still get sent to the server with the item but the client does not play the animation // nor attempt to predict results (i.e block placing). -public class CompensatedCooldown extends Check implements PositionCheck { +public class CompensatedCooldown extends Check implements PositionCheckI { private final ConcurrentHashMap itemCooldownMap = new ConcurrentHashMap<>(); public CompensatedCooldown(GrimPlayer playerData) { diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedFireworks.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedFireworks.java index 37b1b0ca65..965af5cf16 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedFireworks.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedFireworks.java @@ -1,14 +1,15 @@ package ac.grim.grimac.utils.latency; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PostPredictionCheck; +import ac.grim.grimac.checks.type.abstracts.AbstractPostPredictionCheck; +import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; import java.util.HashSet; import java.util.Set; -public class CompensatedFireworks extends Check implements PostPredictionCheck { +public class CompensatedFireworks extends AbstractPostPredictionCheck { // As this is sync to one player, this does not have to be concurrent private final Set activeFireworks = new HashSet<>(); diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java index 83390eb9c7..ad1bb75bcb 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java @@ -1,7 +1,7 @@ package ac.grim.grimac.utils.latency; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockPlace; import ac.grim.grimac.utils.inventory.EquipmentType; @@ -34,7 +34,7 @@ import java.util.Optional; // Updated to support modern 1.17 protocol -public class CompensatedInventory extends Check implements PacketCheck { +public class CompensatedInventory extends Check implements PacketCheckI { // "Temporarily" public for debugging public Inventory inventory; // "Temporarily" public for debugging diff --git a/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java b/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java index c5fb963080..f5e7b2dc91 100644 --- a/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java +++ b/src/main/java/ac/grim/grimac/utils/team/TeamHandler.java @@ -1,7 +1,7 @@ package ac.grim.grimac.utils.team; import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.PacketCheck; +import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.event.PacketSendEvent; @@ -13,7 +13,7 @@ import java.util.Optional; import java.util.UUID; -public class TeamHandler extends Check implements PacketCheck { +public class TeamHandler extends Check implements PacketCheckI { private final Map entityTeams = new Object2ObjectOpenHashMap<>(); private final Map entityToTeam = new Object2ObjectOpenHashMap<>();