mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Changes to update checking, add subcheck in alerts
This commit is contained in:
1 parent
7cd90cfb61
commit
1f48785d1d
17 files changed
+126
-89
No files matched your search
@@ -169,6 +169,10 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
|
||||
ticks = 1;
|
||||
}
|
||||
|
||||
// Check for updates every 12 hours
|
||||
if (ticks % 864000 == 0)
|
||||
updateManager.update();
|
||||
}
|
||||
}.runTaskTimer(this, 40L, 1L);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class CheckResult {
|
||||
}
|
||||
|
||||
private Result result;
|
||||
private String subCheck;
|
||||
private String message;
|
||||
private int data;
|
||||
|
||||
@@ -34,6 +35,12 @@ public class CheckResult {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public CheckResult(Result result, String subcheck, String message) {
|
||||
this(result);
|
||||
this.subCheck = subcheck;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public CheckResult(Result result, String message) {
|
||||
this(result);
|
||||
this.message = message;
|
||||
@@ -46,11 +53,15 @@ public class CheckResult {
|
||||
public boolean failed() {
|
||||
return result == Result.FAILED;
|
||||
}
|
||||
|
||||
public String getSubCheck() {
|
||||
return subCheck;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CriticalsCheck {
|
||||
event.setCancelled(true);
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||
.getMessage(),
|
||||
player, CheckType.CRITICALS);
|
||||
player, CheckType.CRITICALS, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class KillAuraCheck {
|
||||
double reachedDistance = ((LivingEntity) target).getLocation().toVector()
|
||||
.distance(player.getLocation().toVector());
|
||||
if (reachedDistance > allowedReach)
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Reach",
|
||||
"reached too far (distance=" + Utilities.roundDouble(reachedDistance, 6) + ", max=" + Utilities.roundDouble(allowedReach, 6) + ")");
|
||||
return PASS;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class KillAuraCheck {
|
||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "angle", "vlBeforeFlag");
|
||||
if (flags >= vlBeforeFlag) {
|
||||
ANGLE_FLAGS.remove(uuid);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Angle",
|
||||
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class KillAuraCheck {
|
||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "vlBeforeFlag");
|
||||
if (flags >= vlBeforeFlag) {
|
||||
PACKETORDER_FLAGS.remove(uuid);
|
||||
return new CheckResult(Result.FAILED, "suspicious packet order (elapsed=" + elapsed + ")");
|
||||
return new CheckResult(Result.FAILED, "PacketOrder", "suspicious packet order (elapsed=" + elapsed + ")");
|
||||
}
|
||||
|
||||
PACKETORDER_FLAGS.put(uuid, flags + 1);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class FlightCheck {
|
||||
maxMotionY = 0.004D;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0)))
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirFlight",
|
||||
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||
|
||||
if (Math.abs(movementManager.motionY - movementManager.lastMotionY) < 0.01
|
||||
@@ -103,7 +103,7 @@ public class FlightCheck {
|
||||
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
||||
&& !VersionUtil.isSlowFalling(player) && !Utilities.isInWeb(player)
|
||||
&& movementManager.elytraEffectTicks <= 25)
|
||||
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirFlight", "had too little Y dropoff (diff="
|
||||
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
||||
}
|
||||
// End AirFlight
|
||||
@@ -124,7 +124,7 @@ public class FlightCheck {
|
||||
&& (!Utilities.isNearBed(distance.getTo())
|
||||
|| (Utilities.isNearBed(distance.getTo()) && movementManager.motionY > 0.12675))
|
||||
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25)
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||
|
||||
// TODO hardcoded value against false again..
|
||||
@@ -135,7 +135,7 @@ public class FlightCheck {
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
||||
}
|
||||
// End AirClimb
|
||||
@@ -145,7 +145,7 @@ public class FlightCheck {
|
||||
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
||||
&& Utilities.cantStandAt(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
||||
&& Utilities.cantStandAt(distance.getTo().getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "GroundFlight",
|
||||
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
||||
}
|
||||
// End GroundFlight
|
||||
@@ -155,7 +155,8 @@ public class FlightCheck {
|
||||
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
||||
&& !Utilities.isInWeb(player) && movementManager.elytraEffectTicks <= 25) {
|
||||
&& !Utilities.isInWeb(player) && movementManager.elytraEffectTicks <= 25
|
||||
&& !VersionUtil.isSlowFalling(player)) {
|
||||
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||
@@ -164,7 +165,7 @@ public class FlightCheck {
|
||||
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
|
||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
|
||||
if (vl >= vlBeforeFlag)
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Gravity",
|
||||
"ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
|
||||
} else {
|
||||
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
|
||||
|
||||
@@ -72,7 +72,7 @@ public class NoSlowCheck {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||
CheckType.NOSLOW);
|
||||
CheckType.NOSLOW, null);
|
||||
player.teleport(player.getLocation());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,8 +34,7 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
* TODO soulsand speed
|
||||
* @author Rammelkast TODO soulsand speed
|
||||
*/
|
||||
public class SpeedCheck {
|
||||
|
||||
@@ -55,9 +54,10 @@ public class SpeedCheck {
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
double distanceXZ = movementManager.distanceXZ;
|
||||
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||
|
||||
|
||||
// AirSpeed
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1 && movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1
|
||||
&& movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
|
||||
double multiplier = 0.985D;
|
||||
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
||||
@@ -70,7 +70,7 @@ public class SpeedCheck {
|
||||
if (boxedIn)
|
||||
iceIncrement += 0.45D;
|
||||
if (!Utilities.couldBeOnIce(movingTowards))
|
||||
iceIncrement *= 2.5D;
|
||||
iceIncrement *= 2.5D;
|
||||
predict += iceIncrement;
|
||||
}
|
||||
// Leniency when boxed in
|
||||
@@ -93,7 +93,8 @@ public class SpeedCheck {
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
predict += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D;
|
||||
// Adjust for custom walking speed
|
||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default 1.4
|
||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default
|
||||
// 1.4
|
||||
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||
// Slabs sometimes allow for a slight boost after jump
|
||||
if (movementManager.halfMovementHistoryCounter > 0)
|
||||
@@ -104,7 +105,8 @@ public class SpeedCheck {
|
||||
if (Utilities.couldBeOnBoat(player, 0.5, true))
|
||||
predict *= 1.25D;
|
||||
// Strafing in air when nearing terminal velocity gives false positives
|
||||
// This fixes the issue but gives hackers some leniency which means we need another check for this
|
||||
// This fixes the issue but gives hackers some leniency which means we need
|
||||
// another check for this
|
||||
double deltaMotionY = movementManager.motionY - movementManager.lastMotionY;
|
||||
if ((deltaMotionY < 0 && deltaMotionY >= -0.08) || movementManager.airTicks >= 40
|
||||
&& (movingTowards.getBlockY() - player.getWorld().getHighestBlockYAt(movingTowards)) <= 1.5)
|
||||
@@ -121,10 +123,12 @@ public class SpeedCheck {
|
||||
if (movementManager.nearLiquidTicks >= 7 && movementManager.airTicks >= 14
|
||||
&& movementManager.motionY < -0.18 && movementManager.motionY > -0.182)
|
||||
predict += Math.abs(movementManager.motionY);
|
||||
|
||||
|
||||
if (distanceXZ - predict > limit) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "moved too fast in air (speed=" + distanceXZ
|
||||
+ ", limit=" + predict + ", block=" + movementManager.blockingTicks + ", box=" + boxedIn + ", at=" + movementManager.airTicks + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
|
||||
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ", block="
|
||||
+ movementManager.blockingTicks + ", box=" + boxedIn + ", at="
|
||||
+ movementManager.airTicks + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,13 +149,14 @@ public class SpeedCheck {
|
||||
if (movementManager.halfMovementHistoryCounter > 15)
|
||||
limit *= 2.0D;
|
||||
// Adjust for custom walking speed
|
||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "walkSpeedMultiplier"); // Default 1.4
|
||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration",
|
||||
"walkSpeedMultiplier"); // Default 1.4
|
||||
limit += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||
// Boats sometimes give a false positive
|
||||
if (Utilities.couldBeOnBoat(player))
|
||||
limit *= 1.25D;
|
||||
if (initialAcceleration > limit) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
|
||||
"exceeded acceleration limits (acceleration=" + initialAcceleration + ", max=" + limit + ")");
|
||||
}
|
||||
}
|
||||
@@ -162,16 +167,19 @@ public class SpeedCheck {
|
||||
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10) {
|
||||
// This happens naturally
|
||||
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
|
||||
double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default 0.42
|
||||
double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default
|
||||
// 0.42
|
||||
if (distanceXZ >= minimumDistXZ) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "had unexpected jumping behaviour");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "JumpBehaviour",
|
||||
"had unexpected jumping behaviour");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// GroundSpeed
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1) {
|
||||
double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default 0.34
|
||||
double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default
|
||||
// 0.34
|
||||
double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks);
|
||||
// Leniency when moving back on ground
|
||||
if (movementManager.groundTicks < 5)
|
||||
@@ -224,13 +232,14 @@ public class SpeedCheck {
|
||||
// TODO config
|
||||
if (movementManager.sneakingTicks > 1)
|
||||
limit *= 0.68D;
|
||||
|
||||
|
||||
if (distanceXZ - limit > 0) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking=" + player.isBlocking() + ", gt=" + movementManager.groundTicks + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "GroundSpeed",
|
||||
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking="
|
||||
+ player.isBlocking() + ", gt=" + movementManager.groundTicks + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -244,27 +253,32 @@ public class SpeedCheck {
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||
return PASS;
|
||||
|
||||
|
||||
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
||||
Utilities.couldBeOnBoat(player),
|
||||
Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)),
|
||||
movementManager.halfMovement, checksConfig);
|
||||
// Fix false positive with soulsand boost
|
||||
if (movementManager.nearLiquidTicks > 6)
|
||||
maxMotionY *= 1.0525D;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
return new CheckResult(CheckResult.Result.FAILED, "VerticalSpeed",
|
||||
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat, boolean fromClimbable, boolean halfMovement, Checks checksConfig) {
|
||||
|
||||
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat,
|
||||
boolean fromClimbable, boolean halfMovement, Checks checksConfig) {
|
||||
// TODO config for these values
|
||||
// TODO something funky vanilla stuff going on with 0.42, like 0.445.., check this..
|
||||
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : ((halfMovement || VersionUtil.isBountifulUpdate()) ? 0.6 : 0.42));
|
||||
// TODO something funky vanilla stuff going on with 0.42, like 0.445.., check
|
||||
// this..
|
||||
double base = couldBeOnBoat ? 0.600000025
|
||||
: (nearBed ? 0.5625 : ((halfMovement || VersionUtil.isBountifulUpdate()) ? 0.6 : 0.42));
|
||||
if (fromClimbable)
|
||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||
|
||||
|
||||
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||
base += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D;
|
||||
return base;
|
||||
|
||||
@@ -55,14 +55,14 @@ public class WaterWalkCheck {
|
||||
|| movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ")
|
||||
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false))
|
||||
return new CheckResult(Result.FAILED,
|
||||
return new CheckResult(Result.FAILED, "Walk",
|
||||
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
||||
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
||||
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY")
|
||||
&& !Utilities.couldBeOnBoat(player, 0.3, false))
|
||||
return new CheckResult(Result.FAILED,
|
||||
return new CheckResult(Result.FAILED, "Hop",
|
||||
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||
|
||||
double minAbsMotionY = 0.12D;
|
||||
@@ -73,7 +73,7 @@ public class WaterWalkCheck {
|
||||
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
|
||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ")
|
||||
&& movementManager.lastMotionY > -0.25)
|
||||
return new CheckResult(Result.FAILED, "tried to lunge in water (xz="
|
||||
return new CheckResult(Result.FAILED, "Lunge", "tried to lunge in water (xz="
|
||||
+ Utilities.roundDouble(movementManager.distanceXZ, 5) + ", absMotionY="
|
||||
+ Utilities.roundDouble(Math.abs(movementManager.lastMotionY - movementManager.motionY), 5) + ")");
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class BadPacketsCheck {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||
CheckType.BADPACKETS);
|
||||
CheckType.BADPACKETS, null);
|
||||
player.teleport(player.getLocation());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ public class MorePacketsCheck {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||
CheckType.MOREPACKETS);
|
||||
CheckType.MOREPACKETS, null);
|
||||
player.teleport(player.getLocation());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -47,7 +47,8 @@ public class IllegalInteract {
|
||||
} else if (event instanceof BlockBreakEvent
|
||||
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "break")) {
|
||||
return checkBlockBreak(player, (BlockBreakEvent) event);
|
||||
} else if (event instanceof PlayerInteractEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
|
||||
} else if (event instanceof PlayerInteractEvent
|
||||
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
|
||||
return checkInteract(player, (PlayerInteractEvent) event);
|
||||
}
|
||||
return PASS;
|
||||
@@ -67,21 +68,22 @@ public class IllegalInteract {
|
||||
maxDistance += player.getVelocity().length()
|
||||
* checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "velocityMultiplier");
|
||||
if (distance > maxDistance) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Interact",
|
||||
"tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
|
||||
if (!isValidTarget(player, event.getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break a block which was out of view");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Break", "tried to break a block which was out of view");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
|
||||
if (!isValidTarget(player, event.getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block out of their view");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Place", "tried to place a block out of their view");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
@@ -89,8 +91,7 @@ public class IllegalInteract {
|
||||
private static boolean isValidTarget(Player player, Block block) {
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0
|
||||
: player.getLocation().getDirection().getY() > 0.9 ? 6.0
|
||||
: 5.5;
|
||||
: player.getLocation().getDirection().getY() > 0.9 ? 6.0 : 5.5;
|
||||
Block targetBlock = VersionUtil.getTargetBlock(player, ((int) Math.ceil(distance)));
|
||||
if (targetBlock == null) {
|
||||
// TODO better check here
|
||||
|
||||
@@ -38,7 +38,7 @@ public class BlockListener extends EventListener {
|
||||
CheckResult result = getBackend().checkFastPlace(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_PLACE);
|
||||
log(result.getMessage(), player, CheckType.FAST_PLACE, result.getSubCheck());
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class BlockListener extends EventListener {
|
||||
CheckResult result = IllegalInteract.performCheck(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class BlockListener extends EventListener {
|
||||
result = IllegalInteract.performCheck(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class EntityListener extends EventListener {
|
||||
CheckResult result = getBackend().checkFastBow(player, event.getForce());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_BOW);
|
||||
log(result.getMessage(), player, CheckType.FAST_BOW, result.getSubCheck());
|
||||
} else {
|
||||
decrease(player);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class EntityListener extends EventListener {
|
||||
CheckResult result = getBackend().checkFastHeal(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_HEAL);
|
||||
log(result.getMessage(), player, CheckType.FAST_HEAL, result.getSubCheck());
|
||||
} else {
|
||||
decrease(player);
|
||||
getBackend().logHeal(player);
|
||||
@@ -88,7 +88,7 @@ public class EntityListener extends EventListener {
|
||||
CheckResult result = getBackend().checkFastEat(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_EAT);
|
||||
log(result.getMessage(), player, CheckType.FAST_EAT, result.getSubCheck());
|
||||
} else {
|
||||
decrease(player);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class EntityListener extends EventListener {
|
||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class EntityListener extends EventListener {
|
||||
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class EntityListener extends EventListener {
|
||||
CheckResult result = KillAuraCheck.checkPacketOrder(player, event.getEntity());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class EventListener implements Listener {
|
||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
||||
|
||||
public static void log(String message, Player player, CheckType type) {
|
||||
public static void log(String message, Player player, CheckType type, String subcheck) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
if (user == null)
|
||||
return;
|
||||
@@ -71,8 +71,10 @@ public class EventListener implements Listener {
|
||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
} else {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY
|
||||
+ player.getName() + " failed " + type.getName() + ChatColor.GOLD + " (x" + vlForType + ")"
|
||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY
|
||||
+ (subcheck != null ? ("type: " + subcheck.toLowerCase() + ", ") : "") + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class InventoryListener extends EventListener {
|
||||
player.getInventory().clear();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FAST_INVENTORY);
|
||||
log(result.getMessage(), player, CheckType.FAST_INVENTORY, result.getSubCheck());
|
||||
} else {
|
||||
decrease(player);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode())
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||
getBackend().processCommandSpammer(player);
|
||||
log(null, player, CheckType.COMMAND_SPAM);
|
||||
log(null, player, CheckType.COMMAND_SPAM, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = getBackend().checkProjectile(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_PROJECTILE);
|
||||
log(result.getMessage(), player, CheckType.FAST_PROJECTILE, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = getBackend().checkSneakToggle(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.SNEAK);
|
||||
log(result.getMessage(), player, CheckType.SNEAK, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
// getBackend().logToggleSneak(event.getPlayer());
|
||||
@@ -201,7 +201,7 @@ public class PlayerListener extends EventListener {
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log(null, player, CheckType.CHAT_SPAM);
|
||||
log(null, player, CheckType.CHAT_SPAM, result.getSubCheck());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public class PlayerListener extends EventListener {
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log(null, player, CheckType.CHAT_UNICODE);
|
||||
log(null, player, CheckType.CHAT_UNICODE, result.getSubCheck());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -258,7 +258,7 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = getBackend().checkSprintHungry(event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.SPRINT);
|
||||
log(result.getMessage(), player, CheckType.SPRINT, result.getSubCheck());
|
||||
} else {
|
||||
decrease(player);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = IllegalInteract.performCheck(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = getBackend().checkFastDrop(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.ITEM_SPAM);
|
||||
log(result.getMessage(), player, CheckType.ITEM_SPAM, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,13 +390,13 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||
log(result.getMessage(), player, CheckType.FLIGHT, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
||||
CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||
if (result.failed()) {
|
||||
log(result.getMessage(), player, CheckType.ELYTRAFLY);
|
||||
log(result.getMessage(), player, CheckType.ELYTRAFLY, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP)
|
||||
@@ -414,7 +414,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
player.damage(3);
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.VCLIP);
|
||||
log(result.getMessage(), player, CheckType.VCLIP, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL)
|
||||
@@ -427,7 +427,7 @@ public class PlayerListener extends EventListener {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
// TODO better handling of this
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.NOFALL);
|
||||
log(result.getMessage(), player, CheckType.NOFALL, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||
@@ -450,7 +450,7 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPEED);
|
||||
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||
@@ -460,7 +460,7 @@ public class PlayerListener extends EventListener {
|
||||
// TODO check this
|
||||
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
||||
log(result.getMessage(), player, CheckType.WATER_WALK, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||
@@ -469,7 +469,7 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.SPIDER);
|
||||
log(result.getMessage(), player, CheckType.SPIDER, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||
@@ -480,7 +480,7 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) {
|
||||
@@ -489,20 +489,20 @@ public class PlayerListener extends EventListener {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.STRAFE);
|
||||
log(result.getMessage(), player, CheckType.STRAFE, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||
if (result.failed()) {
|
||||
log(result.getMessage(), player, CheckType.AIMBOT);
|
||||
log(result.getMessage(), player, CheckType.AIMBOT, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.VELOCITY)) {
|
||||
CheckResult result = VelocityCheck.runCheck(player, distance);
|
||||
if (result.failed()) {
|
||||
log(result.getMessage(), player, CheckType.VELOCITY);
|
||||
log(result.getMessage(), player, CheckType.VELOCITY, result.getSubCheck());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,15 @@ public class UpdateManager {
|
||||
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
|
||||
+ RESOURCE_ID;
|
||||
|
||||
private final String latestVersion;
|
||||
private final boolean isLatest;
|
||||
private final boolean isAhead;
|
||||
private String latestVersion;
|
||||
private boolean isLatest;
|
||||
private boolean isAhead;
|
||||
|
||||
public UpdateManager() {
|
||||
this.update();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.latestVersion = this.getOnlineData(SPIGOT_VERSION_URL);
|
||||
if (this.latestVersion == null) {
|
||||
this.isLatest = true;
|
||||
|
||||
Reference in new issue
Block a user