From 4eada7550ae00eb62529c3ec897e8e6e20cfaa35 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:20:03 -0500 Subject: [PATCH 1/8] MVP for new CheckManager; faster iteration; structure to support reloading, adding/unloading checks --- build.gradle.kts | 5 +- .../java/ac/grim/grimac/GrimExternalAPI.java | 6 + .../java/ac/grim/grimac/checks/Check.java | 37 +- .../grimac/checks/type/BlockBreakCheck.java | 6 + .../grimac/checks/type/BlockPlaceCheck.java | 6 + .../grim/grimac/checks/type/PacketCheck.java | 5 + .../grimac/checks/type/PositionCheck.java | 5 + .../checks/type/PostPredictionCheck.java | 5 + .../grimac/checks/type/RotationCheck.java | 5 + .../grim/grimac/checks/type/VehicleCheck.java | 6 + .../ac/grim/grimac/manager/CheckManager.java | 666 ++++++++++++------ .../grimac/manager/PunishmentManager.java | 6 +- .../manager/config/ConfigManagerFileImpl.java | 31 + .../ac/grim/grimac/player/GrimPlayer.java | 9 +- 14 files changed, 586 insertions(+), 212 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index cdd1d94c87..67ae2eeac3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -67,8 +67,9 @@ dependencies { implementation("com.zaxxer:HikariCP:4.0.3") //implementation("com.github.grimanticheat:grimapi:1193c4fa41") - // Used for local testing: implementation("ac.grim.grimac:GRIMAPI:1.0") - implementation("com.github.grimanticheat:grimapi:fc5634e444") + // Used for local testing: + implementation("ac.grim.grimac:GrimAPI:1.0") +// implementation("com.github.grimanticheat:grimapi:fc5634e444") implementation("org.jetbrains:annotations:24.1.0") compileOnly("org.geysermc.floodgate:api:2.2.3-SNAPSHOT") diff --git a/src/main/java/ac/grim/grimac/GrimExternalAPI.java b/src/main/java/ac/grim/grimac/GrimExternalAPI.java index d97110b4ef..409c7c2b2b 100644 --- a/src/main/java/ac/grim/grimac/GrimExternalAPI.java +++ b/src/main/java/ac/grim/grimac/GrimExternalAPI.java @@ -114,6 +114,12 @@ public ConfigManager getConfigManager() { return configManager; } + @Override + public boolean hasStarted() { + // TODO implement this + throw new UnsupportedOperationException("Not implemented yet"); + } + private ConfigManager configManager = null; private final ConfigManagerFileImpl configManagerFile = new ConfigManagerFileImpl(); private boolean started = false; diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index 9821a9a7da..d8d8a380d9 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -3,6 +3,8 @@ import ac.grim.grimac.GrimAPI; import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.config.ConfigManager; +import ac.grim.grimac.api.dynamic.DefaultUnloadedBehavior; +import ac.grim.grimac.api.dynamic.UnloadedBehavior; import ac.grim.grimac.api.events.FlagEvent; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.common.ConfigReloadObserver; @@ -15,6 +17,8 @@ import lombok.Setter; import org.bukkit.Bukkit; +import java.lang.reflect.Method; + // Class from https://github.com/Tecnio/AntiCheatBase/blob/master/src/main/java/me/tecnio/anticheat/check/Check.java @Getter public class Check implements AbstractCheck, ConfigReloadObserver { @@ -40,6 +44,16 @@ public boolean isExperimental() { return experimental; } + @Override + public UnloadedBehavior getUnloadedBehavior() { + return DefaultUnloadedBehavior.INSTANCE; + } + + @Override + public int getCheckMask() { + throw new UnsupportedOperationException("Override this method to show which check types your check is!"); + } + public Check(final GrimPlayer player) { this.player = player; @@ -112,7 +126,6 @@ public final void reward() { violations = Math.max(0, violations - decay); } - @Override public void reload(ConfigManager configuration) { decay = configuration.getDoubleElse(configName + ".decay", decay); setbackVL = configuration.getDoubleElse(configName + ".setbackvl", setbackVL); @@ -185,6 +198,28 @@ public boolean isTickPacketIncludingNonMovement(PacketTypeCommon packetType) { return isFlying(packetType); } + public interface UnloadedCheckHandler { + // Return what the check's methods should return when unloaded + Object handleUnloadedCall(Method method, Object[] args); + } + + // Default behavior - do nothing and return false/0/null + public static final UnloadedCheckHandler DEFAULT_HANDLER = (method, args) -> { + // Return appropriate "no-op" value based on return type + Class returnType = method.getReturnType(); + if (returnType == boolean.class) return false; + if (returnType == int.class) return 0; + if (returnType == void.class) return null; + // etc... + return null; + }; + + private UnloadedCheckHandler unloadedHandler = DEFAULT_HANDLER; + + public void setUnloadedHandler(UnloadedCheckHandler handler) { + this.unloadedHandler = handler; + } + @Override public void reload() { reload(GrimAPI.INSTANCE.getConfigManager().getConfig()); diff --git a/src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java b/src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java index ce3326c2c9..3069774b8d 100644 --- a/src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/BlockBreakCheck.java @@ -1,7 +1,13 @@ package ac.grim.grimac.checks.type; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.BlockBreak; public interface BlockBreakCheck extends PostPredictionCheck { default void onBlockBreak(final BlockBreak blockBreak) {} + + @Override + default int getCheckMask() { + return CheckType.BLOCK_PLACE.getMask(); + } } 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 0247e5a14d..3162f1417b 100644 --- a/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java @@ -1,5 +1,6 @@ package ac.grim.grimac.checks.type; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.api.config.ConfigManager; import ac.grim.grimac.checks.Check; import ac.grim.grimac.player.GrimPlayer; @@ -97,4 +98,9 @@ protected SimpleCollisionBox getCombinedBox(final BlockPlace place) { return combined; } + + @Override + public int getCheckMask() { + return CheckType.BLOCK_PLACE.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/type/PacketCheck.java b/src/main/java/ac/grim/grimac/checks/type/PacketCheck.java index c9a09c4fe1..cd8011b7d9 100644 --- a/src/main/java/ac/grim/grimac/checks/type/PacketCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/PacketCheck.java @@ -1,10 +1,15 @@ package ac.grim.grimac.checks.type; 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 { default void onPacketReceive(final PacketReceiveEvent event) {} default void onPacketSend(final PacketSendEvent event) {} + @Override + default int getCheckMask() { + return CheckType.PACKET.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/type/PositionCheck.java b/src/main/java/ac/grim/grimac/checks/type/PositionCheck.java index 85adf8e1d8..f94e8acac7 100644 --- a/src/main/java/ac/grim/grimac/checks/type/PositionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/PositionCheck.java @@ -1,10 +1,15 @@ package ac.grim.grimac.checks.type; 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 { default void onPositionUpdate(final PositionUpdate positionUpdate) { } + @Override + default int getCheckMask() { + return CheckType.POSITION.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java b/src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java index ec66449226..0fe5077ed2 100644 --- a/src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/PostPredictionCheck.java @@ -1,9 +1,14 @@ package ac.grim.grimac.checks.type; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.utils.anticheat.update.PredictionComplete; public interface PostPredictionCheck extends PacketCheck { 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/RotationCheck.java index 5b1a0b847c..12fcc9d8ed 100644 --- a/src/main/java/ac/grim/grimac/checks/type/RotationCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/RotationCheck.java @@ -1,10 +1,15 @@ package ac.grim.grimac.checks.type; 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 { default void process(final RotationUpdate rotationUpdate) { } + @Override + default int getCheckMask() { + return CheckType.ROTATION.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java b/src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java index adfbb07de4..e5d706ee9c 100644 --- a/src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/VehicleCheck.java @@ -1,9 +1,15 @@ package ac.grim.grimac.checks.type; 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 { void process(final VehiclePositionUpdate vehicleUpdate); + + @Override + default int getCheckMask() { + return CheckType.VEHICLE.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 08dcef49f3..9adab3ba43 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -1,6 +1,9 @@ package ac.grim.grimac.manager; import ac.grim.grimac.api.AbstractCheck; +import ac.grim.grimac.api.CheckType; +import ac.grim.grimac.api.dynamic.DefaultUnloadedBehavior; +import ac.grim.grimac.api.dynamic.UnloadedBehavior; import ac.grim.grimac.checks.impl.aim.AimDuplicateLook; import ac.grim.grimac.checks.impl.aim.AimModulo360; import ac.grim.grimac.checks.impl.aim.processor.AimProcessor; @@ -37,6 +40,7 @@ import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.predictionengine.GhostBlockDetector; import ac.grim.grimac.predictionengine.SneakingEstimator; +import ac.grim.grimac.utils.anticheat.LogUtil; import ac.grim.grimac.utils.anticheat.update.*; import ac.grim.grimac.utils.latency.CompensatedCooldown; import ac.grim.grimac.utils.latency.CompensatedFireworks; @@ -44,287 +48,518 @@ import ac.grim.grimac.utils.team.TeamHandler; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; -import com.google.common.collect.ClassToInstanceMap; -import com.google.common.collect.ImmutableClassToInstanceMap; import org.bukkit.Bukkit; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; +import java.lang.reflect.Proxy; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + public class CheckManager { private static boolean inited; private static final AtomicBoolean initedAtomic = new AtomicBoolean(false); - ClassToInstanceMap packetChecks; - ClassToInstanceMap positionCheck; - ClassToInstanceMap rotationCheck; - ClassToInstanceMap vehicleCheck; - ClassToInstanceMap prePredictionChecks; - ClassToInstanceMap blockBreakChecks; - ClassToInstanceMap blockPlaceCheck; - ClassToInstanceMap postPredictionCheck; + 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 BlockPlaceCheck[] blockPlaceChecks; + private PostPredictionCheck[] postPredictionChecks; - public ClassToInstanceMap allChecks; + // Lookup map for getting specific checks + public Map, AbstractCheck> loadedChecks = new HashMap<>(); + public Map, AbstractCheck> unloadedProxies = new HashMap<>(); public CheckManager(GrimPlayer player) { - // Include post checks in the packet check too - packetChecks = new ImmutableClassToInstanceMap.Builder() - .put(PacketOrderProcessor.class, player.packetOrderProcessor) - .put(Reach.class, new Reach(player)) - .put(HitboxMiss.class, new HitboxMiss(player)) - .put(HitboxBlock.class, new HitboxBlock(player)) - .put(HitboxEntity.class, new HitboxEntity(player)) - .put(PacketEntityReplication.class, new PacketEntityReplication(player)) - .put(PacketChangeGameState.class, new PacketChangeGameState(player)) - .put(CompensatedInventory.class, new CompensatedInventory(player)) - .put(PacketPlayerAbilities.class, new PacketPlayerAbilities(player)) - .put(PacketWorldBorder.class, new PacketWorldBorder(player)) - .put(ActionManager.class, player.actionManager) - .put(TeamHandler.class, new TeamHandler(player)) - .put(ClientBrand.class, new ClientBrand(player)) - .put(NoFallA.class, new NoFallA(player)) - .put(BadPacketsO.class, new BadPacketsO(player)) - .put(BadPacketsA.class, new BadPacketsA(player)) - .put(BadPacketsB.class, new BadPacketsB(player)) - .put(BadPacketsC.class, new BadPacketsC(player)) - .put(BadPacketsD.class, new BadPacketsD(player)) - .put(BadPacketsE.class, new BadPacketsE(player)) - .put(BadPacketsF.class, new BadPacketsF(player)) - .put(BadPacketsG.class, new BadPacketsG(player)) - .put(BadPacketsI.class, new BadPacketsI(player)) - .put(BadPacketsJ.class, new BadPacketsJ(player)) - .put(BadPacketsK.class, new BadPacketsK(player)) - .put(BadPacketsL.class, new BadPacketsL(player)) - .put(BadPacketsN.class, new BadPacketsN(player)) - .put(BadPacketsP.class, new BadPacketsP(player)) - .put(BadPacketsQ.class, new BadPacketsQ(player)) - .put(BadPacketsR.class, new BadPacketsR(player)) - .put(BadPacketsS.class, new BadPacketsS(player)) - .put(BadPacketsT.class, new BadPacketsT(player)) - .put(BadPacketsU.class, new BadPacketsU(player)) - .put(BadPacketsW.class, new BadPacketsW(player)) - .put(BadPacketsY.class, new BadPacketsY(player)) - .put(InventoryA.class, new InventoryA(player)) - .put(InventoryB.class, new InventoryB(player)) - .put(InventoryE.class, new InventoryE(player)) - .put(InventoryF.class, new InventoryF(player)) - .put(InventoryG.class, new InventoryG(player)) - .put(MultiActionsA.class, new MultiActionsA(player)) - .put(MultiActionsB.class, new MultiActionsB(player)) - .put(MultiActionsC.class, new MultiActionsC(player)) - .put(MultiActionsD.class, new MultiActionsD(player)) - .put(MultiActionsE.class, new MultiActionsE(player)) - .put(PacketOrderB.class, new PacketOrderB(player)) - .put(PacketOrderC.class, new PacketOrderC(player)) - .put(PacketOrderD.class, new PacketOrderD(player)) - .put(PacketOrderO.class, new PacketOrderO(player)) - .put(NoSlowB.class, new NoSlowB(player)) - .put(SetbackBlocker.class, new SetbackBlocker(player)) // Must be last class otherwise we can't check while blocking packets - .build(); - positionCheck = new ImmutableClassToInstanceMap.Builder() - .put(PredictionRunner.class, new PredictionRunner(player)) - .put(CompensatedCooldown.class, new CompensatedCooldown(player)) - .build(); - rotationCheck = new ImmutableClassToInstanceMap.Builder() - .put(AimProcessor.class, new AimProcessor(player)) - .put(AimModulo360.class, new AimModulo360(player)) - .put(AimDuplicateLook.class, new AimDuplicateLook(player)) -// .put(Baritone.class, new Baritone(player)) - .build(); - vehicleCheck = new ImmutableClassToInstanceMap.Builder() - .put(VehiclePredictionRunner.class, new VehiclePredictionRunner(player)) - .build(); - - postPredictionCheck = new ImmutableClassToInstanceMap.Builder() - .put(NegativeTimerCheck.class, new NegativeTimerCheck(player)) - .put(ExplosionHandler.class, new ExplosionHandler(player)) - .put(KnockbackHandler.class, new KnockbackHandler(player)) - .put(GhostBlockDetector.class, new GhostBlockDetector(player)) - .put(InventoryD.class, new InventoryD(player)) - .put(Phase.class, new Phase(player)) - .put(Post.class, new Post(player)) - .put(PacketOrderA.class, new PacketOrderA(player)) - .put(PacketOrderE.class, new PacketOrderE(player)) - .put(PacketOrderF.class, new PacketOrderF(player)) - .put(PacketOrderG.class, new PacketOrderG(player)) - .put(PacketOrderH.class, new PacketOrderH(player)) - .put(PacketOrderI.class, new PacketOrderI(player)) - .put(PacketOrderJ.class, new PacketOrderJ(player)) - .put(PacketOrderK.class, new PacketOrderK(player)) - .put(PacketOrderL.class, new PacketOrderL(player)) - .put(PacketOrderM.class, new PacketOrderM(player)) - .put(NoFallB.class, new NoFallB(player)) - .put(OffsetHandler.class, new OffsetHandler(player)) - .put(SuperDebug.class, new SuperDebug(player)) - .put(DebugHandler.class, new DebugHandler(player)) - .put(EntityControl.class, new EntityControl(player)) - .put(NoSlowA.class, new NoSlowA(player)) - .put(NoSlowC.class, new NoSlowC(player)) - .put(NoSlowD.class, new NoSlowD(player)) - .put(NoSlowE.class, new NoSlowE(player)) - .put(MultiInteractA.class, new MultiInteractA(player)) - .put(MultiInteractB.class, new MultiInteractB(player)) - .put(SetbackTeleportUtil.class, new SetbackTeleportUtil(player)) // Avoid teleporting to new position, update safe pos last - .put(CompensatedFireworks.class, player.compensatedFireworks) - .put(SneakingEstimator.class, new SneakingEstimator(player)) - .put(LastInstanceManager.class, player.lastInstanceManager) - .build(); - - blockPlaceCheck = new ImmutableClassToInstanceMap.Builder() - .put(InventoryC.class, new InventoryC(player)) - .put(InvalidPlaceA.class, new InvalidPlaceA(player)) - .put(InvalidPlaceB.class, new InvalidPlaceB(player)) - .put(AirLiquidPlace.class, new AirLiquidPlace(player)) - .put(MultiPlace.class, new MultiPlace(player)) - .put(MultiActionsF.class, new MultiActionsF(player)) - .put(FarPlace.class, new FarPlace(player)) - .put(FabricatedPlace.class, new FabricatedPlace(player)) - .put(PositionPlace.class, new PositionPlace(player)) - .put(PacketOrderN.class, new PacketOrderN(player)) - .put(DuplicateRotPlace.class, new DuplicateRotPlace(player)) - .put(LineOfSightPlace.class, new LineOfSightPlace(player)) - .put(GhostBlockMitigation.class, new GhostBlockMitigation(player)) - .build(); - - prePredictionChecks = new ImmutableClassToInstanceMap.Builder() - .put(TimerCheck.class, new TimerCheck(player)) - .put(TickTimer.class, new TickTimer(player)) - .put(CrashA.class, new CrashA(player)) - .put(CrashB.class, new CrashB(player)) - .put(CrashC.class, new CrashC(player)) - .put(CrashD.class, new CrashD(player)) - .put(CrashE.class, new CrashE(player)) - .put(CrashF.class, new CrashF(player)) - .put(CrashG.class, new CrashG(player)) - .put(CrashH.class, new CrashH(player)) - .put(ExploitA.class, new ExploitA(player)) - .put(ExploitB.class, new ExploitB(player)) - .put(ExploitC.class, new ExploitC(player)) - .put(VehicleTimer.class, new VehicleTimer(player)) - .build(); - - blockBreakChecks = new ImmutableClassToInstanceMap.Builder() - .put(BadPacketsX.class, new BadPacketsX(player)) - .put(BadPacketsZ.class, new BadPacketsZ(player)) - .put(FastBreak.class, new FastBreak(player)) - .build(); - - allChecks = new ImmutableClassToInstanceMap.Builder() - .putAll(packetChecks) - .putAll(positionCheck) - .putAll(rotationCheck) - .putAll(vehicleCheck) - .putAll(postPredictionCheck) - .putAll(blockPlaceCheck) - .putAll(prePredictionChecks) - .putAll(blockBreakChecks) - .build(); + this.player = player; + // Packet Checks + Map, PacketCheck> packetCheckMap = new HashMap<>(); + addCheck(PacketOrderProcessor.class, player.packetOrderProcessor, packetCheckMap); + addCheck(Reach.class, new Reach(player), packetCheckMap); + addCheck(HitboxMiss.class, new HitboxMiss(player), packetCheckMap); + addCheck(HitboxBlock.class, new HitboxBlock(player), packetCheckMap); + addCheck(HitboxEntity.class, new HitboxEntity(player), packetCheckMap); + addCheck(PacketEntityReplication.class, new PacketEntityReplication(player), packetCheckMap); + addCheck(PacketChangeGameState.class, new PacketChangeGameState(player), packetCheckMap); + addCheck(CompensatedInventory.class, new CompensatedInventory(player), packetCheckMap); + addCheck(PacketPlayerAbilities.class, new PacketPlayerAbilities(player), packetCheckMap); + addCheck(PacketWorldBorder.class, new PacketWorldBorder(player), packetCheckMap); + addCheck(ActionManager.class, player.actionManager, packetCheckMap); + addCheck(TeamHandler.class, new TeamHandler(player), packetCheckMap); + addCheck(ClientBrand.class, new ClientBrand(player), packetCheckMap); + addCheck(NoFallA.class, new NoFallA(player), packetCheckMap); + addCheck(BadPacketsO.class, new BadPacketsO(player), packetCheckMap); + addCheck(BadPacketsA.class, new BadPacketsA(player), packetCheckMap); + addCheck(BadPacketsB.class, new BadPacketsB(player), packetCheckMap); + addCheck(BadPacketsC.class, new BadPacketsC(player), packetCheckMap); + addCheck(BadPacketsD.class, new BadPacketsD(player), packetCheckMap); + addCheck(BadPacketsE.class, new BadPacketsE(player), packetCheckMap); + addCheck(BadPacketsF.class, new BadPacketsF(player), packetCheckMap); + addCheck(BadPacketsG.class, new BadPacketsG(player), packetCheckMap); + addCheck(BadPacketsI.class, new BadPacketsI(player), packetCheckMap); + addCheck(BadPacketsJ.class, new BadPacketsJ(player), packetCheckMap); + addCheck(BadPacketsK.class, new BadPacketsK(player), packetCheckMap); + addCheck(BadPacketsL.class, new BadPacketsL(player), packetCheckMap); + addCheck(BadPacketsN.class, new BadPacketsN(player), packetCheckMap); + addCheck(BadPacketsP.class, new BadPacketsP(player), packetCheckMap); + addCheck(BadPacketsQ.class, new BadPacketsQ(player), packetCheckMap); + addCheck(BadPacketsR.class, new BadPacketsR(player), packetCheckMap); + addCheck(BadPacketsS.class, new BadPacketsS(player), packetCheckMap); + addCheck(BadPacketsT.class, new BadPacketsT(player), packetCheckMap); + addCheck(BadPacketsU.class, new BadPacketsU(player), packetCheckMap); + addCheck(BadPacketsW.class, new BadPacketsW(player), packetCheckMap); + addCheck(BadPacketsY.class, new BadPacketsY(player), packetCheckMap); + addCheck(InventoryA.class, new InventoryA(player), packetCheckMap); + addCheck(InventoryB.class, new InventoryB(player), packetCheckMap); + addCheck(InventoryE.class, new InventoryE(player), packetCheckMap); + addCheck(InventoryF.class, new InventoryF(player), packetCheckMap); + addCheck(InventoryG.class, new InventoryG(player), packetCheckMap); + addCheck(MultiActionsA.class, new MultiActionsA(player), packetCheckMap); + addCheck(MultiActionsB.class, new MultiActionsB(player), packetCheckMap); + addCheck(MultiActionsC.class, new MultiActionsC(player), packetCheckMap); + addCheck(MultiActionsD.class, new MultiActionsD(player), packetCheckMap); + addCheck(MultiActionsE.class, new MultiActionsE(player), packetCheckMap); + addCheck(PacketOrderB.class, new PacketOrderB(player), packetCheckMap); + addCheck(PacketOrderC.class, new PacketOrderC(player), packetCheckMap); + addCheck(PacketOrderD.class, new PacketOrderD(player), packetCheckMap); + 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]); + loadedChecks.putAll(packetCheckMap); + + // Position Checks + Map, PositionCheck> positionCheckMap = new HashMap<>(); + addCheck(PredictionRunner.class, new PredictionRunner(player), positionCheckMap); + addCheck(CompensatedCooldown.class, new CompensatedCooldown(player), positionCheckMap); + positionChecks = positionCheckMap.values().toArray(new PositionCheck[0]); + loadedChecks.putAll(positionCheckMap); + + // Rotation Checks + Map, RotationCheck> 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]); + loadedChecks.putAll(rotationCheckMap); + + // Vehicle Checks + Map, VehicleCheck> vehicleCheckMap = new HashMap<>(); + addCheck(VehiclePredictionRunner.class, new VehiclePredictionRunner(player), vehicleCheckMap); + vehicleChecks = vehicleCheckMap.values().toArray(new VehicleCheck[0]); + loadedChecks.putAll(vehicleCheckMap); + + // Pre Prediction Checks + Map, PacketCheck> prePredictionCheckMap = new HashMap<>(); + addCheck(TimerCheck.class, new TimerCheck(player), prePredictionCheckMap); + addCheck(TickTimer.class, new TickTimer(player), prePredictionCheckMap); + addCheck(CrashA.class, new CrashA(player), prePredictionCheckMap); + addCheck(CrashB.class, new CrashB(player), prePredictionCheckMap); + addCheck(CrashC.class, new CrashC(player), prePredictionCheckMap); + addCheck(CrashD.class, new CrashD(player), prePredictionCheckMap); + addCheck(CrashE.class, new CrashE(player), prePredictionCheckMap); + addCheck(CrashF.class, new CrashF(player), prePredictionCheckMap); + addCheck(CrashG.class, new CrashG(player), prePredictionCheckMap); + addCheck(CrashH.class, new CrashH(player), prePredictionCheckMap); + addCheck(ExploitA.class, new ExploitA(player), prePredictionCheckMap); + 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]); + loadedChecks.putAll(prePredictionCheckMap); + + // Block Break Checks + Map, BlockBreakCheck> 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]); + loadedChecks.putAll(blockBreakCheckMap); + + // Block Place Checks + Map, BlockPlaceCheck> blockPlaceCheckMap = new HashMap<>(); + addCheck(InventoryC.class, new InventoryC(player), blockPlaceCheckMap); + addCheck(InvalidPlaceA.class, new InvalidPlaceA(player), blockPlaceCheckMap); + addCheck(InvalidPlaceB.class, new InvalidPlaceB(player), blockPlaceCheckMap); + addCheck(AirLiquidPlace.class, new AirLiquidPlace(player), blockPlaceCheckMap); + addCheck(MultiPlace.class, new MultiPlace(player), blockPlaceCheckMap); + addCheck(MultiActionsF.class, new MultiActionsF(player), blockPlaceCheckMap); + addCheck(FarPlace.class, new FarPlace(player), blockPlaceCheckMap); + addCheck(FabricatedPlace.class, new FabricatedPlace(player), blockPlaceCheckMap); + addCheck(PositionPlace.class, new PositionPlace(player), blockPlaceCheckMap); + addCheck(PacketOrderN.class, new PacketOrderN(player), blockPlaceCheckMap); + addCheck(DuplicateRotPlace.class, new DuplicateRotPlace(player), blockPlaceCheckMap); + addCheck(LineOfSightPlace.class, new LineOfSightPlace(player), blockPlaceCheckMap); + addCheck(GhostBlockMitigation.class, new GhostBlockMitigation(player), blockPlaceCheckMap); + blockPlaceChecks = blockPlaceCheckMap.values().toArray(new BlockPlaceCheck[0]); + loadedChecks.putAll(blockPlaceCheckMap); + + // Post Prediction Checks + Map, PostPredictionCheck> postPredictionCheckMap = new HashMap<>(); + addCheck(NegativeTimerCheck.class, new NegativeTimerCheck(player), postPredictionCheckMap); + addCheck(ExplosionHandler.class, new ExplosionHandler(player), postPredictionCheckMap); + addCheck(KnockbackHandler.class, new KnockbackHandler(player), postPredictionCheckMap); + addCheck(GhostBlockDetector.class, new GhostBlockDetector(player), postPredictionCheckMap); + addCheck(InventoryD.class, new InventoryD(player), postPredictionCheckMap); + addCheck(Phase.class, new Phase(player), postPredictionCheckMap); + addCheck(Post.class, new Post(player), postPredictionCheckMap); + addCheck(PacketOrderA.class, new PacketOrderA(player), postPredictionCheckMap); + addCheck(PacketOrderE.class, new PacketOrderE(player), postPredictionCheckMap); + addCheck(PacketOrderF.class, new PacketOrderF(player), postPredictionCheckMap); + addCheck(PacketOrderG.class, new PacketOrderG(player), postPredictionCheckMap); + addCheck(PacketOrderH.class, new PacketOrderH(player), postPredictionCheckMap); + addCheck(PacketOrderI.class, new PacketOrderI(player), postPredictionCheckMap); + addCheck(PacketOrderJ.class, new PacketOrderJ(player), postPredictionCheckMap); + addCheck(PacketOrderK.class, new PacketOrderK(player), postPredictionCheckMap); + addCheck(PacketOrderL.class, new PacketOrderL(player), postPredictionCheckMap); + addCheck(PacketOrderM.class, new PacketOrderM(player), postPredictionCheckMap); + addCheck(NoFallB.class, new NoFallB(player), postPredictionCheckMap); + addCheck(OffsetHandler.class, new OffsetHandler(player), postPredictionCheckMap); + addCheck(SuperDebug.class, new SuperDebug(player), postPredictionCheckMap); + addCheck(DebugHandler.class, new DebugHandler(player), postPredictionCheckMap); + addCheck(EntityControl.class, new EntityControl(player), postPredictionCheckMap); + addCheck(NoSlowA.class, new NoSlowA(player), postPredictionCheckMap); + addCheck(NoSlowC.class, new NoSlowC(player), postPredictionCheckMap); + addCheck(NoSlowD.class, new NoSlowD(player), postPredictionCheckMap); + addCheck(NoSlowE.class, new NoSlowE(player), postPredictionCheckMap); + addCheck(MultiInteractA.class, new MultiInteractA(player), postPredictionCheckMap); + addCheck(MultiInteractB.class, new MultiInteractB(player), postPredictionCheckMap); + addCheck(SetbackTeleportUtil.class, new SetbackTeleportUtil(player), postPredictionCheckMap); + 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]); + loadedChecks.putAll(postPredictionCheckMap); init(); } + /** + * Adds a check to the appropriate map if the player is not exempt. + */ + private void addCheck( + Class checkClass, // The class type of the check + T checkInstance, // The instance of the check + Map, T> checkMap // The map to store the check + ) { + if (checkMap.get(checkClass) != null) { + LogUtil.warn("Attempted to add " + checkClass + " twice to the same checktype map for player + " + player.getName() + ", ignoring!"); +// } else if (checkInstance.getCheckName() == null || checkInstance.getCheckName() == "") { +// LogUtil.warn("Attempted to add a check with no or null name for player " + player.getName() + ", ignoring!"); + } else { + // existing behaviour has essentially been to always treat checks with null names and as core/non-unloadable and with no exempt permissions + // should we change how to handle this? + if (checkInstance.getCheckName() != null) { + // register permissions here to prevent NPE when checking if player is exempt + String permissionName = "grim.exempt." + checkInstance.getCheckName().toLowerCase(); + Permission permission = Bukkit.getPluginManager().getPermission(permissionName); + if (permission == null) { + Bukkit.getPluginManager().addPermission(new Permission(permissionName, PermissionDefault.FALSE)); + } else { + permission.setDefault(PermissionDefault.FALSE); + } + + // returns true if the check is exempt for the player + // Currently only checks for permission, in the future we will not add to map if: + // 1. Permission exempts player + // 2. Client version exempts player + if (!isExempt(checkClass)) { + checkMap.put(checkClass, checkInstance); + } + } else { + checkMap.put(checkClass, checkInstance); + } + } + } + + /** + * Performs a topological sort of checks based on their dependencies + */ + private List topologicalSort(Collection checks) { + Map, Set>> graph = new HashMap<>(); + Map, Integer> inDegree = new HashMap<>(); + + // Build dependency graph + for (AbstractCheck check : checks) { + Class checkClass = check.getClass(); + graph.putIfAbsent(checkClass, new HashSet<>()); + inDegree.putIfAbsent(checkClass, 0); + + // Add loadAfter dependencies + for (Class dep : check.getLoadAfter()) { + graph.computeIfAbsent(dep, k -> new HashSet<>()).add(checkClass); + inDegree.merge(checkClass, 1, Integer::sum); + } + + // Add loadBefore reverse dependencies + for (Class dep : check.getLoadBefore()) { + graph.computeIfAbsent(checkClass, k -> new HashSet<>()).add(dep); + inDegree.merge(dep, 1, Integer::sum); + } + + // Add direct dependencies + for (Class dep : check.getDependencies()) { + graph.computeIfAbsent(dep, k -> new HashSet<>()).add(checkClass); + inDegree.merge(checkClass, 1, Integer::sum); + } + } + + // Perform topological sort using Kahn's algorithm + Queue> queue = new LinkedList<>(); + Map, AbstractCheck> checkMap = checks.stream() + .collect(Collectors.toMap(AbstractCheck::getClass, c -> c)); + + inDegree.forEach((check, degree) -> { + if (degree == 0) queue.add(check); + }); + + List sorted = new ArrayList<>(); + while (!queue.isEmpty()) { + Class current = queue.poll(); + AbstractCheck check = checkMap.get(current); + if (check != null) { + sorted.add(check); + } + + for (Class dependent : graph.getOrDefault(current, Collections.emptySet())) { + inDegree.merge(dependent, -1, Integer::sum); + if (inDegree.get(dependent) == 0) { + queue.add(dependent); + } + } + } + + if (sorted.size() != checks.size()) { + throw new IllegalStateException("Circular dependency detected in checks"); + } + + return sorted; + } + + /** + * Rebuilds all check arrays maintaining dependency order + */ + 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 newBlockPlaceChecks = 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.BLOCK_PLACE)) newBlockPlaceChecks.add((BlockPlaceCheck) check); + if (check.isCheckType(CheckType.POST_PREDICTION)) newPostPredictionChecks.add((PostPredictionCheck) 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.blockPlaceChecks = newBlockPlaceChecks.toArray(new BlockPlaceCheck[0]); + this.postPredictionChecks = newPostPredictionChecks.toArray(new PostPredictionCheck[0]); + } + + /** + * Registers and loads a check, resolving dependencies + * @throws IllegalStateException if dependencies cannot be satisfied + */ + public void registerCheck(AbstractCheck check) { + Class checkClass = check.getClass(); + + // Verify dependencies are loaded + for (Class dep : check.getDependencies()) { + if (!isCheckLoaded(dep)) { + throw new IllegalStateException("Missing required dependency: " + dep.getSimpleName()); + } + } + + // Load the check + if (!check.onLoad()) { + throw new IllegalStateException("Failed to load " + checkClass.getSimpleName()); + } + + loadedChecks.put(checkClass, check); + rebuildCheckArrays(); + } + + private boolean isCheckLoaded(Class dep) { + return loadedChecks.containsKey(dep); + } + + /** + * Unloads a check and its dependents + */ + public void unregisterCheck(Class checkClass) { + AbstractCheck check = loadedChecks.remove(checkClass); + if (check != null) { + // Unload dependents first + for (AbstractCheck other : loadedChecks.values()) { + if (other.getDependencies().contains(checkClass)) { + unregisterCheck(other.getClass()); + } + } + check.onUnload(); + rebuildCheckArrays(); + } + } + + /** + * Reloads a check and its dependents + */ + public void reloadCheck(Class checkClass) { + AbstractCheck check = loadedChecks.get(checkClass); + if (check != null) { + unregisterCheck(checkClass); + registerCheck(check); + } + } + + /** + * Check if a player is exempt from a specific check type. + */ + private boolean isExempt(Class checkClass) { + // Example logic for exemptions + String permission = "grim.exempt." + checkClass.getSimpleName().toLowerCase(); + return +// this.player.bukkitPlayer.hasPermission(permission) || + !checkClassAppliesToPlayerVersion(checkClass); + } + + private boolean checkClassAppliesToPlayerVersion(Class checkClass) { + // Example: Logic to determine if a check is compatible with the player's version + return true; // Replace with actual version check logic + } + @SuppressWarnings("unchecked") public T getPositionCheck(Class check) { - return (T) positionCheck.get(check); +// return (T) positionCheck.get(check); + return (T) loadedChecks.get(check); } @SuppressWarnings("unchecked") public T getRotationCheck(Class check) { - return (T) rotationCheck.get(check); +// return (T) rotationCheck.get(check); + return (T) loadedChecks.get(check); } @SuppressWarnings("unchecked") public T getVehicleCheck(Class check) { - return (T) vehicleCheck.get(check); +// return (T) vehicleCheck.get(check); + return (T) loadedChecks.get(check); } public void onPrePredictionReceivePacket(final PacketReceiveEvent packet) { - for (PacketCheck check : prePredictionChecks.values()) { + for (PacketCheck check : prePredictionChecks) { check.onPacketReceive(packet); } } public void onPacketReceive(final PacketReceiveEvent packet) { - for (PacketCheck check : packetChecks.values()) { + for (PacketCheck check : packetChecks) { check.onPacketReceive(packet); } - for (PostPredictionCheck check : postPredictionCheck.values()) { + for (PostPredictionCheck check : postPredictionChecks) { check.onPacketReceive(packet); } - for (BlockPlaceCheck check : blockPlaceCheck.values()) { + for (BlockPlaceCheck check : blockPlaceChecks) { check.onPacketReceive(packet); } - for (BlockBreakCheck check : blockBreakChecks.values()) { + for (BlockBreakCheck check : blockBreakChecks) { check.onPacketReceive(packet); } } public void onPacketSend(final PacketSendEvent packet) { - for (PacketCheck check : prePredictionChecks.values()) { + for (PacketCheck check : prePredictionChecks) { check.onPacketSend(packet); } - for (PacketCheck check : packetChecks.values()) { + for (PacketCheck check : packetChecks) { check.onPacketSend(packet); } - for (PostPredictionCheck check : postPredictionCheck.values()) { + for (PostPredictionCheck check : postPredictionChecks) { check.onPacketSend(packet); } - for (BlockPlaceCheck check : blockPlaceCheck.values()) { + for (BlockPlaceCheck check : blockPlaceChecks) { check.onPacketSend(packet); } - for (BlockBreakCheck check : blockBreakChecks.values()) { + for (BlockBreakCheck check : blockBreakChecks) { check.onPacketSend(packet); } } public void onPositionUpdate(final PositionUpdate position) { - for (PositionCheck check : positionCheck.values()) { + for (PositionCheck check : positionChecks) { check.onPositionUpdate(position); } } public void onRotationUpdate(final RotationUpdate rotation) { - for (RotationCheck check : rotationCheck.values()) { + for (RotationCheck check : rotationChecks) { check.process(rotation); } - for (BlockPlaceCheck check : blockPlaceCheck.values()) { + for (BlockPlaceCheck check : blockPlaceChecks) { check.process(rotation); } } public void onVehiclePositionUpdate(final VehiclePositionUpdate update) { - for (VehicleCheck check : vehicleCheck.values()) { + for (VehicleCheck check : vehicleChecks) { check.process(update); } } public void onPredictionFinish(final PredictionComplete complete) { - for (PostPredictionCheck check : postPredictionCheck.values()) { + for (PostPredictionCheck check : postPredictionChecks) { check.onPredictionComplete(complete); } - for (BlockPlaceCheck check : blockPlaceCheck.values()) { + for (BlockPlaceCheck check : blockPlaceChecks) { check.onPredictionComplete(complete); } - for (BlockBreakCheck check : blockBreakChecks.values()) { + for (BlockBreakCheck check : blockBreakChecks) { check.onPredictionComplete(complete); } } public void onBlockPlace(final BlockPlace place) { - for (BlockPlaceCheck check : blockPlaceCheck.values()) { + for (BlockPlaceCheck check : blockPlaceChecks) { check.onBlockPlace(place); } } public void onPostFlyingBlockPlace(final BlockPlace place) { - for (BlockPlaceCheck check : blockPlaceCheck.values()) { + for (BlockPlaceCheck check : blockPlaceChecks) { check.onPostFlyingBlockPlace(place); } } public void onBlockBreak(final BlockBreak blockBreak) { - for (BlockBreakCheck check : blockBreakChecks.values()) { + for (BlockBreakCheck check : blockBreakChecks) { check.onBlockBreak(blockBreak); } } @@ -335,17 +570,22 @@ public ExplosionHandler getExplosionHandler() { @SuppressWarnings("unchecked") public T getPacketCheck(Class check) { - return (T) packetChecks.get(check); + return getCheck(check); } @SuppressWarnings("unchecked") public T getBlockPlaceCheck(Class check) { - return (T) blockPlaceCheck.get(check); + return getCheck(check); } @SuppressWarnings("unchecked") public T getPrePredictionCheck(Class check) { - return (T) prePredictionChecks.get(check); + return getCheck(check); + } + + @SuppressWarnings("unchecked") + public T getPostPredictionCheck(Class check) { + return getCheck(check); } private PacketEntityReplication packetEntityReplication = null; @@ -390,9 +630,40 @@ public OffsetHandler getOffsetHandler() { return getPostPredictionCheck(OffsetHandler.class); } + /** + * Gets a check instance, creating an unloaded proxy if the check isn't loaded. + * This ensures calls to unloaded checks fail gracefully rather than throwing exceptions. + * + * @param checkClass The class of check to retrieve + * @return The check instance or an unloaded proxy + */ + // Type-safe check access with unloaded handling @SuppressWarnings("unchecked") - public T getPostPredictionCheck(Class check) { - return (T) postPredictionCheck.get(check); + public T getCheck(Class checkClass) { + T check = (T) loadedChecks.get(checkClass); + if (check == null) { + return (T) unloadedProxies.computeIfAbsent(checkClass, + this::createUnloadedProxy); + } + return check; + } + + /** + * Creates a proxy that handles calls to an unloaded check. + * The proxy uses the check's provider to determine unloaded behavior. + * + * @param checkClass The check class to create a proxy for + * @return A proxy implementing the check's interface + */ + private T createUnloadedProxy(Class checkClass) { + // Get the unloaded behavior from a cached instance or use default + UnloadedBehavior behavior = DefaultUnloadedBehavior.INSTANCE; + + return (T) Proxy.newProxyInstance( + checkClass.getClassLoader(), + new Class[] { checkClass }, + (proxy, method, args) -> behavior.handleUnloadedCall(method, args) + ); } private void init() { @@ -401,18 +672,5 @@ private void init() { // Slow thread safe check if (!initedAtomic.compareAndSet(false, true)) return; inited = true; - - for (AbstractCheck check : allChecks.values()) { - if (check.getCheckName() != null) { - String permissionName = "grim.exempt." + check.getCheckName().toLowerCase(); - Permission permission = Bukkit.getPluginManager().getPermission(permissionName); - - if (permission == null) { - Bukkit.getPluginManager().addPermission(new Permission(permissionName, PermissionDefault.FALSE)); - } else { - permission.setDefault(PermissionDefault.FALSE); - } - } - } } } diff --git a/src/main/java/ac/grim/grimac/manager/PunishmentManager.java b/src/main/java/ac/grim/grimac/manager/PunishmentManager.java index 0b2a63817b..978d9f3480 100644 --- a/src/main/java/ac/grim/grimac/manager/PunishmentManager.java +++ b/src/main/java/ac/grim/grimac/manager/PunishmentManager.java @@ -43,7 +43,8 @@ public void reload(ConfigManager config) { groups.clear(); // To support reloading - for (AbstractCheck check : player.checkManager.allChecks.values()) { + // TODO unloaded checks? + for (AbstractCheck check : player.checkManager.loadedChecks.values()) { check.setEnabled(false); } @@ -64,7 +65,8 @@ public void reload(ConfigManager config) { exclude = true; command = command.substring(1); } - for (AbstractCheck check : player.checkManager.allChecks.values()) { // o(n) * o(n)? + // TODO unloaded checks? + for (AbstractCheck check : player.checkManager.loadedChecks.values()) { // o(n) * o(n)? if (check.getCheckName() != null && (check.getCheckName().toLowerCase(Locale.ROOT).contains(command) || check.getAlternativeName().toLowerCase(Locale.ROOT).contains(command))) { // Some checks have equivalent names like AntiKB and AntiKnockback diff --git a/src/main/java/ac/grim/grimac/manager/config/ConfigManagerFileImpl.java b/src/main/java/ac/grim/grimac/manager/config/ConfigManagerFileImpl.java index 2a7837a1ae..0f0e467650 100644 --- a/src/main/java/ac/grim/grimac/manager/config/ConfigManagerFileImpl.java +++ b/src/main/java/ac/grim/grimac/manager/config/ConfigManagerFileImpl.java @@ -7,11 +7,13 @@ import ac.grim.grimac.utils.anticheat.LogUtil; import github.scarsz.configuralize.DynamicConfig; import github.scarsz.configuralize.Language; +import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.util.List; +import java.util.Map; public class ConfigManagerFileImpl implements ConfigManager, BasicReloadable { @@ -318,6 +320,11 @@ public String getStringElse(String key, String otherwise) { return config.getStringElse(key, otherwise); } + @Override + public @Nullable String getString(String s) { + return ""; + } + @Override public List getStringList(String key) { return config.getStringList(key); @@ -353,4 +360,28 @@ public T get(String key) { return config.get(key); } + @Override + public @Nullable T getElse(String s, T t) { + // TODO implement this + throw new UnsupportedOperationException("Not implemented yet"); + } + + @Override + public @Nullable Map getMap(String s) { + // TODO implement this + throw new UnsupportedOperationException("Not implemented yet"); + } + + @Override + public @Nullable Map getMapElse(String s, Map map) { + // TODO implement this + throw new UnsupportedOperationException("Not implemented yet"); + } + + @Override + public boolean hasLoaded() { + // TODO implement this + throw new UnsupportedOperationException("Not implemented yet"); + } + } diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index 66ea19a9ea..b2f4e904e2 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -537,7 +537,8 @@ public void updatePermissions() { this.noModifyPacketPermission = bukkitPlayer.hasPermission("grim.nomodifypacket"); this.noSetbackPermission = bukkitPlayer.hasPermission("grim.nosetback"); FoliaScheduler.getAsyncScheduler().runNow(GrimAPI.INSTANCE.getPlugin(), t -> { - for (AbstractCheck check : checkManager.allChecks.values()) { + // todo, do we care about updating perms on unloaded checks? + for (AbstractCheck check : checkManager.loadedChecks.values()) { if (check instanceof Check) { ((Check) check).updateExempted(); } @@ -764,9 +765,10 @@ public boolean isVanillaMath() { return trigHandler.isVanillaMath(); } + // TODO rename to getLoadedChecks() ? @Override public Collection getChecks() { - return checkManager.allChecks.values(); + return checkManager.loadedChecks.values(); } public void runNettyTaskInMs(Runnable runnable, int ms) { @@ -789,7 +791,8 @@ public void reload(ConfigManager config) { cancelDuplicatePacket = config.getBooleanElse("cancel-duplicate-packet", true); exemptElytra = config.getBooleanElse("exempt-elytra", false); // reload all checks - for (AbstractCheck value : checkManager.allChecks.values()) value.reload(config); + // TODO, reload unloaded checks? + for (AbstractCheck check : checkManager.loadedChecks.values()) check.reload(); // reload punishment manager punishmentManager.reload(config); } 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 2/8] 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<>(); From 2747d300600f9faa1e5114ce9ac4fa241adf4e39 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Thu, 19 Dec 2024 01:14:55 -0500 Subject: [PATCH 3/8] Refactor BlockBreak and BlockPlace checks to use new mask system/type system --- .../checks/impl/badpackets/BadPacketsX.java | 3 ++- .../checks/impl/badpackets/BadPacketsZ.java | 3 ++- .../grim/grimac/checks/impl/misc/FastBreak.java | 3 ++- .../type/abstracts/AbstractBlockBreakCheck.java | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java 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 a9913fe1cb..b1328f27fb 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,6 +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.abstracts.AbstractBlockBreakCheck; import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockBreak; @@ -19,7 +20,7 @@ import java.util.stream.Stream; @CheckData(name = "BadPacketsX") -public class BadPacketsX extends Check implements BlockBreakCheckI { +public class BadPacketsX extends AbstractBlockBreakCheck { public BadPacketsX(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 801b79102a..9fdba82b08 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractBlockBreakCheck; import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.MessageUtil; @@ -15,7 +16,7 @@ import static ac.grim.grimac.utils.nmsutil.BlockBreakSpeed.getBlockDamage; @CheckData(name = "BadPacketsZ") -public class BadPacketsZ extends Check implements BlockBreakCheckI { +public class BadPacketsZ extends AbstractBlockBreakCheck { public BadPacketsZ(final GrimPlayer player) { super(player); } 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 84f300e04a..bd62862e07 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractBlockBreakCheck; import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockBreak; @@ -20,7 +21,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 BlockBreakCheckI { +public class FastBreak extends AbstractBlockBreakCheck { public FastBreak(GrimPlayer playerData) { super(playerData); } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java new file mode 100644 index 0000000000..10ec4fdf1e --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.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.BlockBreakCheckI; +import ac.grim.grimac.player.GrimPlayer; + +public class AbstractBlockBreakCheck extends Check implements BlockBreakCheckI { + public AbstractBlockBreakCheck(GrimPlayer player) { + super(player); + } + + @Override + public int getCheckMask() { + return CheckType.BLOCK_BREAK.getMask(); + } +} From 46f0dcecbe0193631c1ab7a65d15c3c7861b662d Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Thu, 19 Dec 2024 01:22:18 -0500 Subject: [PATCH 4/8] Complete masking of all checks except packet checks --- .../checks/impl/aim/AimDuplicateLook.java | 3 ++- .../grimac/checks/impl/aim/AimModulo360.java | 3 ++- .../impl/aim/processor/AimProcessor.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashA.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashB.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashC.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashD.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashE.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashF.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashG.java | 3 ++- .../grim/grimac/checks/impl/crash/CrashH.java | 3 ++- .../grimac/checks/impl/exploit/ExploitA.java | 3 ++- .../grimac/checks/impl/exploit/ExploitB.java | 3 ++- .../grimac/checks/impl/exploit/ExploitC.java | 3 ++- .../checks/impl/movement/PredictionRunner.java | 3 ++- .../grimac/checks/impl/movement/TickTimer.java | 3 ++- .../checks/impl/movement/TimerCheck.java | 6 ++++++ .../impl/movement/VehiclePredictionRunner.java | 6 ++++++ .../type/abstracts/AbstractPositionCheck.java | 18 ++++++++++++++++++ .../abstracts/AbstractPrePredictionCheck.java | 17 +++++++++++++++++ .../type/abstracts/AbstractRotationCheck.java | 18 ++++++++++++++++++ .../ac/grim/grimac/manager/CheckManager.java | 1 + .../utils/latency/CompensatedCooldown.java | 3 ++- 23 files changed, 100 insertions(+), 17 deletions(-) create mode 100644 src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java create mode 100644 src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java create mode 100644 src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java 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 ddd8eb42f9..16ffd78255 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,13 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractRotationCheck; 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 RotationCheckI { +public class AimDuplicateLook extends AbstractRotationCheck { 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 f089f0c61a..02fb691fff 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractRotationCheck; import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; @@ -10,7 +11,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 RotationCheckI { +public class AimModulo360 extends AbstractRotationCheck { 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 747f983f4e..5a239fa7ea 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,6 +1,7 @@ package ac.grim.grimac.checks.impl.aim.processor; import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.abstracts.AbstractRotationCheck; import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; @@ -9,7 +10,7 @@ import ac.grim.grimac.utils.math.GrimMath; -public class AimProcessor extends Check implements RotationCheckI { +public class AimProcessor extends AbstractRotationCheck { 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/crash/CrashA.java b/src/main/java/ac/grim/grimac/checks/impl/crash/CrashA.java index 13b73735be..421c00d120 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,14 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; 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 PacketCheckI { +public class CrashA extends AbstractPrePredictionCheck { 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 2f0d623943..0a54b1895c 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -9,7 +10,7 @@ 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 PacketCheckI { +public class CrashB extends AbstractPrePredictionCheck { 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 1adab3e52c..bc05f0af95 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -9,7 +10,7 @@ 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 PacketCheckI { +public class CrashC extends AbstractPrePredictionCheck { 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 cf6b9f6302..c2fc93c383 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.inventory.inventory.MenuType; @@ -14,7 +15,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 PacketCheckI { +public class CrashD extends AbstractPrePredictionCheck { 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 41356197cd..d60269b4a4 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,6 +3,7 @@ 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.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -10,7 +11,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientSettings; @CheckData(name = "CrashE", experimental = false) -public class CrashE extends Check implements PacketCheckI { +public class CrashE extends AbstractPrePredictionCheck { 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 fa6113ebe1..3fc379d75d 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -9,7 +10,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientClickWindow; @CheckData(name = "CrashF") -public class CrashF extends Check implements PacketCheckI { +public class CrashF extends AbstractPrePredictionCheck { 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 548d117e3f..d3e5e94fc4 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; @@ -14,7 +15,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientUseItem; @CheckData(name = "CrashG", description = "Sent negative sequence id") -public class CrashG extends Check implements PacketCheckI { +public class CrashG extends AbstractPrePredictionCheck { 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 92238ecc5f..1018a7f753 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -9,7 +10,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete; @CheckData(name = "CrashH") -public class CrashH extends Check implements PacketCheckI { +public class CrashH extends AbstractPrePredictionCheck { 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 a1f6b23277..e8933e93d8 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +13,7 @@ import java.util.regex.Pattern; @CheckData(name = "ExploitA", experimental = true) -public class ExploitA extends Check implements PacketCheckI { +public class ExploitA extends AbstractPrePredictionCheck { 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 1a2ee7c646..0af834abbe 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; @@ -11,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientTabComplete; @CheckData(name = "ExploitB", experimental = true) -public class ExploitB extends Check implements PacketCheckI { +public class ExploitB extends AbstractPrePredictionCheck { 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 3ad9b1e92a..542ea3b205 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -9,7 +10,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEditBook; @CheckData(name = "ExploitC", description = "Too long book title") -public class ExploitC extends Check implements PacketCheckI { +public class ExploitC extends AbstractPrePredictionCheck { public ExploitC(GrimPlayer playerData) { super(playerData); } 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 cca05d468c..f2e498bc81 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,12 @@ package ac.grim.grimac.checks.impl.movement; import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.abstracts.AbstractPositionCheck; 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 PositionCheckI { +public class PredictionRunner extends AbstractPositionCheck { public PredictionRunner(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 338241e9fa..0858bb82a2 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,6 +2,7 @@ import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -9,7 +10,7 @@ @CheckData(name = "TickTimer", setback = 1) -public class TickTimer extends Check implements PostPredictionCheckI { +public class TickTimer extends AbstractPrePredictionCheck { 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 0ce378f9f7..15a179568c 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 @@ -1,5 +1,6 @@ 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.Check; import ac.grim.grimac.checks.CheckData; @@ -114,4 +115,9 @@ public void onReload(ConfigManager config) { clockDrift = (long) (config.getDoubleElse(getConfigName() + ".drift", 120.0) * 1e6); limitAbuseOverPing = (long) (config.getDoubleElse(getConfigName() + ".ping-abuse-limit-threshold", 1000) * 1e6); } + + @Override + public int getCheckMask() { + return CheckType.PRE_PREDICTION.getMask(); + } } 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 3151b3756b..4b0c9d4562 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,5 +1,6 @@ package ac.grim.grimac.checks.impl.movement; +import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.interfaces.VehicleCheckI; import ac.grim.grimac.player.GrimPlayer; @@ -17,4 +18,9 @@ public void process(final VehiclePositionUpdate vehicleUpdate) { // We don't do vehicle setbacks because vehicle netcode sucks. player.movementCheckRunner.processAndCheckMovementPacket(new PositionUpdate(vehicleUpdate.getFrom(), vehicleUpdate.getTo(), false, null, null, vehicleUpdate.isTeleport())); } + + @Override + public int getCheckMask() { + return CheckType.VEHICLE.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java new file mode 100644 index 0000000000..b751441eb6 --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java @@ -0,0 +1,18 @@ +package ac.grim.grimac.checks.type.abstracts; + +import ac.grim.grimac.api.AbstractCheck; +import ac.grim.grimac.api.CheckType; +import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.interfaces.PositionCheckI; +import ac.grim.grimac.player.GrimPlayer; + +public class AbstractPositionCheck extends Check implements PositionCheckI { + public AbstractPositionCheck(GrimPlayer player) { + super(player); + } + + @Override + public int getCheckMask() { + return CheckType.POSITION.getMask(); + } +} diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java new file mode 100644 index 0000000000..cdb110edc7 --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.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.PacketCheckI; +import ac.grim.grimac.player.GrimPlayer; + +public class AbstractPrePredictionCheck extends Check implements PacketCheckI { + public AbstractPrePredictionCheck(GrimPlayer player) { + super(player); + } + + @Override + public int getCheckMask() { + return CheckType.PRE_PREDICTION.getMask(); + } +} diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java new file mode 100644 index 0000000000..04f2d0b151 --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java @@ -0,0 +1,18 @@ +package ac.grim.grimac.checks.type.abstracts; + +import ac.grim.grimac.api.AbstractCheck; +import ac.grim.grimac.api.CheckType; +import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.interfaces.RotationCheckI; +import ac.grim.grimac.player.GrimPlayer; + +public class AbstractRotationCheck extends Check implements RotationCheckI { + public AbstractRotationCheck(GrimPlayer player) { + super(player); + } + + @Override + public int getCheckMask() { + return CheckType.ROTATION.getMask(); + } +} diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 74102ed5da..89570f5feb 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -79,6 +79,7 @@ public class CheckManager { public CheckManager(GrimPlayer player) { this.player = player; + // TODO "maskify" packet checks // Packet Checks Map, PacketCheckI> packetCheckMap = new HashMap<>(); addCheck(PacketOrderProcessor.class, player.packetOrderProcessor, packetCheckMap); 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 017df58d87..2c232197f1 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java @@ -1,6 +1,7 @@ package ac.grim.grimac.utils.latency; import ac.grim.grimac.checks.Check; +import ac.grim.grimac.checks.type.abstracts.AbstractPositionCheck; import ac.grim.grimac.checks.type.interfaces.PositionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PositionUpdate; @@ -16,7 +17,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 PositionCheckI { +public class CompensatedCooldown extends AbstractPositionCheck { private final ConcurrentHashMap itemCooldownMap = new ConcurrentHashMap<>(); public CompensatedCooldown(GrimPlayer playerData) { From 195f33c694cc5eeebec48b4d1c21552bbe51fbc8 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:28:33 -0500 Subject: [PATCH 5/8] Code cleanup --- build.gradle.kts | 2 +- .../java/ac/grim/grimac/checks/impl/aim/AimDuplicateLook.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/aim/AimModulo360.java | 2 -- .../ac/grim/grimac/checks/impl/aim/processor/AimProcessor.java | 2 -- .../ac/grim/grimac/checks/impl/badpackets/BadPacketsX.java | 2 -- .../ac/grim/grimac/checks/impl/badpackets/BadPacketsZ.java | 2 -- .../java/ac/grim/grimac/checks/impl/combat/MultiInteractA.java | 2 -- .../java/ac/grim/grimac/checks/impl/combat/MultiInteractB.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashA.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashB.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashC.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashD.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashE.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashF.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashG.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/crash/CrashH.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitA.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitB.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/exploit/ExploitC.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/misc/FastBreak.java | 2 -- .../ac/grim/grimac/checks/impl/movement/EntityControl.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowA.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowD.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowE.java | 2 -- .../ac/grim/grimac/checks/impl/movement/PredictionRunner.java | 2 -- .../java/ac/grim/grimac/checks/impl/movement/TickTimer.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderA.java | 3 --- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderE.java | 3 --- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderF.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderG.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderH.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderI.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderJ.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderK.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderL.java | 2 -- .../ac/grim/grimac/checks/impl/packetorder/PacketOrderM.java | 2 -- .../ac/grim/grimac/checks/impl/prediction/DebugHandler.java | 2 -- .../java/ac/grim/grimac/checks/impl/prediction/NoFallB.java | 2 -- .../ac/grim/grimac/checks/impl/prediction/OffsetHandler.java | 2 -- src/main/java/ac/grim/grimac/checks/impl/prediction/Phase.java | 3 --- .../ac/grim/grimac/checks/impl/velocity/ExplosionHandler.java | 3 --- .../ac/grim/grimac/checks/impl/velocity/KnockbackHandler.java | 3 --- .../grimac/checks/type/abstracts/AbstractPositionCheck.java | 1 - .../grimac/checks/type/abstracts/AbstractRotationCheck.java | 1 - .../grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java | 2 +- src/main/java/ac/grim/grimac/manager/LastInstanceManager.java | 2 -- src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java | 2 -- .../java/ac/grim/grimac/manager/init/start/SuperDebug.java | 2 -- .../ac/grim/grimac/predictionengine/GhostBlockDetector.java | 3 --- .../ac/grim/grimac/predictionengine/SneakingEstimator.java | 2 -- .../java/ac/grim/grimac/utils/latency/CompensatedCooldown.java | 2 -- .../ac/grim/grimac/utils/latency/CompensatedFireworks.java | 2 -- 52 files changed, 2 insertions(+), 106 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 62ff0c29e4..5cab1ef916 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -196,4 +196,4 @@ tasks.shadowJar { } kotlin { jvmToolchain(8) -} \ No newline at end of file +} 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 16ffd78255..f3eded0b69 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.aim; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractRotationCheck; -import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; 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 02fb691fff..cc88198f8d 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.aim; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractRotationCheck; -import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.RotationUpdate; 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 5a239fa7ea..2b9f372af7 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,8 +1,6 @@ package ac.grim.grimac.checks.impl.aim.processor; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.abstracts.AbstractRotationCheck; -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; 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 b1328f27fb..0e5e61dc34 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 @@ -1,10 +1,8 @@ package ac.grim.grimac.checks.impl.badpackets; import ac.grim.grimac.GrimAPI; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractBlockBreakCheck; -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; 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 9fdba82b08..54e5a08a4b 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractBlockBreakCheck; -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; 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 71b15f537b..e78c826913 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.combat; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 ed3940b902..06e5a467dc 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.combat; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 421c00d120..d003535408 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 0a54b1895c..95647d2230 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 bc05f0af95..7e5a7df713 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 c2fc93c383..a43bc424f8 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 d60269b4a4..c238029ae0 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 @@ -1,10 +1,8 @@ package ac.grim.grimac.checks.impl.crash; -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.abstracts.AbstractPrePredictionCheck; -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; 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 3fc379d75d..d3868c5763 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 d3e5e94fc4..34117ced89 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 1018a7f753..1ec0f852fe 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.crash; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 e8933e93d8..f17d0f7b7d 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.exploit; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 0af834abbe..e2b0769003 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.exploit; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 542ea3b205..74874e94b9 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.exploit; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 bd62862e07..2cbc8152e9 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.misc; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractBlockBreakCheck; -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; 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 be6135678a..07b9bf1614 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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") 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 cc52ab5995..61be8f457f 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 @@ -1,10 +1,8 @@ package ac.grim.grimac.checks.impl.movement; 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.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; 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 4b07d1a882..22cd97f811 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 e3c1de4944..4c144cb9fa 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 f2e498bc81..cb6eeb4a33 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,8 +1,6 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.abstracts.AbstractPositionCheck; -import ac.grim.grimac.checks.type.interfaces.PositionCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.PositionUpdate; 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 0858bb82a2..52bc98fc28 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; -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; 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 a4764a54e6..301a312cef 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,10 +1,7 @@ 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.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; 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 2e14b319d0..75e24d6b17 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,10 +1,7 @@ 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.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; 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 ddb36c954c..eeea6e7ac5 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 f7a86342ee..01b697c4ce 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 b002febe58..0d4ad03972 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 ed3c268837..f0e9bd3543 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 @@ -1,10 +1,8 @@ package ac.grim.grimac.checks.impl.packetorder; 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.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; 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 f9dc0d5f94..336800ffc3 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 ca1c0d1f09..6d257579f8 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 07b24f9bc8..aa63a44b76 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 75c627487d..f3fa1a7ce8 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 9d507169e4..5d0a915ab9 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.prediction; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 cdefde58df..3d10ec2e9c 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.checks.impl.prediction; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; 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; 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 2cb91e7e0f..97733cc103 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 @@ -2,10 +2,8 @@ import ac.grim.grimac.api.config.ConfigManager; 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.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; 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 3ea87a3de3..e4ddc1eee7 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,10 +1,7 @@ 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.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; 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 a6a8704ebe..75e914bece 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,11 +1,8 @@ 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.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; 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 06b87d3381..0c156bff54 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,12 +1,9 @@ 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.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; diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java index b751441eb6..6499747ebe 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java @@ -1,6 +1,5 @@ package ac.grim.grimac.checks.type.abstracts; -import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.interfaces.PositionCheckI; diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java index 04f2d0b151..705432968e 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java @@ -1,6 +1,5 @@ package ac.grim.grimac.checks.type.abstracts; -import ac.grim.grimac.api.AbstractCheck; import ac.grim.grimac.api.CheckType; import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.interfaces.RotationCheckI; 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 index b954539462..8f9c9e1b32 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java @@ -12,4 +12,4 @@ public interface BlockPlaceCheckI extends PostPredictionCheckI { default int getCheckMask() { return CheckType.BLOCK_PLACE.getMask(); } -} \ No newline at end of file +} diff --git a/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java b/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java index a3f85b7386..6d134cba88 100644 --- a/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java +++ b/src/main/java/ac/grim/grimac/manager/LastInstanceManager.java @@ -1,8 +1,6 @@ package ac.grim.grimac.manager; -import ac.grim.grimac.checks.Check; 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; diff --git a/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java b/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java index a442d86bce..2a43805092 100644 --- a/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java +++ b/src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java @@ -1,10 +1,8 @@ package ac.grim.grimac.manager; 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.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; 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 49600a714c..5895455ad1 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 @@ -1,9 +1,7 @@ package ac.grim.grimac.manager.init.start; import ac.grim.grimac.GrimAPI; -import ac.grim.grimac.checks.Check; 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; diff --git a/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java b/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java index 0ac148bfb1..5fd9796f51 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java +++ b/src/main/java/ac/grim/grimac/predictionengine/GhostBlockDetector.java @@ -1,9 +1,6 @@ package ac.grim.grimac.predictionengine; -import ac.grim.grimac.api.CheckType; -import ac.grim.grimac.checks.Check; 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; diff --git a/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java b/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java index a5a02f2768..14baf58350 100644 --- a/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java +++ b/src/main/java/ac/grim/grimac/predictionengine/SneakingEstimator.java @@ -1,8 +1,6 @@ package ac.grim.grimac.predictionengine; -import ac.grim.grimac.checks.Check; 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; 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 2c232197f1..e66222819d 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedCooldown.java @@ -1,8 +1,6 @@ package ac.grim.grimac.utils.latency; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.type.abstracts.AbstractPositionCheck; -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; 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 965af5cf16..b905d06e78 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedFireworks.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedFireworks.java @@ -1,8 +1,6 @@ package ac.grim.grimac.utils.latency; -import ac.grim.grimac.checks.Check; 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; From d42ca75a0044de76e4cbe2e5e978e57c58a6b0b7 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:06:46 -0500 Subject: [PATCH 6/8] Complete migration to new check mask system --- build.gradle.kts | 7 ++----- src/main/java/ac/grim/grimac/checks/Check.java | 2 +- .../checks/impl/badpackets/BadPacketsA.java | 5 ++--- .../checks/impl/badpackets/BadPacketsB.java | 5 ++--- .../checks/impl/badpackets/BadPacketsC.java | 5 ++--- .../checks/impl/badpackets/BadPacketsD.java | 5 ++--- .../checks/impl/badpackets/BadPacketsE.java | 5 ++--- .../checks/impl/badpackets/BadPacketsF.java | 5 ++--- .../checks/impl/badpackets/BadPacketsG.java | 5 ++--- .../checks/impl/badpackets/BadPacketsI.java | 5 ++--- .../checks/impl/badpackets/BadPacketsJ.java | 5 ++--- .../checks/impl/badpackets/BadPacketsK.java | 5 ++--- .../checks/impl/badpackets/BadPacketsL.java | 5 ++--- .../checks/impl/badpackets/BadPacketsN.java | 5 ++--- .../checks/impl/badpackets/BadPacketsO.java | 5 ++--- .../checks/impl/badpackets/BadPacketsP.java | 5 ++--- .../checks/impl/badpackets/BadPacketsQ.java | 5 ++--- .../checks/impl/badpackets/BadPacketsR.java | 5 ++--- .../checks/impl/badpackets/BadPacketsS.java | 5 ++--- .../checks/impl/badpackets/BadPacketsT.java | 5 ++--- .../checks/impl/badpackets/BadPacketsU.java | 5 ++--- .../checks/impl/badpackets/BadPacketsW.java | 5 ++--- .../checks/impl/badpackets/BadPacketsY.java | 5 ++--- .../grimac/checks/impl/combat/HitboxBlock.java | 5 ++--- .../grimac/checks/impl/combat/HitboxEntity.java | 5 ++--- .../grimac/checks/impl/combat/HitboxMiss.java | 5 ++--- .../grim/grimac/checks/impl/combat/Reach.java | 3 ++- .../grim/grimac/checks/impl/flight/FlightA.java | 5 ++--- .../grimac/checks/impl/groundspoof/NoFallA.java | 5 ++--- .../checks/impl/inventory/InventoryA.java | 6 ++++++ .../checks/impl/inventory/InventoryB.java | 6 ++++++ .../checks/impl/inventory/InventoryD.java | 2 +- .../checks/impl/inventory/InventoryE.java | 6 ++++++ .../checks/impl/inventory/InventoryF.java | 6 ++++++ .../checks/impl/inventory/InventoryG.java | 6 ++++++ .../grimac/checks/impl/misc/ClientBrand.java | 5 ++--- .../impl/movement/NegativeTimerCheck.java | 2 +- .../grimac/checks/impl/movement/NoSlowB.java | 5 ++--- .../grimac/checks/impl/movement/NoSlowC.java | 2 +- .../checks/impl/movement/SetbackBlocker.java | 5 ++--- .../grimac/checks/impl/movement/TimerCheck.java | 7 +++---- .../impl/movement/VehiclePredictionRunner.java | 2 +- .../checks/impl/multiactions/MultiActionsA.java | 5 ++--- .../checks/impl/multiactions/MultiActionsB.java | 5 ++--- .../checks/impl/multiactions/MultiActionsC.java | 5 ++--- .../checks/impl/multiactions/MultiActionsD.java | 5 ++--- .../checks/impl/multiactions/MultiActionsE.java | 5 ++--- .../checks/impl/packetorder/PacketOrderB.java | 5 ++--- .../checks/impl/packetorder/PacketOrderC.java | 5 ++--- .../checks/impl/packetorder/PacketOrderD.java | 5 ++--- .../checks/impl/packetorder/PacketOrderO.java | 5 ++--- .../checks/impl/packetorder/PacketOrderP.java | 5 ++--- .../impl/packetorder/PacketOrderProcessor.java | 5 ++--- .../ac/grim/grimac/checks/impl/post/Post.java | 2 +- .../grimac/checks/type/BlockPlaceCheck.java | 2 +- .../type/abstracts/AbstractBlockBreakCheck.java | 4 ++-- .../type/abstracts/AbstractPacketCheck.java | 17 +++++++++++++++++ .../type/abstracts/AbstractPositionCheck.java | 4 ++-- .../abstracts/AbstractPostPredictionCheck.java | 4 ++-- .../abstracts/AbstractPrePredictionCheck.java | 6 ++---- .../type/abstracts/AbstractRotationCheck.java | 4 ++-- .../type/interfaces/BlockBreakCheckI.java | 2 +- .../type/interfaces/BlockPlaceCheckI.java | 2 +- .../checks/type/interfaces/PacketCheckI.java | 2 +- .../checks/type/interfaces/PositionCheckI.java | 2 +- .../type/interfaces/PostPredictionCheckI.java | 2 +- .../checks/type/interfaces/RotationCheckI.java | 2 +- .../checks/type/interfaces/VehicleCheckI.java | 2 +- .../events/packets/PacketChangeGameState.java | 5 ++--- .../events/packets/PacketEntityReplication.java | 5 ++--- .../events/packets/PacketPlayerAbilities.java | 5 ++--- .../events/packets/PacketWorldBorder.java | 5 ++--- .../ac/grim/grimac/manager/ActionManager.java | 5 ++--- .../ac/grim/grimac/manager/CheckManager.java | 16 ++++++++-------- .../utils/latency/CompensatedInventory.java | 5 ++--- .../ac/grim/grimac/utils/team/TeamHandler.java | 5 ++--- 76 files changed, 180 insertions(+), 185 deletions(-) create mode 100644 src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPacketCheck.java diff --git a/build.gradle.kts b/build.gradle.kts index 5cab1ef916..67ae2eeac3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,6 @@ 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 { @@ -29,6 +28,8 @@ 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 @@ -76,7 +77,6 @@ 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,6 +194,3 @@ tasks.shadowJar { relocate("com.zaxxer", "ac.grim.rgimac.shaded.zaxxer") } } -kotlin { - jvmToolchain(8) -} diff --git a/src/main/java/ac/grim/grimac/checks/Check.java b/src/main/java/ac/grim/grimac/checks/Check.java index d8d8a380d9..a101232c96 100644 --- a/src/main/java/ac/grim/grimac/checks/Check.java +++ b/src/main/java/ac/grim/grimac/checks/Check.java @@ -50,7 +50,7 @@ public UnloadedBehavior getUnloadedBehavior() { } @Override - public int getCheckMask() { + public int getMask() { throw new UnsupportedOperationException("Override this method to show which check types your check is!"); } 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 54d1451c64..5fc1deb8bc 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsA extends AbstractPacketCheck { 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 10812213cd..00f08371f1 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsB extends AbstractPacketCheck { 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 cf4eac7e3a..4369ef8446 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsC extends AbstractPacketCheck { 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 709ae808bf..5a12216ccc 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsD extends AbstractPacketCheck { 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 9b073fdc55..be8e166ff8 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -10,7 +9,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "BadPacketsE") -public class BadPacketsE extends Check implements PacketCheckI { +public class BadPacketsE extends AbstractPacketCheck { 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 1ec9abbc59..df54c54e01 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsF extends AbstractPacketCheck { 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 f0d2d5ff05..24f5f92dfb 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsG extends AbstractPacketCheck { 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 e949fee166..3bca2b5b09 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsI extends AbstractPacketCheck { 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 2ed4ba2d80..2729ff0c66 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 @@ -1,14 +1,13 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsJ extends AbstractPacketCheck { 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 f63fb9093d..97435b6486 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsK extends AbstractPacketCheck { 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 774ec663ba..120784f602 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -14,7 +13,7 @@ import java.util.Locale; @CheckData(name = "BadPacketsL", description = "Sent impossible dig packet") -public class BadPacketsL extends Check implements PacketCheckI { +public class BadPacketsL extends AbstractPacketCheck { 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 ab29fe2683..06431e376b 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "BadPacketsN") -public class BadPacketsN extends Check implements PacketCheckI { +public class BadPacketsN extends AbstractPacketCheck { 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 25d2d960d9..6e9113b4d7 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.Pair; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -15,7 +14,7 @@ import java.util.Queue; @CheckData(name = "BadPacketsO") -public class BadPacketsO extends Check implements PacketCheckI { +public class BadPacketsO extends AbstractPacketCheck { 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 df9fc2b837..6862c32349 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; @@ -13,7 +12,7 @@ @CheckData(name = "BadPacketsP", experimental = true) -public class BadPacketsP extends Check implements PacketCheckI { +public class BadPacketsP extends AbstractPacketCheck { 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 78fa8bc387..87b1574c7a 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 +9,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction.Action; @CheckData(name = "BadPacketsQ") -public class BadPacketsQ extends Check implements PacketCheckI { +public class BadPacketsQ extends AbstractPacketCheck { 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 8bfe981f94..01429f8e54 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsR extends AbstractPacketCheck { 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 8ae9579092..f3df76e8c1 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "BadPacketsS") -public class BadPacketsS extends Check implements PacketCheckI { +public class BadPacketsS extends AbstractPacketCheck { 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 5f16b95fc2..9ba3555af9 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -13,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; @CheckData(name = "BadPacketsT") -public class BadPacketsT extends Check implements PacketCheckI { +public class BadPacketsT extends AbstractPacketCheck { 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 3bc5a508dc..9ae41aba97 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.item.ItemStack; @@ -15,7 +14,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 PacketCheckI { +public class BadPacketsU extends AbstractPacketCheck { 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 6e6e5acbf5..07735b2909 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "BadPacketsW", description = "Interacted with non-existent entity", experimental = true) -public class BadPacketsW extends Check implements PacketCheckI { +public class BadPacketsW extends AbstractPacketCheck { public BadPacketsW(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 0a24eb5b78..c8ffa99e29 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.badpackets; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class BadPacketsY extends AbstractPacketCheck { public BadPacketsY(GrimPlayer player) { super(player); } 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 d6232df869..9f74681531 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.combat; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "HitboxBlock", configName = "HitboxBlock", setback = 20) -public class HitboxBlock extends Check implements PacketCheckI { +public class HitboxBlock extends AbstractPacketCheck { 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 410761e4a0..b95264a2ec 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.combat; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "HitboxEntity", configName = "HitboxEntity", setback = 30) -public class HitboxEntity extends Check implements PacketCheckI { +public class HitboxEntity extends AbstractPacketCheck { 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 f67e9aefc5..f75bf572ab 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.combat; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "HitboxMiss", configName = "HitboxMiss", setback = 10) -public class HitboxMiss extends Check implements PacketCheckI { +public class HitboxMiss extends AbstractPacketCheck { public HitboxMiss(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 01d1819329..f15752d210 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,6 +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.abstracts.AbstractPacketCheck; import ac.grim.grimac.checks.type.interfaces.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; @@ -55,7 +56,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 PacketCheckI { +public class Reach extends AbstractPacketCheck { // 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<>(); 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 dd2deb452b..752aa3d0c3 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,12 @@ package ac.grim.grimac.checks.impl.flight; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class FlightA extends AbstractPacketCheck { 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 3bd3ed4ebc..35c90b3ea6 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.groundspoof; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.predictionengine.GhostBlockDetector; import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox; @@ -18,7 +17,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 PacketCheckI { +public class NoFallA extends AbstractPacketCheck { public boolean flipPlayerGroundStatus = false; diff --git a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryA.java b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryA.java index 2c75c6cfeb..e424e62fd6 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryA.java +++ b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryA.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; @@ -38,4 +39,9 @@ public void onPacketReceive(PacketReceiveEvent event) { } } } + + @Override + public int getMask() { + return CheckType.PACKET.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryB.java b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryB.java index 3e5f4d1f26..dbc1cd8ee4 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryB.java +++ b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryB.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; @@ -30,4 +31,9 @@ public void handle(PacketReceiveEvent event, WrapperPlayClientPlayerDigging wrap reward(); } } + + @Override + public int getMask() { + return CheckType.PACKET.getMask(); + } } 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 fedfe8d108..dc7bd0a78d 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 @@ -84,7 +84,7 @@ private MoveVectorData findMovement(VectorData vectorData) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.POST_PREDICTION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryE.java b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryE.java index 65fc614351..1842c239fc 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryE.java +++ b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryE.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; @@ -45,4 +46,9 @@ public void onPacketSend(PacketSendEvent event) { this.lastTransaction = player.lastTransactionSent.get(); } } + + @Override + public int getMask() { + return CheckType.PACKET.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryF.java b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryF.java index 042626f55d..1d866f1046 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryF.java +++ b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryF.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; @@ -41,4 +42,9 @@ public void onPacketReceive(PacketReceiveEvent event) { } } } + + @Override + public int getMask() { + return CheckType.PACKET.getMask(); + } } diff --git a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryG.java b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryG.java index 671def8627..0b40326b2e 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryG.java +++ b/src/main/java/ac/grim/grimac/checks/impl/inventory/InventoryG.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; @@ -37,4 +38,9 @@ public void onPacketReceive(PacketReceiveEvent event) { } } } + + @Override + public int getMask() { + return CheckType.PACKET.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 b4a93d4626..84203c630d 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 @@ -1,9 +1,8 @@ package ac.grim.grimac.checks.impl.misc; 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.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +11,7 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; -public class ClientBrand extends Check implements PacketCheckI { +public class ClientBrand extends AbstractPacketCheck { String brand = "vanilla"; boolean hasBrand = false; 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 6c4d3be851..40013575f8 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 @@ -42,7 +42,7 @@ public void onReload(ConfigManager config) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.POST_PREDICTION.getMask(); } } 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 2cacb20fc2..78fe4c965f 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 @@ -1,14 +1,13 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class NoSlowB extends AbstractPacketCheck { 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 2db42b93f2..1aa6403e72 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 @@ -53,7 +53,7 @@ public void onPredictionComplete(final PredictionComplete predictionComplete) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.POST_PREDICTION.getMask(); } } 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 f1d6ececb1..c2bdd6eb55 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,13 @@ package ac.grim.grimac.checks.impl.movement; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class SetbackBlocker extends AbstractPacketCheck { public SetbackBlocker(GrimPlayer playerData) { super(playerData); } 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 15a179568c..d4fef1da9c 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 @@ -2,16 +2,15 @@ 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.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; 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 PacketCheckI { +public class TimerCheck extends AbstractPrePredictionCheck { long timerBalanceRealTime = 0; // Default value is real time minus max keep-alive time @@ -117,7 +116,7 @@ public void onReload(ConfigManager config) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.PRE_PREDICTION.getMask(); } } 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 4b0c9d4562..b3f7161d10 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 @@ -20,7 +20,7 @@ public void process(final VehiclePositionUpdate vehicleUpdate) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.VEHICLE.getMask(); } } 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 75bdc03720..84888bd0ee 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.multiactions; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -10,7 +9,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 PacketCheckI { +public class MultiActionsA extends AbstractPacketCheck { 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 744974a0e4..6502f4984c 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.multiactions; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -14,7 +13,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 PacketCheckI { +public class MultiActionsB extends AbstractPacketCheck { 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 09cd14b8ea..4e44a1607d 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 @@ -1,15 +1,14 @@ package ac.grim.grimac.checks.impl.multiactions; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class MultiActionsC extends AbstractPacketCheck { 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 4ea1f2d147..3433d0cd1b 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 @@ -1,14 +1,13 @@ package ac.grim.grimac.checks.impl.multiactions; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class MultiActionsD extends AbstractPacketCheck { 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 0dc6fb2b6a..d180a66d04 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.multiactions; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -10,7 +9,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 PacketCheckI { +public class MultiActionsE extends AbstractPacketCheck { public MultiActionsE(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 5efac62dbb..9ce52950f8 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -12,7 +11,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; @CheckData(name = "PacketOrderB") -public class PacketOrderB extends Check implements PacketCheckI { +public class PacketOrderB extends AbstractPacketCheck { // 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 7a45e6d79d..b5fbf8c575 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.event.PacketReceiveEvent; @@ -14,7 +13,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "PacketOrderC", experimental = true) -public class PacketOrderC extends Check implements PacketCheckI { +public class PacketOrderC extends AbstractPacketCheck { 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 229176554f..a4e84c1534 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 @@ -1,12 +1,11 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; @CheckData(name = "PacketOrderD") -public class PacketOrderD extends Check implements PacketCheckI { +public class PacketOrderD extends AbstractPacketCheck { public PacketOrderD(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 35443b0674..a67c1da14c 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +11,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity.InteractAction; @CheckData(name = "PacketOrderO", experimental = true) -public class PacketOrderO extends Check implements PacketCheckI { +public class PacketOrderO extends AbstractPacketCheck { 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 b44cae43e0..33ede2c16e 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 @@ -1,8 +1,7 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; import ac.grim.grimac.checks.CheckData; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -13,7 +12,7 @@ import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; @CheckData(name = "PacketOrderP", experimental = true) -public class PacketOrderP extends Check implements PacketCheckI { +public class PacketOrderP extends AbstractPacketCheck { 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 03680df695..b3d988ec20 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,6 @@ package ac.grim.grimac.checks.impl.packetorder; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -12,7 +11,7 @@ import org.jetbrains.annotations.Contract; @Getter -public final class PacketOrderProcessor extends Check implements PacketCheckI { +public final class PacketOrderProcessor extends AbstractPacketCheck { 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 615c769dc7..3981664864 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 @@ -106,7 +106,7 @@ public void onPacketReceive(final PacketReceiveEvent event) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.POST_PREDICTION.getMask(); } } 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 d6567ffa99..0bc69d612a 100644 --- a/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/BlockPlaceCheck.java @@ -101,7 +101,7 @@ protected SimpleCollisionBox getCombinedBox(final BlockPlace place) { } @Override - public int getCheckMask() { + public int getMask() { return CheckType.BLOCK_PLACE.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java index 10ec4fdf1e..74a2488b8f 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractBlockBreakCheck.java @@ -5,13 +5,13 @@ import ac.grim.grimac.checks.type.interfaces.BlockBreakCheckI; import ac.grim.grimac.player.GrimPlayer; -public class AbstractBlockBreakCheck extends Check implements BlockBreakCheckI { +public abstract class AbstractBlockBreakCheck extends Check implements BlockBreakCheckI { public AbstractBlockBreakCheck(GrimPlayer player) { super(player); } @Override - public int getCheckMask() { + public int getMask() { return CheckType.BLOCK_BREAK.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPacketCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPacketCheck.java new file mode 100644 index 0000000000..77e8ef08e8 --- /dev/null +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPacketCheck.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.PacketCheckI; +import ac.grim.grimac.player.GrimPlayer; + +public abstract class AbstractPacketCheck extends Check implements PacketCheckI { + public AbstractPacketCheck(GrimPlayer player) { + super(player); + } + + @Override + public int getMask() { + return CheckType.PACKET.getMask(); + } +} diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java index 6499747ebe..430fae4c88 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPositionCheck.java @@ -5,13 +5,13 @@ import ac.grim.grimac.checks.type.interfaces.PositionCheckI; import ac.grim.grimac.player.GrimPlayer; -public class AbstractPositionCheck extends Check implements PositionCheckI { +public abstract class AbstractPositionCheck extends Check implements PositionCheckI { public AbstractPositionCheck(GrimPlayer player) { super(player); } @Override - public int getCheckMask() { + public int getMask() { return CheckType.POSITION.getMask(); } } 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 index 4b1e3a26cc..2b45ed5e47 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPostPredictionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPostPredictionCheck.java @@ -5,13 +5,13 @@ import ac.grim.grimac.checks.type.interfaces.PostPredictionCheckI; import ac.grim.grimac.player.GrimPlayer; -public class AbstractPostPredictionCheck extends Check implements PostPredictionCheckI { +public abstract class AbstractPostPredictionCheck extends Check implements PostPredictionCheckI { public AbstractPostPredictionCheck(GrimPlayer player) { super(player); } @Override - public int getCheckMask() { + public int getMask() { return CheckType.POST_PREDICTION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java index cdb110edc7..47bb326f1c 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java @@ -1,17 +1,15 @@ 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.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; -public class AbstractPrePredictionCheck extends Check implements PacketCheckI { +public abstract class AbstractPrePredictionCheck extends AbstractPacketCheck { public AbstractPrePredictionCheck(GrimPlayer player) { super(player); } @Override - public int getCheckMask() { + public int getMask() { return CheckType.PRE_PREDICTION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java index 705432968e..a0287f86c3 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractRotationCheck.java @@ -5,13 +5,13 @@ import ac.grim.grimac.checks.type.interfaces.RotationCheckI; import ac.grim.grimac.player.GrimPlayer; -public class AbstractRotationCheck extends Check implements RotationCheckI { +public abstract class AbstractRotationCheck extends Check implements RotationCheckI { public AbstractRotationCheck(GrimPlayer player) { super(player); } @Override - public int getCheckMask() { + public int getMask() { return CheckType.ROTATION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java index 526df5db6f..46c66352a9 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockBreakCheckI.java @@ -7,7 +7,7 @@ public interface BlockBreakCheckI extends PostPredictionCheckI { default void onBlockBreak(final BlockBreak blockBreak) {} @Override - default int getCheckMask() { + default int 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 index 8f9c9e1b32..ad22ec229c 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/BlockPlaceCheckI.java @@ -9,7 +9,7 @@ public interface BlockPlaceCheckI extends PostPredictionCheckI { void onPostFlyingBlockPlace(BlockPlace place); @Override - default int getCheckMask() { + default int getMask() { return CheckType.BLOCK_PLACE.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java index 86c396e9e0..2ab680ab13 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/PacketCheckI.java @@ -9,7 +9,7 @@ public interface PacketCheckI extends AbstractCheck { default void onPacketReceive(final PacketReceiveEvent event) {} default void onPacketSend(final PacketSendEvent event) {} @Override - default int getCheckMask() { + default int getMask() { return CheckType.PACKET.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java index c117a52c28..dce514b3a0 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/PositionCheckI.java @@ -9,7 +9,7 @@ public interface PositionCheckI extends AbstractCheck { default void onPositionUpdate(final PositionUpdate positionUpdate) { } @Override - default int getCheckMask() { + default int getMask() { return CheckType.POSITION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java index a15cfd1722..b67f34e435 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/PostPredictionCheckI.java @@ -9,7 +9,7 @@ default void onPredictionComplete(final PredictionComplete predictionComplete) { } @Override - default int getCheckMask() { + default int getMask() { return CheckType.POST_PREDICTION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java index 75949e2a6e..754b8f6857 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/RotationCheckI.java @@ -9,7 +9,7 @@ public interface RotationCheckI extends AbstractCheck { default void process(final RotationUpdate rotationUpdate) { } @Override - default int getCheckMask() { + default int getMask() { return CheckType.ROTATION.getMask(); } } diff --git a/src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java b/src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java index dc1228e499..96da103680 100644 --- a/src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java +++ b/src/main/java/ac/grim/grimac/checks/type/interfaces/VehicleCheckI.java @@ -9,7 +9,7 @@ public interface VehicleCheckI extends AbstractCheck { void process(final VehiclePositionUpdate vehicleUpdate); @Override - default int getCheckMask() { + default int getMask() { return CheckType.VEHICLE.getMask(); } } 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 ea2f1d688a..09d7c4c4a0 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketChangeGameState.java @@ -1,15 +1,14 @@ package ac.grim.grimac.events.packets; import ac.grim.grimac.GrimAPI; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class PacketChangeGameState extends AbstractPacketCheck { 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 b2af7b524f..e61ddafb6c 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java @@ -1,8 +1,7 @@ package ac.grim.grimac.events.packets; import ac.grim.grimac.api.config.ConfigManager; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.LogUtil; import ac.grim.grimac.utils.data.TrackerData; @@ -29,7 +28,7 @@ import java.util.List; import java.util.UUID; -public class PacketEntityReplication extends Check implements PacketCheckI { +public class PacketEntityReplication extends AbstractPacketCheck { 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 141ba8d4fc..dd09ad7a6a 100644 --- a/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java +++ b/src/main/java/ac/grim/grimac/events/packets/PacketPlayerAbilities.java @@ -1,8 +1,7 @@ package ac.grim.grimac.events.packets; import ac.grim.grimac.api.config.ConfigManager; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.event.PacketSendEvent; @@ -13,7 +12,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 PacketCheckI { +public class PacketPlayerAbilities extends AbstractPacketCheck { 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 225ad53475..0401016346 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,13 @@ package ac.grim.grimac.events.packets; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; 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 PacketCheckI { +public class PacketWorldBorder extends AbstractPacketCheck { 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 e2bb716ff8..049e31858b 100644 --- a/src/main/java/ac/grim/grimac/manager/ActionManager.java +++ b/src/main/java/ac/grim/grimac/manager/ActionManager.java @@ -1,7 +1,6 @@ package ac.grim.grimac.manager; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.packettype.PacketType; @@ -9,7 +8,7 @@ import lombok.Getter; @Getter -public class ActionManager extends Check implements PacketCheckI { +public class ActionManager extends AbstractPacketCheck { 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 89570f5feb..6f500b4471 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -363,14 +363,14 @@ private void rebuildCheckArrays() { // 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((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((PostPredictionCheckI) check); + if (check.is(CheckType.PACKET)) newPacketChecks.add((PacketCheckI) check); + if (check.is(CheckType.POSITION)) newPositionChecks.add((PositionCheckI) check); + if (check.is(CheckType.ROTATION)) newRotationChecks.add((RotationCheckI) check); + if (check.is(CheckType.VEHICLE)) newVehicleChecks.add((VehicleCheckI) check); + if (check.is(CheckType.PRE_PREDICTION)) newPrePredictionChecks.add((PacketCheckI) check); + if (check.is(CheckType.BLOCK_BREAK)) newBlockBreakChecks.add((BlockBreakCheckI) check); + if (check.is(CheckType.BLOCK_PLACE)) newBlockPlaceChecks.add((BlockPlaceCheck) check); + if (check.is(CheckType.POST_PREDICTION)) newPostPredictionChecks.add((PostPredictionCheckI) check); } 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 ad1bb75bcb..364c0f6200 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,6 @@ package ac.grim.grimac.utils.latency; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.anticheat.update.BlockPlace; import ac.grim.grimac.utils.inventory.EquipmentType; @@ -34,7 +33,7 @@ import java.util.Optional; // Updated to support modern 1.17 protocol -public class CompensatedInventory extends Check implements PacketCheckI { +public class CompensatedInventory extends AbstractPacketCheck { // "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 f5e7b2dc91..aa0bf5f713 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,6 @@ package ac.grim.grimac.utils.team; -import ac.grim.grimac.checks.Check; -import ac.grim.grimac.checks.type.interfaces.PacketCheckI; +import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; import ac.grim.grimac.utils.data.packetentity.PacketEntity; import com.github.retrooper.packetevents.event.PacketSendEvent; @@ -13,7 +12,7 @@ import java.util.Optional; import java.util.UUID; -public class TeamHandler extends Check implements PacketCheckI { +public class TeamHandler extends AbstractPacketCheck { private final Map entityTeams = new Object2ObjectOpenHashMap<>(); private final Map entityToTeam = new Object2ObjectOpenHashMap<>(); From f0701e3b1d93104b3419b1858333a98ecde3b6c7 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:24:09 -0500 Subject: [PATCH 7/8] Handle getting non-default UnloadedBehavior implementations --- src/main/java/ac/grim/grimac/manager/CheckManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 6f500b4471..875754e8e3 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -76,6 +76,7 @@ public class CheckManager { // Lookup map for getting specific checks public Map, AbstractCheck> loadedChecks = new HashMap<>(); public Map, AbstractCheck> unloadedProxies = new HashMap<>(); + public Map, UnloadedBehavior> unloadedBehaviors = new HashMap<>(); public CheckManager(GrimPlayer player) { this.player = player; @@ -277,6 +278,9 @@ private void addCheck( } else { checkMap.put(checkClass, checkInstance); } + // Do re really need to put unloaded behaviours for in a map for *all* checks? + // What about core ones or even ones that we know will have default behaviour? + unloadedBehaviors.put(checkClass, checkInstance.getUnloadedBehavior()); } } @@ -657,7 +661,7 @@ public T getCheck(Class checkClass) { */ private T createUnloadedProxy(Class checkClass) { // Get the unloaded behavior from a cached instance or use default - UnloadedBehavior behavior = DefaultUnloadedBehavior.INSTANCE; + UnloadedBehavior behavior = unloadedBehaviors.getOrDefault(checkClass, DefaultUnloadedBehavior.INSTANCE); return (T) Proxy.newProxyInstance( checkClass.getClassLoader(), From 8b5b5507823bc83b5475acab857b153724c7e299 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Fri, 20 Dec 2024 23:01:09 -0500 Subject: [PATCH 8/8] Add support for not loading checks for incompatible players --- .../grim/grimac/checks/impl/crash/CrashG.java | 11 ++++++----- .../grimac/checks/impl/movement/TickTimer.java | 11 +++++++++++ .../impl/multiactions/MultiActionsB.java | 10 ++++++++++ .../impl/multiactions/MultiActionsE.java | 10 ++++++++++ .../abstracts/AbstractPrePredictionCheck.java | 4 +++- .../ac/grim/grimac/manager/CheckManager.java | 18 +++++++----------- 6 files changed, 47 insertions(+), 17 deletions(-) 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 34117ced89..7b825d589a 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 @@ -1,5 +1,6 @@ package ac.grim.grimac.checks.impl.crash; +import ac.grim.grimac.api.GrimUser; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.player.GrimPlayer; @@ -21,8 +22,6 @@ public CrashG(GrimPlayer player) { @Override public void onPacketReceive(final PacketReceiveEvent event) { - if (!isSupportedVersion()) return; - if (event.getPacketType() == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT) { WrapperPlayClientPlayerBlockPlacement place = new WrapperPlayClientPlayerBlockPlacement(event); if (place.getSequence() < 0) { @@ -52,8 +51,10 @@ public void onPacketReceive(final PacketReceiveEvent event) { } - private boolean isSupportedVersion() { - return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19); + @Override + public boolean supportsPlayer(GrimUser player) { + // TODO make this a part of GrimUser interface + // TODO server version check when we bypass via for listening for packets + return ((GrimPlayer) player).getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19); } - } 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 52bc98fc28..45d6056813 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 @@ -1,10 +1,14 @@ package ac.grim.grimac.checks.impl.movement; +import ac.grim.grimac.api.GrimUser; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPrePredictionCheck; import ac.grim.grimac.player.GrimPlayer; +import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; +import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.packettype.PacketType; +import com.github.retrooper.packetevents.protocol.player.ClientVersion; @CheckData(name = "TickTimer", setback = 1) @@ -30,4 +34,11 @@ public void onPacketReceive(PacketReceiveEvent event) { flyingPackets = 0; } } + + @Override + public boolean supportsPlayer(GrimUser player) { + // TODO make this a part of GrimUser interface and remove the server version check when we bypass via + // TODO server version check when we bypass via for listening for packets + return ((GrimPlayer) player).getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_2) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_2); + } } 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 6502f4984c..72169a96e0 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 @@ -1,9 +1,12 @@ package ac.grim.grimac.checks.impl.multiactions; +import ac.grim.grimac.api.GrimUser; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; +import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; +import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.DiggingAction; @@ -37,4 +40,11 @@ public void onPacketReceive(PacketReceiveEvent event) { } } } + + @Override + public boolean supportsPlayer(GrimUser player) { + // TODO make this a part of GrimUser interface + // TODO server version check when we bypass via for listening for packets + return ((GrimPlayer) player).getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_8); + } } 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 d180a66d04..c123e2a131 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 @@ -1,9 +1,12 @@ package ac.grim.grimac.checks.impl.multiactions; +import ac.grim.grimac.api.GrimUser; import ac.grim.grimac.checks.CheckData; import ac.grim.grimac.checks.type.abstracts.AbstractPacketCheck; import ac.grim.grimac.player.GrimPlayer; +import com.github.retrooper.packetevents.PacketEvents; import com.github.retrooper.packetevents.event.PacketReceiveEvent; +import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.protocol.player.InteractionHand; @@ -28,4 +31,11 @@ public void onPacketReceive(PacketReceiveEvent event) { } } } + + @Override + public boolean supportsPlayer(GrimUser player) { + // TODO make this a part of GrimUser interface + // TODO server version check when we bypass via for listening for packets + return ((GrimPlayer) player).getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_8); + } } diff --git a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java index 47bb326f1c..d9a7b139f9 100644 --- a/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java +++ b/src/main/java/ac/grim/grimac/checks/type/abstracts/AbstractPrePredictionCheck.java @@ -1,9 +1,11 @@ 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.PacketCheckI; import ac.grim.grimac.player.GrimPlayer; -public abstract class AbstractPrePredictionCheck extends AbstractPacketCheck { +public abstract class AbstractPrePredictionCheck extends Check implements PacketCheckI { public AbstractPrePredictionCheck(GrimPlayer player) { super(player); } diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index 875754e8e3..a7b1044642 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -80,7 +80,6 @@ public class CheckManager { public CheckManager(GrimPlayer player) { this.player = player; - // TODO "maskify" packet checks // Packet Checks Map, PacketCheckI> packetCheckMap = new HashMap<>(); addCheck(PacketOrderProcessor.class, player.packetOrderProcessor, packetCheckMap); @@ -272,10 +271,11 @@ private void addCheck( // Currently only checks for permission, in the future we will not add to map if: // 1. Permission exempts player // 2. Client version exempts player - if (!isExempt(checkClass)) { + if (!isExempt(checkInstance)) { checkMap.put(checkClass, checkInstance); } } else { + // Adds checks without name (currently these are core checks) to map, we really need to change this behavior checkMap.put(checkClass, checkInstance); } // Do re really need to put unloaded behaviours for in a map for *all* checks? @@ -287,7 +287,7 @@ private void addCheck( /** * Performs a topological sort of checks based on their dependencies */ - private List topologicalSort(Collection checks) { + private List topologicalSort(Collection checks) throws IllegalStateException { Map, Set>> graph = new HashMap<>(); Map, Integer> inDegree = new HashMap<>(); @@ -352,6 +352,7 @@ private List topologicalSort(Collection checks) { * Rebuilds all check arrays maintaining dependency order */ private void rebuildCheckArrays() { + // TODO catch illegal state exception, and DO NOT change check arrays, instead throw error and tell player List sorted = topologicalSort(loadedChecks.values()); // Use lists first since we don't know final size @@ -447,17 +448,12 @@ public void reloadCheck(Class checkClass) { /** * Check if a player is exempt from a specific check type. */ - private boolean isExempt(Class checkClass) { + private boolean isExempt(AbstractCheck checkInstance) { // Example logic for exemptions - String permission = "grim.exempt." + checkClass.getSimpleName().toLowerCase(); + String permission = "grim.exempt." + checkInstance.getClass().getSimpleName().toLowerCase(); return // this.player.bukkitPlayer.hasPermission(permission) || - !checkClassAppliesToPlayerVersion(checkClass); - } - - private boolean checkClassAppliesToPlayerVersion(Class checkClass) { - // Example: Logic to determine if a check is compatible with the player's version - return true; // Replace with actual version check logic + !checkInstance.supportsPlayer(this.player); } @SuppressWarnings("unchecked")