-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 新检查 AimA - 简单的检查玩家瞄准 - 新检查 InvalidPitch - 检查玩家的头部旋转是否正确 - 新检查 *TimerA* - 简单的检查过快的游戏速度(数据包层面) - 新模块 Surround 方块包围 - 用方块把别人包起来! - 改进 AntiBot Latency模式 - 改进 ServerFreeze - 如果你安装了Minihud,那么ServerFreeze会额外增加低TPS关闭检查的选项 - 改进 StrafeA - 修复一些误判
- Loading branch information
Showing
31 changed files
with
518 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/top/infsky/cheatdetector/compat/MinihudHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package top.infsky.cheatdetector.compat; | ||
|
||
import fi.dy.masa.minihud.util.DataStorage; | ||
|
||
public class MinihudHelper { | ||
public static double getServerTPS() { | ||
return DataStorage.getInstance().getServerTPS(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/top/infsky/cheatdetector/impl/checks/aim/AimA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package top.infsky.cheatdetector.impl.checks.aim; | ||
|
||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import top.infsky.cheatdetector.config.AdvancedConfig; | ||
import top.infsky.cheatdetector.impl.Check; | ||
import top.infsky.cheatdetector.impl.utils.world.LevelUtils; | ||
import top.infsky.cheatdetector.impl.utils.world.PlayerRotation; | ||
import top.infsky.cheatdetector.utils.TRPlayer; | ||
|
||
public class AimA extends Check { | ||
public AimA(@NotNull TRPlayer player) { | ||
super("AimA", player); | ||
} | ||
|
||
@Override | ||
public void _onTick() { | ||
if (player.currentRot.equals(player.lastRot)) return; | ||
if (AdvancedConfig.aimAOnlyOnSwing && !(!player.lastSwing && player.currentSwing)) return; | ||
|
||
float deltaYaw = player.currentRot.y - player.lastRot.y; | ||
float deltaPitch = player.currentRot.x - player.lastRot.x; | ||
|
||
if (deltaYaw < AdvancedConfig.aimAMinDeltaYaw || deltaPitch < AdvancedConfig.aimAMinDeltaPitch) return; | ||
|
||
double diffYaw = 0; | ||
double diffPitch = 0; | ||
boolean flagYaw = false; | ||
boolean flagPitch = false; | ||
LivingEntity flagTarget = null; | ||
for (LivingEntity entity : LevelUtils.getEntities().stream().filter(entity -> entity.distanceTo(player.fabricPlayer) <= AdvancedConfig.aimAMaxDistance).toList()) { | ||
if (AdvancedConfig.aimAOnlyPlayer && entity instanceof Player) continue; | ||
if (entity.equals(player.fabricPlayer)) continue; | ||
|
||
diffYaw = Math.abs(PlayerRotation.getYaw(entity.getEyePosition()) - entity.getYRot()); | ||
diffPitch = Math.abs(PlayerRotation.getPitch(entity.getEyePosition()) - entity.getXRot()); | ||
|
||
flagYaw = diffYaw < AdvancedConfig.aimAMinDiffYaw; | ||
flagPitch = diffPitch < AdvancedConfig.aimAMinDiffPitch; | ||
|
||
if (flagPitch || flagYaw) { | ||
flagTarget = entity; | ||
break; | ||
} | ||
} | ||
|
||
if (flagYaw && flagPitch) { | ||
flag("Too small deviation. target: %s diff: %.2f,%.2f delta: %.2f,%.2f".formatted( | ||
flagTarget.getName().getString(), diffYaw, diffPitch, deltaYaw, deltaPitch) | ||
); | ||
} else if (flagYaw) { | ||
flag("Too small yaw deviation. target: %s diff: %.2f delta: %.2f".formatted( | ||
flagTarget.getName().getString(), diffYaw, deltaYaw) | ||
); | ||
} else if (flagPitch) { | ||
flag("Too small pitch deviation. target: %s diff: %.2f delta: %.2f".formatted( | ||
flagTarget.getName().getString(), diffPitch, deltaPitch) | ||
); | ||
} | ||
} | ||
|
||
@Override | ||
public int getAlertBuffer() { | ||
return AdvancedConfig.aimAAlertBuffer; | ||
} | ||
|
||
@Override | ||
public boolean isDisabled() { | ||
return !AdvancedConfig.aimACheck; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/top/infsky/cheatdetector/impl/checks/aim/InvalidPitch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package top.infsky.cheatdetector.impl.checks.aim; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import top.infsky.cheatdetector.config.AdvancedConfig; | ||
import top.infsky.cheatdetector.impl.Check; | ||
import top.infsky.cheatdetector.utils.TRPlayer; | ||
|
||
public class InvalidPitch extends Check { | ||
public InvalidPitch(@NotNull TRPlayer player) { | ||
super("InvalidPitch", player); | ||
} | ||
|
||
@Override | ||
public void _onTick() { | ||
if (player.currentRot.x > 90 || player.currentRot.x < -90) { | ||
flag(); | ||
} | ||
} | ||
|
||
@Override | ||
public int getAlertBuffer() { | ||
return AdvancedConfig.invalidPitchAlertBuffer; | ||
} | ||
|
||
@Override | ||
public boolean isDisabled() { | ||
return !AdvancedConfig.invalidPitchCheck; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/top/infsky/cheatdetector/impl/checks/exploits/TimerA.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package top.infsky.cheatdetector.impl.checks.exploits; | ||
|
||
import io.netty.channel.ChannelHandlerContext; | ||
import net.minecraft.network.Connection; | ||
import net.minecraft.network.protocol.Packet; | ||
import net.minecraft.network.protocol.game.ClientGamePacketListener; | ||
import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import top.infsky.cheatdetector.config.AdvancedConfig; | ||
import top.infsky.cheatdetector.impl.Check; | ||
import top.infsky.cheatdetector.impl.utils.world.LevelUtils; | ||
import top.infsky.cheatdetector.utils.TRPlayer; | ||
|
||
import java.util.Objects; | ||
|
||
public class TimerA extends Check { | ||
private long balance; | ||
public TimerA(@NotNull TRPlayer player) { | ||
super("*TimerA*", player); | ||
balance = AdvancedConfig.timerADefaultBalance; | ||
} | ||
|
||
@Override | ||
public void _onTick() { | ||
balance -= 50; | ||
} | ||
|
||
@Override | ||
public boolean _onPacketReceive(@NotNull Packet<ClientGamePacketListener> basePacket, Connection connection, ChannelHandlerContext channelHandlerContext, CallbackInfo ci) { | ||
if (basePacket instanceof ClientboundMoveEntityPacket packet) { | ||
try { | ||
if (!Objects.requireNonNull(packet.getEntity(LevelUtils.getClientLevel())).is(player.fabricPlayer)) return false; | ||
} catch (NullPointerException e) { | ||
return false; | ||
} | ||
|
||
balance += 50; | ||
|
||
if (balance >= AdvancedConfig.timerAFlagBalance) { | ||
flag(); | ||
balance -= 50; // 标记后应该忽略这个违规包 | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int getAlertBuffer() { | ||
return AdvancedConfig.timerAAlertBuffer; | ||
} | ||
|
||
@Override | ||
public boolean isDisabled() { | ||
return !AdvancedConfig.timerACheck; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.