This commit is contained in:
Rammelkast committed 2020-04-23 19:00:22 +02:00
1 parent da4a61e228
commit aa9fa9b290
3 files changed
+13 -4

No files matched your search

@@ -291,7 +291,7 @@ public class AntiCheatReloaded extends JavaPlugin {
}
public double getTPS() {
if (this.tps < 0) {
if (this.tps < 0 || this.tps > 20) {
return 20;
}
return this.tps;
@@ -265,9 +265,11 @@ public class Backend {
public CheckResult checkSpider(Player player, double y) {
if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN()
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())) {
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())) {
return new CheckResult(CheckResult.Result.FAILED,
"tried to climb a non-ladder (" + player.getLocation().getBlock().getType() + ")");
"tried to climb a non-climbable block (" + player.getLocation().getBlock().getType() + ")");
} else {
return PASS;
}
@@ -390,6 +392,8 @@ public class Backend {
Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
&& !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
// TODO isMoveUpBlock does not seem to be a success with stairs
@@ -37,7 +37,7 @@ public class BadPacketsCheck {
public static void runCheck(Player player, PacketEvent event) {
Backend backend = AntiCheatReloaded.getManager().getBackend();
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|| backend.isMovingExempt(player) || AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).isWaitingOnLevelSync()) {
|| backend.isMovingExempt(player)) {
return;
}
@@ -49,6 +49,11 @@ public class BadPacketsCheck {
return;
}
// TODO more precise checking for this
if (AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).isLagging()) {
return;
}
double x = packet.getDoubles().read(0);
double y = packet.getDoubles().read(1);
double z = packet.getDoubles().read(2);