mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5c8c5dc8a | ||
|
|
15c61fac67 | ||
|
|
7e1f0d83ce | ||
|
|
bd1db83a98 | ||
|
|
646e906ada |
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.9.5</version>
|
||||
<version>1.9.6</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||
<properties>
|
||||
@@ -69,6 +69,7 @@
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.6.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
@@ -79,7 +80,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -231,8 +231,11 @@ public class Backend {
|
||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||
&& !VersionUtil.isSlowFalling(player) && !Utilities
|
||||
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation()) && !Utilities.isNearClimbable(player)) {
|
||||
&& !VersionUtil.isSlowFalling(player)
|
||||
&& !Utilities
|
||||
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())
|
||||
&& !Utilities.isNearClimbable(player)
|
||||
&& !Utilities.isNearWater(player.getLocation().clone().subtract(0, 1.5, 0))) {
|
||||
if (player.getFallDistance() == 0) {
|
||||
if (nofallViolation.get(uuid) == null) {
|
||||
nofallViolation.put(uuid, 1);
|
||||
@@ -244,8 +247,8 @@ public class Backend {
|
||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.NOFALL, "vlBeforeFlag");
|
||||
if (i >= vlBeforeFlag) {
|
||||
nofallViolation.put(player.getUniqueId(), 1);
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 "
|
||||
+ i + " times in a row, max=" + vlBeforeFlag + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"tried to avoid fall damage (" + i + " times in a row, max=" + vlBeforeFlag + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,11 @@ public class ElytraCheck {
|
||||
}
|
||||
|
||||
if (!JUMP_Y_VALUE.containsKey(uuid)) {
|
||||
JUMP_Y_VALUE.put(uuid, distance.toY());
|
||||
// Distance + player height
|
||||
JUMP_Y_VALUE.put(uuid, distance.toY() + 1.8D);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
double lastY = JUMP_Y_VALUE.get(uuid);
|
||||
if (lastY < distance.toY()) {
|
||||
double diff = distance.toY() - lastY;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -31,6 +30,7 @@ import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class FastLadderCheck {
|
||||
|
||||
@@ -38,11 +38,11 @@ public class FastLadderCheck {
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, double y) {
|
||||
// Only check if fully on ladder
|
||||
// Only check if fully on ladder and not flying
|
||||
// Liquids are climbable blocks, so we have to add a seperate check
|
||||
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||
|| !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||
|| player.getLocation().getBlock().isLiquid()) {
|
||||
|| player.getLocation().getBlock().isLiquid() || VersionUtil.isFlying(player)) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@@ -62,7 +63,8 @@ public class FlightCheck {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
|
||||
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player))
|
||||
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player)
|
||||
|| movementManager.riptideTicks > 0)
|
||||
return PASS;
|
||||
|
||||
int minAirTicks = 13;
|
||||
@@ -91,18 +93,27 @@ public class FlightCheck {
|
||||
// Fixes snow false positive
|
||||
if (movementManager.motionY < 0.004 && Utilities
|
||||
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
|
||||
maxMotionY = 0.004D;
|
||||
maxMotionY += 0.004D;
|
||||
if (Utilities.isNearWater(player) || Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0)))
|
||||
maxMotionY += 0.05;
|
||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0)))
|
||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0))
|
||||
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 0.75, 0))
|
||||
&& (!Utilities.isNearWater(distance.getTo().clone().subtract(0, 1.5, 0))
|
||||
&& distance.getTo().clone().subtract(0, 0.5, 0).getBlock().getType() != Material.AIR))
|
||||
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
|
||||
if (Math.abs(movementManager.motionY
|
||||
- movementManager.lastMotionY) < (movementManager.airTicks >= 115 ? 1E-3 : 5E-3)
|
||||
&& !Utilities.couldBeOnBoat(player)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
||||
&& !VersionUtil.isSlowFalling(player) && !Utilities.isNearWeb(player)
|
||||
&& movementManager.elytraEffectTicks <= 25)
|
||||
&& movementManager.elytraEffectTicks <= 25
|
||||
&& !Utilities.isNearClimbable(distance.getFrom().clone().subtract(0, 0.51D, 0))
|
||||
&& !Utilities.isNearWater(player)
|
||||
&& !Utilities.isNearWater(distance.getFrom().clone().subtract(0, 0.51, 0)))
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirFlight", "had too little Y dropoff (diff="
|
||||
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
||||
}
|
||||
@@ -121,8 +132,9 @@ public class FlightCheck {
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||
&& (!Utilities.isNearBed(distance.getTo())
|
||||
|| (Utilities.isNearBed(distance.getTo()) && movementManager.motionY > 0.12675))
|
||||
&& (!Utilities.isNearBed(distance.getTo()) || ((Utilities.isNearBed(distance.getTo())
|
||||
|| Utilities.isNearBed(distance.getTo().clone().add(0, -0.51, 0)))
|
||||
&& movementManager.motionY > 0.15))
|
||||
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25)
|
||||
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||
@@ -160,13 +172,20 @@ public class FlightCheck {
|
||||
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||
if (Utilities.isNearClimbable(distance.getFrom().clone().subtract(0, 0.51D, 0))
|
||||
|| Utilities.isNearClimbable(distance.getFrom()) || Utilities.isNearWater(player)
|
||||
|| (!Utilities.isNearWater(distance.getTo().clone().subtract(0, 1.5, 0))
|
||||
&& distance.getTo().clone().subtract(0, 0.5, 0).getBlock().getType() != Material.AIR))
|
||||
maxOffset += 0.15D;
|
||||
if (offset > maxOffset && movementManager.airTicks > 2) {
|
||||
int vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
||||
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
|
||||
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
|
||||
if (vl >= vlBeforeFlag)
|
||||
if (vl >= vlBeforeFlag) {
|
||||
GRAVITY_VIOLATIONS.put(player.getUniqueId(), Math.max(0, vl - 2));
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Gravity",
|
||||
"ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
|
||||
}
|
||||
} else {
|
||||
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast TODO soulsand speed
|
||||
* @author Rammelkast TODO soulsand speed TODO buffer system
|
||||
*/
|
||||
public class SpeedCheck {
|
||||
|
||||
@@ -51,6 +51,9 @@ public class SpeedCheck {
|
||||
|
||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getMovementManager();
|
||||
// Riptiding exemption
|
||||
if (movementManager.riptideTicks > 0)
|
||||
return PASS;
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
double distanceXZ = movementManager.distanceXZ;
|
||||
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||
@@ -60,6 +63,9 @@ public class SpeedCheck {
|
||||
&& movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
|
||||
double multiplier = 0.985D;
|
||||
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
||||
// Prevents false when falling from great heights
|
||||
if (movementManager.airTicks >= 115)
|
||||
predict = Math.max(0.08, predict);
|
||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
||||
// Adjust for ice
|
||||
if (movementManager.iceInfluenceTicks > 0) {
|
||||
@@ -147,7 +153,7 @@ public class SpeedCheck {
|
||||
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
|
||||
// Adjust for slabs
|
||||
if (movementManager.halfMovementHistoryCounter > 15)
|
||||
limit *= 2.0D;
|
||||
limit *= 2.05D;
|
||||
// Adjust for custom walking speed
|
||||
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration",
|
||||
"walkSpeedMultiplier"); // Default 1.4
|
||||
@@ -164,7 +170,8 @@ public class SpeedCheck {
|
||||
// JumpBehaviour
|
||||
// Works against YPorts and mini jumps
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "jumpBehaviour") && movementManager.touchedGroundThisTick
|
||||
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10) {
|
||||
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10 && !Utilities.isNearHalfblock(movingTowards)
|
||||
&& !Utilities.isNearHalfblock(movingTowards.clone().subtract(0, 0.51, 0))) {
|
||||
// This happens naturally
|
||||
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
|
||||
double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default
|
||||
@@ -201,6 +208,11 @@ public class SpeedCheck {
|
||||
limit *= 1.4D;
|
||||
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect)
|
||||
limit *= 1.2D;
|
||||
// Other speed increasing effects (idk why, bloody Bukkt..)
|
||||
if (movementManager.hasIncreasingEffect && movementManager.groundTicks > 3)
|
||||
limit *= 1.12D;
|
||||
if (movementManager.hadIncreasingEffect && !movementManager.hasIncreasingEffect)
|
||||
limit *= 1.08D;
|
||||
if (movementManager.iceInfluenceTicks >= 50) {
|
||||
// When moving off ice
|
||||
if (!Utilities.couldBeOnIce(movingTowards))
|
||||
@@ -247,10 +259,13 @@ public class SpeedCheck {
|
||||
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
|
||||
|| Utilities.isNearWater(player))
|
||||
return PASS;
|
||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getMovementManager();
|
||||
// Riptiding exemption
|
||||
if (movementManager.riptideTicks > 0)
|
||||
return PASS;
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||
return PASS;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class StrafeCheck {
|
||||
public static CheckResult runCheck(Player player, double x, double z, Location from, Location to) {
|
||||
if (!Utilities.cantStandAtExp(from) || !Utilities.cantStandAtExp(to) || Utilities.isNearWater(player)
|
||||
|| Utilities.isNearClimbable(player) || VersionUtil.isFlying(player) || player.isDead()
|
||||
|| Utilities.isHalfblock(to.getBlock().getRelative(BlockFace.DOWN)))
|
||||
|| Utilities.isHalfblock(to.getBlock().getRelative(BlockFace.DOWN)) || Utilities.isNearHalfblock(to))
|
||||
return PASS;
|
||||
|
||||
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
|
||||
@@ -44,9 +44,10 @@ public class WaterWalkCheck {
|
||||
MovementManager movementManager = user.getMovementManager();
|
||||
|
||||
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player)
|
||||
|| VersionUtil.isRiptiding(player) || VersionUtil.isSwimming(player) || VersionUtil.isFlying(player))
|
||||
|| movementManager.riptideTicks > 0 || VersionUtil.isSwimming(player) || VersionUtil.isFlying(player)
|
||||
|| player.getLocation().getBlock().getType().name().endsWith("CARPET"))
|
||||
return PASS;
|
||||
|
||||
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
|
||||
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||
|
||||
@@ -82,7 +82,7 @@ public class IllegalInteract {
|
||||
}
|
||||
|
||||
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
|
||||
if (!isValidTarget(player, event.getBlock())) {
|
||||
if (event.getBlock().getType().isSolid() && !isValidTarget(player, event.getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Place", "tried to place a block out of their view");
|
||||
}
|
||||
return PASS;
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
package com.rammelkast.anticheatreloaded.event;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -47,6 +49,11 @@ public class EventListener implements Listener {
|
||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
||||
|
||||
static {
|
||||
// What the hell, Java..
|
||||
TPS_FORMAT.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static void log(String message, Player player, CheckType type, String subcheck) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
if (user == null)
|
||||
|
||||
@@ -22,14 +22,10 @@ package com.rammelkast.anticheatreloaded.event;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
public class InventoryListener extends EventListener {
|
||||
|
||||
@@ -55,18 +51,4 @@ public class InventoryListener extends EventListener {
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
if (event.getInventory().getType() != InventoryType.BEACON) {
|
||||
getUserManager().getUser(event.getPlayer().getUniqueId()).setInventorySnapshot(event.getInventory().getContents());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
User user = getUserManager().getUser(event.getPlayer().getUniqueId());
|
||||
if (user != null) {
|
||||
user.removeInventorySnapshot();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,6 +89,12 @@ public class MovementManager {
|
||||
public boolean hasSpeedEffect = false;
|
||||
// If the player had speed effect previous tick
|
||||
public boolean hadSpeedEffect = false;
|
||||
// If the player has a speed increasing effect
|
||||
public boolean hasIncreasingEffect = false;
|
||||
// If the player had a speed increasing effect previous tick
|
||||
public boolean hadIncreasingEffect = false;
|
||||
// Riptiding ticks
|
||||
public int riptideTicks;
|
||||
// Time of last update
|
||||
public long lastUpdate;
|
||||
|
||||
@@ -178,8 +184,22 @@ public class MovementManager {
|
||||
this.nearLiquidTicks = 0;
|
||||
}
|
||||
|
||||
if (VersionUtil.CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
if (player.isRiptiding()) {
|
||||
this.riptideTicks = 30;
|
||||
} else {
|
||||
if (this.riptideTicks > 0)
|
||||
this.riptideTicks--;
|
||||
else
|
||||
this.riptideTicks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.hadSpeedEffect = this.hasSpeedEffect;
|
||||
this.hasSpeedEffect = player.hasPotionEffect(PotionEffectType.SPEED);
|
||||
|
||||
this.hadIncreasingEffect = this.hasIncreasingEffect;
|
||||
this.hasIncreasingEffect = !player.getActivePotionEffects().isEmpty();
|
||||
|
||||
double lastDistanceSq = Math.sqrt(this.lastDistance.getXDifference() * this.lastDistance.getXDifference()
|
||||
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
|
||||
|
||||
@@ -20,15 +20,12 @@
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
@@ -41,7 +38,6 @@ public class User {
|
||||
private final int id;
|
||||
private int level = 0;
|
||||
private Location goodLocation;
|
||||
private List<ItemStack> inventorySnapshot = null;
|
||||
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
||||
private int toX, toY, toZ;
|
||||
private String[] messages = new String[2];
|
||||
@@ -245,44 +241,7 @@ public class User {
|
||||
goodLocation = location;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a copy of the player's inventory, for use in resetting
|
||||
*
|
||||
* @param is ItemStack list to store
|
||||
*/
|
||||
public void setInventorySnapshot(ItemStack[] is) {
|
||||
inventorySnapshot = new ArrayList<ItemStack>();
|
||||
for (int i = 0; i < is.length; i++) {
|
||||
if (is[i] != null) {
|
||||
inventorySnapshot.add(is[i].clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the current inventory snapshot
|
||||
*/
|
||||
public void removeInventorySnapshot() {
|
||||
inventorySnapshot = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the player's inventory with the current inventory snapshot
|
||||
*
|
||||
* @param inventory Player's inventory
|
||||
*/
|
||||
public void restoreInventory(Inventory inventory) {
|
||||
if (inventorySnapshot != null) {
|
||||
inventory.clear();
|
||||
for (ItemStack is : inventorySnapshot) {
|
||||
if (is != null) {
|
||||
inventory.addItem(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the player's to location
|
||||
*
|
||||
|
||||
@@ -487,6 +487,26 @@ public final class Utilities {
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a location is near a liquid block
|
||||
*
|
||||
* @param location Location to check
|
||||
* @return true if near liquid block
|
||||
*/
|
||||
public static boolean isNearWater(Location location) {
|
||||
return location.getBlock().isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.UP).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.NORTH).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.EAST).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.WEST).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.NORTH_EAST).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.NORTH_WEST).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|
||||
|| location.getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is surrounded by liquid blocks
|
||||
|
||||
@@ -35,8 +35,8 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
public static final MinecraftVersion CURRENT_VERSION;
|
||||
private static final List<String> SUPPORTED_VERSIONS;
|
||||
private static final MinecraftVersion CURRENT_VERSION;
|
||||
|
||||
public static String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
@@ -73,13 +73,6 @@ public class VersionUtil {
|
||||
|| AntiCheatReloaded.getManager().getBackend().justLevitated(player);
|
||||
}
|
||||
|
||||
public static boolean isRiptiding(Player player) {
|
||||
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
return false;
|
||||
}
|
||||
return player.isRiptiding();
|
||||
}
|
||||
|
||||
public static boolean isSlowFalling(Player player) {
|
||||
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||
return false;
|
||||
|
||||
@@ -18,7 +18,7 @@ flight:
|
||||
accountForTpsDrops: 250
|
||||
# How many milliseconds to account for teleports
|
||||
# Increase this is you debug 'had too little Y dropoff' after teleports
|
||||
accountForTeleports: 150
|
||||
accountForTeleports: 400
|
||||
# Checks for climbing behaviour in air
|
||||
# Debugs as 'tried to climb air'
|
||||
airClimb:
|
||||
@@ -26,7 +26,7 @@ flight:
|
||||
enabled: true
|
||||
# How many milliseconds to account for teleports
|
||||
# Increase this is you debug 'tried to climb air' after teleports
|
||||
accountForTeleports: 50
|
||||
accountForTeleports: 300
|
||||
# Checks if a player is faking it's ground status to fly
|
||||
# Debugs as 'faked ground to fly'
|
||||
groundFlight:
|
||||
@@ -41,16 +41,14 @@ flight:
|
||||
maxOffset: 0.005
|
||||
# How many milliseconds to account for teleports
|
||||
# Increase this is you debug 'ignored gravity' after teleports
|
||||
accountForTeleports: 100
|
||||
accountForTeleports: 300
|
||||
# Amount of illegal moves before flagging
|
||||
vlBeforeFlag: 5
|
||||
|
||||
# ElytraFly check settings
|
||||
# Checks for illegal upward elytra movement
|
||||
elytrafly:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
|
||||
# Speed check settings
|
||||
# Checks if a player moves too fast
|
||||
speed:
|
||||
@@ -63,7 +61,6 @@ speed:
|
||||
baseLimit: 0.03125
|
||||
# Prediction multiplier for custom walk speeds
|
||||
walkSpeedMultiplier: 1.4
|
||||
|
||||
# Checks movement acceleration in the air
|
||||
# Debugs as 'exceeded acceleration limits'
|
||||
airAcceleration:
|
||||
@@ -73,7 +70,6 @@ speed:
|
||||
baseLimit: 0.3725
|
||||
# Limit multiplier for custom walk speeds
|
||||
walkSpeedMultiplier: 1.4
|
||||
|
||||
# Checks movement acceleration in the air
|
||||
# Debugs as 'had unexpected jumping behaviour'
|
||||
jumpBehaviour:
|
||||
@@ -81,7 +77,6 @@ speed:
|
||||
enabled: true
|
||||
# Minimum movement distance needed to flag
|
||||
minimumDistXZ: 0.42
|
||||
|
||||
# Checks movement speed on the ground
|
||||
# Debugs as 'moved too fast on ground'
|
||||
groundSpeed:
|
||||
@@ -89,7 +84,6 @@ speed:
|
||||
enabled: true
|
||||
# Initial speed limit value
|
||||
initialLimit: 0.34
|
||||
|
||||
# Checks movement acceleration in the air
|
||||
# Debugs as 'exceeded vertical speed limit'
|
||||
verticalSpeed:
|
||||
@@ -97,19 +91,17 @@ speed:
|
||||
enabled: true
|
||||
# Extra compensation when moving off a ladder up a slab
|
||||
climbableCompensation: 0.04
|
||||
|
||||
# Strafe check settings
|
||||
# Checks if a player switches movement angle in air
|
||||
strafe:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
# How many milliseconds to account for teleports
|
||||
accountForTeleports: 100
|
||||
accountForTeleports: 300
|
||||
# Maximum angle change when moving in air
|
||||
maxAngleChange: 0.50
|
||||
maxAngleChange: 0.5
|
||||
# Minimum movement distance for the strafe check to be active
|
||||
minActivationDistance: 0.025
|
||||
|
||||
minActivationDistance: 0.04
|
||||
# WaterWalk check settings
|
||||
# Checks if a player is walking on water
|
||||
waterwalk:
|
||||
@@ -127,7 +119,7 @@ waterwalk:
|
||||
# Should this part of the check be enabled?
|
||||
enabled: true
|
||||
# Maximum lunge Y motion to flag
|
||||
maxMotionY: 0.10
|
||||
maxMotionY: 0.1
|
||||
# Checks for small lunges in water
|
||||
# Debugs as 'tried to lunge in water'
|
||||
lunge:
|
||||
@@ -136,7 +128,6 @@ waterwalk:
|
||||
# Minimum xz distance before flagging
|
||||
# This combats false positives, while giving hackers not much leniency
|
||||
minimumDistXZ: 0.098
|
||||
|
||||
# FastLadder check settings
|
||||
# Checks if a player moves too fast on a ladder
|
||||
fastladder:
|
||||
@@ -148,7 +139,6 @@ fastladder:
|
||||
speedDownMax: 0.15
|
||||
# Amount of illegal ladder moves before flagging
|
||||
vlBeforeFlag: 3
|
||||
|
||||
# BoatFly check settings
|
||||
# Checks if the player is flying in a boat
|
||||
boatfly:
|
||||
@@ -156,7 +146,6 @@ boatfly:
|
||||
enabled: true
|
||||
# Amount of in-boat airborne moments before flagging
|
||||
vlBeforeFlag: 2
|
||||
|
||||
# KillAura check settings
|
||||
# Checks if the player uses a form of kill aura
|
||||
killaura:
|
||||
@@ -179,7 +168,6 @@ killaura:
|
||||
pingCompensation: 0.0025
|
||||
# The multiplier of extra compensation for velocity
|
||||
velocityMultiplier: 1.2
|
||||
|
||||
# Checks if the target it within a players viewing angle
|
||||
# Debugs as 'tried to attack from an illegal angle'
|
||||
angle:
|
||||
@@ -189,7 +177,6 @@ killaura:
|
||||
maxDifference: 50
|
||||
# Amount of illegally angled hits before flagging
|
||||
vlBeforeFlag: 3
|
||||
|
||||
# Checks if the player has a suspicious packet order
|
||||
# Debugs as 'suspicious packet order'
|
||||
packetOrder:
|
||||
@@ -201,7 +188,6 @@ killaura:
|
||||
minElapsedTime: 5
|
||||
# Amount of suspicious combat packet situations before flagging
|
||||
vlBeforeFlag: 3
|
||||
|
||||
# Aimbot check settings
|
||||
# Checks if the player is sending aimbot-like movements
|
||||
aimbot:
|
||||
@@ -211,13 +197,11 @@ aimbot:
|
||||
minYaw: 30
|
||||
# Maximum yaw difference when repeated
|
||||
maxYaw: 355
|
||||
|
||||
# Criticals check settings
|
||||
# Checks if the player tries to do a crit without needed conditions
|
||||
criticals:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
|
||||
# Velocity check settings
|
||||
# Checks if the player ignores knockback
|
||||
velocity:
|
||||
@@ -227,7 +211,6 @@ velocity:
|
||||
minimumPercentage: 75
|
||||
# Amount of low-velocity moments before flagging
|
||||
vlBeforeFlag: 2
|
||||
|
||||
# FastPlace check settings
|
||||
# Checks if the player places blocks too fast
|
||||
fastplace:
|
||||
@@ -236,12 +219,11 @@ fastplace:
|
||||
# Minimum time in milliseconds between block places
|
||||
minimumTime: 50
|
||||
# Amount of fastplace-moments before flagging a survival player
|
||||
vlBeforeFlagSurvival: 2
|
||||
vlBeforeFlagSurvival: 3
|
||||
# Amount of fastplace-moments before flagging a creative player
|
||||
vlBeforeFlagCreative: 3
|
||||
vlBeforeFlagCreative: 4
|
||||
# Amount of time in milliseconds to prevent a player from placing blocks after flagging
|
||||
blockPlacementTime: 1000
|
||||
|
||||
# IllegalInteract check settings
|
||||
# Checks if the player is using, placing or breaking blocks from illegal angles
|
||||
illegalinteract:
|
||||
@@ -270,7 +252,6 @@ illegalinteract:
|
||||
pingCompensation: 0.0045
|
||||
# The multiplier of extra compensation for velocity
|
||||
velocityMultiplier: 1.5
|
||||
|
||||
# BadPackets check settings
|
||||
# Checks for illegal packets
|
||||
badpackets:
|
||||
@@ -280,7 +261,6 @@ badpackets:
|
||||
minimumTps: 17.5
|
||||
# Maximum distance a player can move between packets
|
||||
maxDistance: 25.0
|
||||
|
||||
# MorePackets check settings
|
||||
# Checks for an extra amount of packets and modified game timers
|
||||
morepackets:
|
||||
@@ -289,18 +269,17 @@ morepackets:
|
||||
# Minimum server TPS needed for MorePackets to be active
|
||||
minimumTps: 17.5
|
||||
# Maximum amount of lag compensation a player can acquire (50ms = 1 tick)
|
||||
minimumClamp: 500
|
||||
minimumClamp: 1000
|
||||
# The amount of milliseconds offset between packets before flagging (50ms = 1 tick)
|
||||
triggerBalance: 100
|
||||
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||
teleportCompensation: 150
|
||||
teleportCompensation: 300
|
||||
# Should MorePackets be disabled for 'lagging' players?
|
||||
# This can easily be spoofed by clients!
|
||||
disableForLagging: false
|
||||
# Maximum ping value before MorePackets stops checking a player (-1 to disable)
|
||||
# This can easily be spoofed by clients!
|
||||
maxPing: -1
|
||||
|
||||
# Sneak check settings
|
||||
# Checks if the player toggles sneak too fast
|
||||
sneak:
|
||||
@@ -310,10 +289,9 @@ sneak:
|
||||
# This can easily be spoofed by clients!
|
||||
disableForLagging: false
|
||||
# Minimum server TPS needed for sneak
|
||||
minimumTps: 12
|
||||
minimumTps: 15
|
||||
# Minimum time in milliseconds between sneak toggles
|
||||
minToggleTime: 75
|
||||
|
||||
# NoSlow check settings
|
||||
# Checks if the player moves too fast while blocking
|
||||
noslow:
|
||||
@@ -325,13 +303,11 @@ noslow:
|
||||
minimumDistXZ: 0.15
|
||||
# Amount of no slowdown moments before flagging
|
||||
vlBeforeFlag: 3
|
||||
|
||||
# Spider check settings
|
||||
# Checks if the player tries to climb a non-climbable block
|
||||
spider:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
|
||||
# NoFall check settings
|
||||
# Checks if the player tries to ignore fall damage
|
||||
nofall:
|
||||
@@ -339,7 +315,6 @@ nofall:
|
||||
enabled: true
|
||||
# Amount of moves with a modified fall distance before flagging
|
||||
vlBeforeFlag: 6
|
||||
|
||||
# Sprint check settings
|
||||
# Checks if the player tries to sprint without the needed conditions
|
||||
sprint:
|
||||
@@ -347,7 +322,6 @@ sprint:
|
||||
enabled: true
|
||||
# Minimum food level needed to sprint
|
||||
sprintFoodMin: 6
|
||||
|
||||
# FastBow check settings
|
||||
# Checks if the player fires a bow too fast
|
||||
fastbow:
|
||||
@@ -355,7 +329,6 @@ fastbow:
|
||||
enabled: true
|
||||
# Maximum percent error between predicted bow force and actual bow force
|
||||
bowError: 0.25
|
||||
|
||||
# FastEat check settings
|
||||
# Checks if the player consumes food too fast
|
||||
fasteat:
|
||||
@@ -363,7 +336,6 @@ fasteat:
|
||||
enabled: true
|
||||
# Minimum time in milliseconds it takes to consume food
|
||||
eatTimeMin: 1000
|
||||
|
||||
# FastHeal check settings
|
||||
# Checks if the player regains health too fast
|
||||
fastheal:
|
||||
@@ -375,10 +347,10 @@ fastheal:
|
||||
# This can easily be spoofed by clients!
|
||||
disableForLagging: false
|
||||
# The minimum time it takes to regenerate health in milliseconds
|
||||
minHealTime: 495
|
||||
# Vanilla is 500, but enforcing this will cause too many false positives
|
||||
minHealTime: 475
|
||||
# Amount of milliseconds a player can heal faster per millisecond of ping
|
||||
pingCompensation: 0.15
|
||||
|
||||
pingCompensation: 0.25
|
||||
# FastProjectile check settings
|
||||
# Checks if the player fires a projectile too fast
|
||||
fastprojectile:
|
||||
@@ -388,7 +360,6 @@ fastprojectile:
|
||||
projectilesToWait: 10
|
||||
# The minimum time in milliseconds it should have taken for the player fire 'projectilesToWait' projectiles
|
||||
minimumTime: 1500
|
||||
|
||||
# ItemSpam check settings
|
||||
# Checks if the player drops items too fast
|
||||
itemspam:
|
||||
@@ -398,7 +369,6 @@ itemspam:
|
||||
dropsToWait: 10
|
||||
# The minimum time in milliseconds it should have taken for the player to drop items 'dropsToWait' times
|
||||
minimumTime: 800
|
||||
|
||||
# FastInventory check settings
|
||||
# Checks if the player moves items in the inventory too fast
|
||||
fastinventory:
|
||||
@@ -408,19 +378,16 @@ fastinventory:
|
||||
clicksToWait: 10
|
||||
# The minimum time in milliseconds it should have taken for the player to click 'clicksToWait' times
|
||||
minimumTime: 50
|
||||
|
||||
# vClip check settings
|
||||
# Checks if the player is clipping
|
||||
vclip:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
|
||||
# ChatUnicode check settings
|
||||
# Checks for illegal unicode characters in the chat
|
||||
chatunicode:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
|
||||
# ChatSpam check settings
|
||||
# Checks for a spam of chat messages
|
||||
chatspam:
|
||||
@@ -434,17 +401,16 @@ chatspam:
|
||||
levelActionOne: 5
|
||||
# Number of chat spam violations before action two (see config.yml) is executed
|
||||
levelActionTwo: 10
|
||||
|
||||
# CommandSpam check settings
|
||||
# Checks for a spam of commands
|
||||
commandspam:
|
||||
# Should this check be enabled?
|
||||
enabled: true
|
||||
# Minimum time between commands
|
||||
timeMin: 400
|
||||
timeMin: 250
|
||||
# Time in milliseconds after which repeating a command is ignored
|
||||
repeatIgnore: 500
|
||||
# Number of command spam violations before action one (see config.yml) is executed
|
||||
levelActionOne: 5
|
||||
# Number of command spam violations before action two (see config.yml) is executed
|
||||
levelActionTwo: 10
|
||||
levelActionTwo: 10
|
||||
Reference in new issue
Block a user