mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Compare commits
7
Commits
1.9.0-PRE2
...
1.9.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bc49141fc | ||
|
|
cffd6d07ae | ||
|
|
e9a99f0463 | ||
|
|
4deb8ae0fb | ||
|
|
07f957cf35 | ||
|
|
9850f48a4e | ||
|
|
656841b046 |
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||||
<artifactId>AntiCheatReloaded</artifactId>
|
<artifactId>AntiCheatReloaded</artifactId>
|
||||||
<version>1.9.0-PRE</version>
|
<version>1.9.1</version>
|
||||||
<name>AntiCheatReloaded</name>
|
<name>AntiCheatReloaded</name>
|
||||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@@ -229,7 +230,8 @@ public class Backend {
|
|||||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||||
&& !VersionUtil.isSlowFalling(player)) {
|
&& !VersionUtil.isSlowFalling(player) && !Utilities
|
||||||
|
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())) {
|
||||||
if (player.getFallDistance() == 0) {
|
if (player.getFallDistance() == 0) {
|
||||||
if (nofallViolation.get(uuid) == null) {
|
if (nofallViolation.get(uuid) == null) {
|
||||||
nofallViolation.put(uuid, 1);
|
nofallViolation.put(uuid, 1);
|
||||||
|
|||||||
@@ -49,8 +49,10 @@ public class FlightCheck {
|
|||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|| VersionUtil.isFlying(player)) {
|
|| VersionUtil.isFlying(player) || player.getVehicle() != null
|
||||||
// This was a teleport or user is flying/using elytra, so we don't care
|
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
|
||||||
|
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't
|
||||||
|
// care
|
||||||
// about it.
|
// about it.
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
@@ -90,6 +92,10 @@ public class FlightCheck {
|
|||||||
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||||
: (blockPlaceAccountingTime + 1);
|
: (blockPlaceAccountingTime + 1);
|
||||||
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
||||||
|
// Fixes snow false positive
|
||||||
|
if (movementManager.motionY < 0.004 && Utilities
|
||||||
|
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
|
||||||
|
maxMotionY = 0.004D;
|
||||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||||
@@ -105,11 +111,12 @@ public class FlightCheck {
|
|||||||
// End AirFlight
|
// End AirFlight
|
||||||
|
|
||||||
// Start AirClimb
|
// Start AirClimb
|
||||||
// TODO two hardcoded values here shouldn't be there, temp against false
|
// TODO three hardcoded values here shouldn't be there, temp against false
|
||||||
// positive
|
// positive
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
||||||
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
||||||
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
||||||
|
&& Math.round(movementManager.motionY * 1000) != 248
|
||||||
&& !(Math.round(movementManager.motionY * 1000) == 333
|
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||||
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||||
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
@@ -121,9 +128,11 @@ public class FlightCheck {
|
|||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||||
|
|
||||||
|
// TODO hardcoded value against false again..
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||||
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
|
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
* TODO soulsand speed
|
* TODO soulsand speed
|
||||||
* TODO fix false positive with water weeds
|
|
||||||
*/
|
*/
|
||||||
public class SpeedCheck {
|
public class SpeedCheck {
|
||||||
|
|
||||||
@@ -100,7 +99,7 @@ public class SpeedCheck {
|
|||||||
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
||||||
predict *= 1.25D;
|
predict *= 1.25D;
|
||||||
// Boats sometimes give a false positive
|
// Boats sometimes give a false positive
|
||||||
if (Utilities.couldBeOnBoat(player, 0.5))
|
if (Utilities.couldBeOnBoat(player, 0.5, true))
|
||||||
predict *= 1.25D;
|
predict *= 1.25D;
|
||||||
// Strafing in air when nearing terminal velocity gives false positives
|
// 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
|
||||||
@@ -229,18 +228,15 @@ public class SpeedCheck {
|
|||||||
|
|
||||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||||
|
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
|
||||||
|
return PASS;
|
||||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
.getMovementManager();
|
.getMovementManager();
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
if (player.isInsideVehicle() || player.isSleeping()
|
|
||||||
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|
|
||||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player)) {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||||
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||||
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
|
||||||
@@ -260,9 +256,9 @@ public class SpeedCheck {
|
|||||||
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
double base = couldBeOnBoat ? 0.600000025 : (nearBed ? 0.5625 : (halfMovement ? 0.6 : 0.42));
|
||||||
if (fromClimbable)
|
if (fromClimbable)
|
||||||
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
|
||||||
base += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 0.2D;
|
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||||
}
|
base += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.2D;
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class WaterWalkCheck {
|
|||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
MovementManager movementManager = user.getMovementManager();
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
|
||||||
if (movementManager.distanceXZ <= 0)
|
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null)
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
@@ -50,14 +50,17 @@ public class WaterWalkCheck {
|
|||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||||
&& Utilities.isSurroundedByWater(player)
|
&& Utilities.isSurroundedByWater(player)
|
||||||
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0) || movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
|
||||||
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ"))
|
|| 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,
|
||||||
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
||||||
|
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
||||||
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
||||||
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY"))
|
&& 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,
|
||||||
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||||
|
|
||||||
|
|||||||
+29
-24
@@ -19,39 +19,44 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
|
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
|
|
||||||
public class CommandChecks extends CommandBase {
|
public class CommandChecks extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheatReloaded Checks Management";
|
private static final String NAME = "AntiCheatReloaded Checks Management";
|
||||||
private static final String COMMAND = "checks";
|
private static final String COMMAND = "checks";
|
||||||
private static final String USAGE = "anticheat checks";
|
private static final String USAGE = "anticheat checks";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||||
private static final String[] HELP = new String[2];
|
private static final String[] HELP = new String[2];
|
||||||
|
|
||||||
static {
|
static {
|
||||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append(GRAY + "Checks: ");
|
CheckManager checkManager = AntiCheatReloaded.getManager().getCheckManager();
|
||||||
for (int i=0;i<CheckType.values().length;i++) {
|
builder.append(GRAY + "Checks: ");
|
||||||
builder.append(CheckType.values()[i]);
|
for (int i = 0; i < CheckType.values().length; i++) {
|
||||||
if (i<CheckType.values().length-1) {
|
CheckType type = CheckType.values()[i];
|
||||||
builder.append(", ");
|
builder.append((checkManager.isActive(type) ? ChatColor.GREEN : ChatColor.RED) + type.getName());
|
||||||
}
|
if (i < CheckType.values().length - 1) {
|
||||||
}
|
builder.append(", ");
|
||||||
HELP[1] = builder.toString();
|
}
|
||||||
}
|
}
|
||||||
|
HELP[1] = builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public CommandChecks() {
|
public CommandChecks() {
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
sendHelp(cs);
|
sendHelp(cs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,7 @@ public class Config extends ConfigurationFile {
|
|||||||
public ConfigValue<List<String>> disabledWorlds;
|
public ConfigValue<List<String>> disabledWorlds;
|
||||||
|
|
||||||
public ConfigValue<Integer> notifyEveryVl;
|
public ConfigValue<Integer> notifyEveryVl;
|
||||||
|
public ConfigValue<Integer> maxSetbackDistance;
|
||||||
|
|
||||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||||
super(plugin, config, FILENAME);
|
super(plugin, config, FILENAME);
|
||||||
@@ -85,5 +86,10 @@ public class Config extends ConfigurationFile {
|
|||||||
if (notifyEveryVl.getValue() < 1) {
|
if (notifyEveryVl.getValue() < 1) {
|
||||||
notifyEveryVl.setValue(5);
|
notifyEveryVl.setValue(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
|
||||||
|
if (maxSetbackDistance.getValue() < 5) {
|
||||||
|
maxSetbackDistance.setValue(50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
|||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
@@ -134,29 +135,28 @@ public class EntityListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||||
Player player = (Player) e.getDamager();
|
Player player = (Player) e.getDamager();
|
||||||
getBackend().logDamage(player, 1);
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
if (result.failed()) {
|
||||||
if (result.failed()) {
|
event.setCancelled(!silentMode());
|
||||||
event.setCancelled(!silentMode());
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
noHack = false;
|
||||||
noHack = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||||
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
if (result.failed()) {
|
||||||
if (result.failed()) {
|
event.setCancelled(!silentMode());
|
||||||
event.setCancelled(!silentMode());
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
noHack = false;
|
||||||
noHack = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (noHack) {
|
||||||
if (noHack) {
|
decrease(player);
|
||||||
decrease(player);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
|
|||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
@@ -256,9 +257,6 @@ public class PlayerListener extends EventListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!event.isSprinting()) {
|
|
||||||
getBackend().logEnterExit(player);
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||||
CheckResult result = getBackend().checkSprintHungry(event);
|
CheckResult result = getBackend().checkSprintHungry(event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
@@ -436,7 +434,6 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean changed = false;
|
|
||||||
if (event.getTo() != event.getFrom()) {
|
if (event.getTo() != event.getFrom()) {
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
@@ -449,7 +446,6 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
log(result.getMessage(), player, CheckType.SPEED);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||||
@@ -458,7 +454,6 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
log(result.getMessage(), player, CheckType.SPEED);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||||
@@ -469,7 +464,6 @@ public class PlayerListener extends EventListener {
|
|||||||
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
log(result.getMessage(), player, CheckType.WATER_WALK);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||||
@@ -479,7 +473,6 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPIDER);
|
log(result.getMessage(), player, CheckType.SPIDER);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||||
@@ -491,12 +484,8 @@ public class PlayerListener extends EventListener {
|
|||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!changed) {
|
|
||||||
user.setGoodLocation(event.getFrom());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class CheckManager {
|
|||||||
for (CheckType type : CheckType.values()) {
|
for (CheckType type : CheckType.values()) {
|
||||||
if (!configuration.getChecks().isEnabled(type)) {
|
if (!configuration.getChecks().isEnabled(type)) {
|
||||||
checkIgnoreList.add(type);
|
checkIgnoreList.add(type);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
public class MovementManager {
|
public class MovementManager {
|
||||||
|
|
||||||
// Ticks in air
|
// Ticks in air
|
||||||
@@ -80,12 +82,12 @@ public class MovementManager {
|
|||||||
this.onGround = player.isOnGround();
|
this.onGround = player.isOnGround();
|
||||||
|
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
this.lastDistanceXZ = this.distanceXZ;
|
this.lastDistanceXZ = this.distanceXZ;
|
||||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||||
|
|
||||||
// Account for standing on boat
|
// Account for standing on boat
|
||||||
if (Utilities.couldBeOnBoat(player, 0.25))
|
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||||
this.onGround = true;
|
this.onGround = true;
|
||||||
|
|
||||||
this.touchedGroundThisTick = false;
|
this.touchedGroundThisTick = false;
|
||||||
@@ -154,12 +156,16 @@ public class MovementManager {
|
|||||||
Location bottom = to.clone().add(0, -1, 0);
|
Location bottom = to.clone().add(0, -1, 0);
|
||||||
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
||||||
|
|
||||||
if ((this.motionY > 0.464D && this.motionY <= 0.5625D) && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
if ((this.motionY > 0.42D && this.motionY <= 0.5625D)
|
||||||
|
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||||
this.halfMovement = true;
|
this.halfMovement = true;
|
||||||
this.halfMovementHistoryCounter = 30;
|
this.halfMovementHistoryCounter = 30;
|
||||||
} else {
|
} else {
|
||||||
if (this.halfMovementHistoryCounter > 0)
|
if (this.halfMovementHistoryCounter > 0)
|
||||||
this.halfMovementHistoryCounter--;
|
this.halfMovementHistoryCounter--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update "good location"
|
||||||
|
AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).setGoodLocation(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,8 @@ public class User {
|
|||||||
* @return last known valid location
|
* @return last known valid location
|
||||||
*/
|
*/
|
||||||
public Location getGoodLocation(Location location) {
|
public Location getGoodLocation(Location location) {
|
||||||
if (goodLocation == null) {
|
if (goodLocation == null || !location.getWorld().equals(goodLocation.getWorld())
|
||||||
|
|| location.distance(goodLocation) > config.getConfig().maxSetbackDistance.getValue()) {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,13 +124,18 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean couldBeOnBoat(Player player) {
|
public static boolean couldBeOnBoat(Player player) {
|
||||||
return couldBeOnBoat(player, 0.35);
|
return couldBeOnBoat(player, 0.35, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean couldBeOnBoat(Player player, double range) {
|
public static boolean couldBeOnBoat(Player player, double range, boolean checkY) {
|
||||||
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||||
if (entity instanceof Boat)
|
if (entity instanceof Boat) {
|
||||||
return true;
|
if (((Boat) entity).getLocation().getY() < player.getLocation().getY() + 0.25) {
|
||||||
|
return true;
|
||||||
|
} else if (!checkY) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -171,6 +176,31 @@ public final class Utilities {
|
|||||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a shulker box
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if block is a shulker box
|
||||||
|
*/
|
||||||
|
public static boolean isShulkerBox(Block block) {
|
||||||
|
Material type = block.getType();
|
||||||
|
return type.name().endsWith("SHULKER_BOX");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNearShulkerBox(Location location) {
|
||||||
|
if (VersionUtil.isBountifulUpdate())
|
||||||
|
return false;
|
||||||
|
return isShulkerBox(location.getBlock())
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a player could be standing on a halfblock
|
* Determine whether a player could be standing on a halfblock
|
||||||
*
|
*
|
||||||
@@ -196,7 +226,7 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHalfblock(Block block) {
|
public static boolean isHalfblock(Block block) {
|
||||||
return isSlab(block) || isStair(block) || isWall(block);
|
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
# AntiCheatReloaded checks configuration file
|
# AntiCheatReloaded checks configuration file
|
||||||
|
# Checks that have multiple modules need to be disabled on a per-module basis
|
||||||
|
# If you have a false positive and can't determine what subcheck it's from,
|
||||||
|
# enable debug-mode in config.yml and compare the results against the commented values
|
||||||
# Flight check settings
|
# Flight check settings
|
||||||
# Checks if a player moves wrongly in the air
|
# Checks if a player moves wrongly in the air
|
||||||
flight:
|
flight:
|
||||||
@@ -98,8 +101,6 @@ speed:
|
|||||||
# WaterWalk check settings
|
# WaterWalk check settings
|
||||||
# Checks if a player is walking on water
|
# Checks if a player is walking on water
|
||||||
waterwalk:
|
waterwalk:
|
||||||
# Should this check be enabled?
|
|
||||||
enabled: true
|
|
||||||
# Checks for vanilla water walking/jumping
|
# Checks for vanilla water walking/jumping
|
||||||
# Debugs as 'tried to walk on water'
|
# Debugs as 'tried to walk on water'
|
||||||
walk:
|
walk:
|
||||||
@@ -109,14 +110,14 @@ waterwalk:
|
|||||||
# This combats false positives, while giving hackers not much leniency
|
# This combats false positives, while giving hackers not much leniency
|
||||||
minimumDistXZ: 0.092
|
minimumDistXZ: 0.092
|
||||||
# Checks for small hops on top of water
|
# Checks for small hops on top of water
|
||||||
# Debugs as 'tried to lunge on water'
|
# Debugs as 'tried to hop on water'
|
||||||
hop:
|
hop:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Maximum lunge Y motion to flag
|
# Maximum lunge Y motion to flag
|
||||||
maxMotionY: 0.10
|
maxMotionY: 0.10
|
||||||
# Checks for small lunges in water
|
# Checks for small lunges in water
|
||||||
# Debugs as 'tried to walk on water'
|
# Debugs as 'tried to lunge in water'
|
||||||
lunge:
|
lunge:
|
||||||
# Should this part of the check be enabled?
|
# Should this part of the check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -191,7 +192,7 @@ velocity:
|
|||||||
# Should this check be enabled?
|
# Should this check be enabled?
|
||||||
enabled: true
|
enabled: true
|
||||||
# Minimum percentage of the given knockback a player has to meet
|
# Minimum percentage of the given knockback a player has to meet
|
||||||
minimumPercentage: 98
|
minimumPercentage: 75
|
||||||
# Amount of low-velocity moments before flagging
|
# Amount of low-velocity moments before flagging
|
||||||
vlBeforeFlag: 2
|
vlBeforeFlag: 2
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ system:
|
|||||||
# Minimum value is 1, default is 8
|
# Minimum value is 1, default is 8
|
||||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||||
notify-every-vl: 8
|
notify-every-vl: 8
|
||||||
# Use /AntiCheatReloaded checks for a list of valid checks
|
# Maximum distance a player can be set back
|
||||||
|
# If the last known valid location is further away than this,
|
||||||
|
# the player will be rubberbanded at their current location
|
||||||
|
# Minimum value is 5, default is 50
|
||||||
|
max-setback-distance: 50
|
||||||
disable-in:
|
disable-in:
|
||||||
- example-world
|
- example-world
|
||||||
- example-world-2
|
- example-world-2
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
# Time to exempt a player from moving because of entering/exiting a vehicle
|
# Time to exempt a player from moving because of entering/exiting a vehicle
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
ENTERED_EXITED_TIME: 1000
|
ENTERED_EXITED_TIME: 250
|
||||||
# Time to exempt a player from moving because of teleporting
|
# Time to exempt a player from moving because of teleporting
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
TELEPORT_TIME: 1000
|
TELEPORT_TIME: 1500
|
||||||
# Time to exempt a player from moving because of exiting fly mode
|
# Time to exempt a player from moving because of exiting fly mode
|
||||||
# Changing this value is almost never required
|
# Changing this value is almost never required
|
||||||
EXIT_FLY_TIME: 2000
|
EXIT_FLY_TIME: 2000
|
||||||
@@ -26,9 +26,9 @@ EXPLOSION_DAMAGE_TIME: 5000
|
|||||||
# Amount of seconds to extend a players velocitized state after receiving velocity again
|
# Amount of seconds to extend a players velocitized state after receiving velocity again
|
||||||
VELOCITY_EXTENSION: 2
|
VELOCITY_EXTENSION: 2
|
||||||
# Time a player is considered to have a change in velocity
|
# Time a player is considered to have a change in velocity
|
||||||
VELOCITY_TIME: 2000
|
VELOCITY_TIME: 1000
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
VELOCITY_PREVENT: 5000
|
VELOCITY_PREVENT: 2000
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
VELOCITY_MAXTIMES: 2
|
VELOCITY_MAXTIMES: 2
|
||||||
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
||||||
|
|||||||
Reference in new issue
Block a user