mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
610d53550f | ||
|
|
db9aa97ca1 | ||
|
|
992c67d894 | ||
|
|
12c85b3939 | ||
|
|
37d580a4ba | ||
|
|
f94a430d41 | ||
|
|
918549bc11 | ||
|
|
c6e4ce091a | ||
|
|
7d13aae057 | ||
|
|
3538b8934c | ||
|
|
b2701fa057 | ||
|
|
8cf2702708 | ||
|
|
cd3184f17b | ||
|
|
9078846511 | ||
|
|
50247f28c9 | ||
|
|
cc51e9307f |
No files matched your search
@@ -23,6 +23,7 @@ Hacks blocked
|
||||
-------
|
||||
* Flight
|
||||
* Glide
|
||||
* FastLadder
|
||||
* Jesus
|
||||
* Step
|
||||
* Criticals
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<version>1.8.2-PRE</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||
<properties>
|
||||
|
||||
@@ -64,6 +64,7 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
private static UpdateManager updateManager;
|
||||
|
||||
private double tps = -1;
|
||||
private String symbiosisMetric = "None";
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -109,32 +110,44 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
verboseLog("Finished loading.");
|
||||
|
||||
// Metrics
|
||||
try {
|
||||
Metrics metrics = new Metrics(this, 202);
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
int kicked = playersKicked;
|
||||
// Reset so we don't keep sending the same value
|
||||
playersKicked = 0;
|
||||
return kicked;
|
||||
getServer().getScheduler().runTaskLater(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkForSymbiosis();
|
||||
try {
|
||||
Metrics metrics = new Metrics(AntiCheatReloaded.this, 202);
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
int kicked = playersKicked;
|
||||
// Reset so we don't keep sending the same value
|
||||
playersKicked = 0;
|
||||
return kicked;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return VersionUtil.getVersion();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("symbiosis", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return symbiosisMetric;
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return VersionUtil.getVersion();
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 90L);
|
||||
|
||||
// Launch TPS check
|
||||
new BukkitRunnable() {
|
||||
@@ -153,8 +166,6 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(this, 40L, 1L);
|
||||
// Launch MorePackets timer
|
||||
MorePacketsCheck.startTimer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,6 +280,49 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
this.playersKicked++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates metric that checks for anti-cheat symbiosis
|
||||
* I use this to see if AntiCheatReloaded is actively being used
|
||||
* together with other anti-cheats, so I can account for that.
|
||||
*/
|
||||
protected void checkForSymbiosis() {
|
||||
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "NoCheatPlus";
|
||||
} else {
|
||||
this.symbiosisMetric += ", NoCheatPlus";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Matrix") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "Matrix";
|
||||
} else {
|
||||
this.symbiosisMetric += ", Matrix";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "AAC";
|
||||
} else {
|
||||
this.symbiosisMetric += ", AAC";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "Spartan";
|
||||
} else {
|
||||
this.symbiosisMetric += ", Spartan";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Negativity") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "Negativity";
|
||||
} else {
|
||||
this.symbiosisMetric += ", Negativity";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendToMainThread(Runnable runnable) {
|
||||
Bukkit.getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
||||
}
|
||||
@@ -281,7 +335,6 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
});
|
||||
Bukkit.getConsoleSender().sendMessage(message);
|
||||
}
|
||||
|
||||
public static UpdateManager getUpdateManager() {
|
||||
|
||||
@@ -62,5 +62,9 @@ public class CheckFailEvent extends Event {
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,13 +30,17 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
@@ -86,6 +90,7 @@ public class Backend {
|
||||
private HashSet<Byte> transparent = new HashSet<Byte>();
|
||||
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
|
||||
private Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
|
||||
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
||||
|
||||
private Magic magic;
|
||||
private AntiCheatManager manager = null;
|
||||
@@ -152,16 +157,18 @@ public class Backend {
|
||||
inventoryClicks.remove(uuid);
|
||||
lastFallPacket.remove(uuid);
|
||||
fastSneakViolations.remove(uuid);
|
||||
lastSneak.remove(uuid);
|
||||
AimbotCheck.LAST_DELTA_YAW.remove(uuid);
|
||||
VelocityCheck.VIOLATIONS.remove(uuid);
|
||||
MorePacketsCheck.MOVE_COUNT.remove(uuid);
|
||||
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
||||
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
||||
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
||||
GlideCheck.LAST_MOTION_Y.remove(uuid);
|
||||
GlideCheck.LAST_FALL_DISTANCE.remove(uuid);
|
||||
GlideCheck.VIOLATIONS.remove(uuid);
|
||||
SpeedCheck.SPEED_VIOLATIONS.remove(uuid);
|
||||
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
||||
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
||||
KillAuraCheck.PITCH_MOVEMENTS_CACHE.remove(uuid);
|
||||
KillAuraCheck.GCD_CACHE.remove(uuid);
|
||||
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
||||
FlightCheck.ASCENSION_COUNT.remove(uuid);
|
||||
FlightCheck.BLOCKS_OVER_FLIGHT.remove(uuid);
|
||||
@@ -269,24 +276,12 @@ public class Backend {
|
||||
}
|
||||
}
|
||||
|
||||
public CheckResult checkYSpeed(Player player, double y) {
|
||||
if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && (y > magic.Y_SPEED_MAX())
|
||||
&& !isDoing(player, velocitized, magic.VELOCITY_TIME())
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)
|
||||
&& !Utilities.isSlime(player.getLocation().getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
}
|
||||
|
||||
public CheckResult checkNoFall(Player player, double y) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isInWater(player)
|
||||
&& !Utilities.isInWeb(player)
|
||||
&& !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")) {
|
||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||
&& !VersionUtil.isSlowFalling(player)) {
|
||||
if (player.getFallDistance() == 0) {
|
||||
if (nofallViolation.get(uuid) == null) {
|
||||
nofallViolation.put(uuid, 1);
|
||||
@@ -312,19 +307,20 @@ public class Backend {
|
||||
|
||||
public CheckResult checkSneak(Player player, Location location, double x, double z) {
|
||||
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()
|
||||
&& !Utilities.cantStandAtExp(location)) {
|
||||
&& !Utilities.cantStandAtExp(location) && !Utilities.isSlab(location.getBlock().getRelative(BlockFace.DOWN))) {
|
||||
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
|
||||
if (i != -1) {
|
||||
if (this.fastSneakViolations.containsKey(player.getUniqueId())) {
|
||||
int flags = this.fastSneakViolations.get(player.getUniqueId());
|
||||
if (flags >= 3) { // TODO possible config
|
||||
this.fastSneakViolations.put(player.getUniqueId(), flags - 1);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
|
||||
}
|
||||
this.fastSneakViolations.put(player.getUniqueId(), flags + 1);
|
||||
return PASS;
|
||||
} else {
|
||||
this.fastSneakViolations.put(player.getUniqueId(), 1);
|
||||
this.fastSneakViolations.put(player.getUniqueId(), 0);
|
||||
return PASS;
|
||||
}
|
||||
} else {
|
||||
@@ -337,6 +333,21 @@ public class Backend {
|
||||
}
|
||||
}
|
||||
|
||||
public CheckResult checkSneakToggle(Player player) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
||||
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
||||
if (System.currentTimeMillis() - lastSneak < 75 && (AntiCheatReloaded.getPlugin().getTPS() > 12
|
||||
&& !user.isLagging())) {
|
||||
if (!this.silentMode()) {
|
||||
player.teleport(user.getGoodLocation(player.getLocation()));
|
||||
}
|
||||
return new CheckResult(Result.FAILED,
|
||||
"toggled sneak too fast (time=" + (System.currentTimeMillis() - lastSneak) + ")");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE
|
||||
@@ -633,9 +644,15 @@ public class Backend {
|
||||
}
|
||||
|
||||
public CheckResult checkFastHeal(Player player) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||
{
|
||||
long healTime = magic.MIN_HEAL_TIME();
|
||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||
if (tps < 17.5
|
||||
|| user.isLagging()) {
|
||||
return PASS;
|
||||
}
|
||||
long healTime = magic.MIN_HEAL_TIME() - (tps >= 18.5 ? 0 : 50);
|
||||
long l = lastHeal.get(player.getUniqueId());
|
||||
lastHeal.remove(player.getUniqueId());
|
||||
if ((System.currentTimeMillis() - l) < healTime) {
|
||||
@@ -647,8 +664,13 @@ public class Backend {
|
||||
}
|
||||
|
||||
public CheckResult checkFastEat(Player player) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||
{
|
||||
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5
|
||||
|| user.isLagging()) {
|
||||
return PASS;
|
||||
}
|
||||
long l = startEat.get(player.getUniqueId());
|
||||
startEat.remove(player.getUniqueId());
|
||||
if ((System.currentTimeMillis() - l) < magic.EAT_TIME_MIN()) {
|
||||
@@ -776,9 +798,15 @@ public class Backend {
|
||||
public void logExitFly(final Player player) {
|
||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
||||
}
|
||||
|
||||
public void logBoatCollision(final Player player) {
|
||||
// TODO config
|
||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
||||
}
|
||||
|
||||
public void logJoin(final Player player) {
|
||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.JOIN_TIME());
|
||||
MorePacketsCheck.EXEMPT_TIMINGS.put(player.getUniqueId(), System.currentTimeMillis() + magic.JOIN_TIME());
|
||||
}
|
||||
|
||||
public boolean isMovingExempt(Player player) {
|
||||
|
||||
@@ -64,7 +64,9 @@ public enum CheckType {
|
||||
VELOCITY(Permission.CHECK_VELOCITY),
|
||||
CRITICALS(Permission.CHECK_CRITICALS),
|
||||
CHAT_UNICODE(Permission.CHECK_UNICODE),
|
||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGAL_INTERACT);
|
||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT),
|
||||
FASTLADDER(Permission.CHECK_FASTLADDER),
|
||||
AIMBOT(Permission.CHECK_AIMBOT);
|
||||
|
||||
private final Permission permission;
|
||||
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -29,21 +27,15 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class KillAuraCheck {
|
||||
|
||||
// Angle check
|
||||
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
||||
// Aimbot check
|
||||
public static final Map<UUID, List<Float>> PITCH_MOVEMENTS_CACHE = new HashMap<UUID, List<Float>>();
|
||||
public static final Map<UUID, Float> GCD_CACHE = new HashMap<UUID, Float>();
|
||||
// Not used as of now, code not committed yet
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
||||
@@ -74,43 +66,6 @@ public class KillAuraCheck {
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check idea by Hawk AntiCheat (https://github.com/HawkAnticheat/Hawk)
|
||||
*/
|
||||
public static CheckResult checkAimbot(Player player, PlayerMoveEvent event) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
float pitchMovement = event.getTo().getPitch() - event.getFrom().getPitch();
|
||||
if (!PITCH_MOVEMENTS_CACHE.containsKey(uuid)) {
|
||||
PITCH_MOVEMENTS_CACHE.put(uuid, new ArrayList<Float>());
|
||||
return PASS;
|
||||
}
|
||||
List<Float> pitchMovements = PITCH_MOVEMENTS_CACHE.get(uuid);
|
||||
if (pitchMovement != 0 && Math.abs(pitchMovement) <= 10 && Math.abs(event.getTo().getPitch()) != 90) {
|
||||
pitchMovements.add(Math.abs(pitchMovement));
|
||||
}
|
||||
|
||||
if (pitchMovements.size() >= 20) {
|
||||
float greatestCommonDivisor = Utilities.gcdRational(pitchMovements);
|
||||
if (!GCD_CACHE.containsKey(uuid)) {
|
||||
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||
}
|
||||
|
||||
float divisorDifference = Math.abs(greatestCommonDivisor - GCD_CACHE.get(uuid));
|
||||
if (divisorDifference > 0.00425 || greatestCommonDivisor < 0.00001) {
|
||||
pitchMovements.clear();
|
||||
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||
return new CheckResult(CheckResult.Result.FAILED, "performed aimbot-like movements (divisor-diff=" + divisorDifference + ")");
|
||||
}
|
||||
pitchMovements.clear();
|
||||
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||
}
|
||||
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
|
||||
public static double calculateYawDifference(Location from, Location to) {
|
||||
Location clonedFrom = from.clone();
|
||||
|
||||
@@ -33,6 +33,9 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
/*
|
||||
* TODO improve
|
||||
*/
|
||||
public class VelocityCheck {
|
||||
|
||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
|
||||
public class AimbotCheck {
|
||||
|
||||
public static final Map<UUID, Float> LAST_DELTA_YAW = new HashMap<UUID, Float>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (backend.isMovingExempt(player)) {
|
||||
return PASS;
|
||||
}
|
||||
UUID uuid = player.getUniqueId();
|
||||
float dYaw = Math.abs(event.getTo().getYaw() - event.getFrom().getYaw());
|
||||
float dPitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
||||
// Not interesting
|
||||
if (dYaw < 0.05 && dPitch < 0.05) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
final float lastDeltaYaw = LAST_DELTA_YAW.getOrDefault(uuid, -1F);
|
||||
if (lastDeltaYaw == -1F) {
|
||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
||||
return PASS;
|
||||
}
|
||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
||||
|
||||
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
||||
if (absoluteYawDifference < 1E-8 && dYaw > 30 && dYaw < 355) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class FastLadderCheck {
|
||||
|
||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, double y) {
|
||||
Magic magic = AntiCheatReloaded.getManager().getBackend().getMagic();
|
||||
// Only check if fully on ladder
|
||||
// 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()) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
int vlCount = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||
if (y > 0) {
|
||||
// Check moving up
|
||||
double max = magic.LADDER_Y_MAX();
|
||||
// Check if going faster than max Y climbing speed
|
||||
if (y - max > 0) {
|
||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
||||
vlCount = 0;
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to climb up too fast (speed=" + y + ", max=" + max + ")");
|
||||
}
|
||||
} else {
|
||||
if (vlCount > 0)
|
||||
vlCount--;
|
||||
}
|
||||
} else if (y < 0) {
|
||||
// Check moving down
|
||||
if (Math.abs(y) > magic.LADDER_DOWN_MAX() + 6E-9) {
|
||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
||||
vlCount = 0;
|
||||
return new CheckResult(Result.FAILED, "tried to climb down too fast (speed=" + Math.abs(y)
|
||||
+ ", max=" + magic.LADDER_DOWN_MAX() + ")");
|
||||
}
|
||||
} else {
|
||||
if (vlCount > 0)
|
||||
vlCount--;
|
||||
}
|
||||
} else {
|
||||
if (vlCount > 0)
|
||||
vlCount--;
|
||||
}
|
||||
|
||||
VIOLATIONS.put(player.getUniqueId(), vlCount);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -61,7 +60,8 @@ public class FlightCheck {
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Utilities.IRON_BARS })
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new String[] { "FENCE", "FENCE_GATE" })) {
|
||||
new String[] { "FENCE", "FENCE_GATE" })
|
||||
&& !Utilities.couldBeOnBoat(player)) {
|
||||
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
|
||||
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
||||
}
|
||||
@@ -94,13 +94,14 @@ public class FlightCheck {
|
||||
string = " with jump potion";
|
||||
}
|
||||
Block block = player.getLocation().getBlock();
|
||||
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
|
||||
if (!isMovingExempt(player) && !Utilities.isNearWater(player) && !VersionUtil.isFlying(player)
|
||||
&& !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
|
||||
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
|
||||
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
|
||||
// TODO isMoveUpBlock does not seem to be a success with stairs
|
||||
// I suddenly could not replicate this, man this check is a mess
|
||||
if (y1 < y2) {
|
||||
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
|
||||
&& !block.getRelative(BlockFace.EAST).isLiquid()
|
||||
|
||||
@@ -32,13 +32,13 @@ import org.bukkit.entity.Player;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class GlideCheck {
|
||||
|
||||
public static final Map<UUID, Double> LAST_MOTION_Y = new HashMap<UUID, Double>();
|
||||
public static final Map<UUID, Float> LAST_FALL_DISTANCE = new HashMap<UUID, Float>();
|
||||
public static final Map<UUID, Integer> AIR_TICKS = new HashMap<UUID, Integer>();
|
||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
@@ -48,18 +48,22 @@ public class GlideCheck {
|
||||
VIOLATIONS.put(player.getUniqueId(), 0);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
if (player.getLocation().getBlock().getType() == Material.LADDER
|
||||
|| player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
if (!LAST_MOTION_Y.containsKey(player.getUniqueId())) {
|
||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
||||
return PASS;
|
||||
}
|
||||
|
||||
if (!LAST_FALL_DISTANCE.containsKey(player.getUniqueId())) {
|
||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
||||
return PASS;
|
||||
}
|
||||
|
||||
int violations = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||
double motionY = distance.getYDifference();
|
||||
float fallDistance = player.getFallDistance();
|
||||
@@ -80,34 +84,7 @@ public class GlideCheck {
|
||||
return PASS;
|
||||
}
|
||||
} else {
|
||||
if (fallDistance > LAST_FALL_DISTANCE.get(player.getUniqueId()) && !player.isOnGround()
|
||||
&& Utilities.isNotNearSlime(distance.getTo().getBlock()) && fallDistance < 1.5
|
||||
&& !Utilities.isClimbableBlock(distance.getTo().getBlock()) && !player.isSneaking()
|
||||
&& !AntiCheatReloaded.getManager().getBackend().isEating(player)) {
|
||||
// TODO that fallDistance check is a horrible way to prevent a certain false
|
||||
// positive
|
||||
// Needs to be fixed since this only works for slight above ground movements
|
||||
float predicted = calculateNextMotionY(LAST_MOTION_Y.get(player.getUniqueId()).floatValue());
|
||||
float actual = Double.valueOf(motionY).floatValue();
|
||||
float scaledDifference = Math.abs((predicted - actual) + 0.1568f);
|
||||
if (scaledDifference > 3E-8) {
|
||||
if (violations + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()
|
||||
&& !Utilities.canStand(distance.getTo().getBlock())) {
|
||||
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||
Location prev = player.getLocation().clone();
|
||||
prev.setY(prev.getY() - distanceToFall(prev));
|
||||
player.teleport(AntiCheatReloaded.getManager().getUserManager()
|
||||
.getUser(player.getUniqueId()).getGoodLocation(prev));
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED, "type=gravity, offset="
|
||||
+ new BigDecimal(scaledDifference).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||
} else {
|
||||
VIOLATIONS.put(player.getUniqueId(), violations + 1);
|
||||
return PASS;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO redo this
|
||||
}
|
||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
||||
@@ -117,10 +94,6 @@ public class GlideCheck {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private static float calculateNextMotionY(float motionY) {
|
||||
return (motionY - 0.08f) * 0.98f;
|
||||
}
|
||||
|
||||
private static double distanceToFall(Location location) {
|
||||
location = location.clone();
|
||||
double highestY = location.getWorld().getHighestBlockYAt(location) + 1.02D;
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
@@ -114,16 +115,19 @@ public class SpeedCheck {
|
||||
}
|
||||
}
|
||||
|
||||
public CheckResult checkYSpeed(Player player, double y) {
|
||||
public static CheckResult checkYSpeed(Player player, Distance distance) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (!backend.isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping()
|
||||
&& (y > backend.getMagic().Y_SPEED_MAX())
|
||||
&& (distance.getYDifference() > backend.getMagic().Y_SPEED_MAX())
|
||||
&& !backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_TIME())
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)
|
||||
&& !VersionUtil.isRiptiding(player)
|
||||
&& !Utilities.isNearBed(distance.getTo())
|
||||
&& !Utilities.isSlime(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getGoodLocation(player.getLocation()).getBlock())) {
|
||||
.getGoodLocation(player.getLocation()).getBlock())
|
||||
&& !Utilities.couldBeOnBoat(player)) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"y speed was too high (speed=" + y + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
||||
"y speed was too high (speed=" + distance.getYDifference() + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -31,16 +31,17 @@ import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
public class BadPacketsCheck {
|
||||
|
||||
public static void runCheck(Player player, PacketEvent event) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|
||||
|| backend.isMovingExempt(player)) {
|
||||
// Confirm if we should even check for BadPackets
|
||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS) || backend.isMovingExempt(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
PacketContainer packet = event.getPacket();
|
||||
float pitch = packet.getFloat().read(1);
|
||||
// Check for derp
|
||||
@@ -50,7 +51,8 @@ public class BadPacketsCheck {
|
||||
}
|
||||
|
||||
// TODO more precise checking for this
|
||||
if (AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).isLagging()) {
|
||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||
if (user.isLagging() || tps < 18) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
/**
|
||||
@@ -38,16 +37,9 @@ import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
*/
|
||||
public class MorePacketsCheck {
|
||||
|
||||
public static final Map<UUID, Integer> MOVE_COUNT = new HashMap<UUID, Integer>();
|
||||
|
||||
public static void startTimer() {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MOVE_COUNT.clear();
|
||||
}
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
||||
}
|
||||
public static final Map<UUID, Long> LAST_PACKET_TIME = new HashMap<UUID, Long>();
|
||||
public static final Map<UUID, Long> EXEMPT_TIMINGS = new HashMap<UUID, Long>();
|
||||
public static final Map<UUID, Double> PACKET_BALANCE = new HashMap<UUID, Double>();
|
||||
|
||||
public static void runCheck(Player player, PacketEvent event) {
|
||||
// Confirm if we should even check for MorePackets
|
||||
@@ -56,50 +48,50 @@ public class MorePacketsCheck {
|
||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS) || tps < 15) {
|
||||
return;
|
||||
}
|
||||
Location currentLocation = event.getPlayer().getLocation();
|
||||
if (!MOVE_COUNT.containsKey(player.getUniqueId())) {
|
||||
MOVE_COUNT.put(player.getUniqueId(), 1);
|
||||
} else {
|
||||
MOVE_COUNT.put(player.getUniqueId(), MOVE_COUNT.get(player.getUniqueId()) + 1);
|
||||
int ping = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).getPing();
|
||||
int limit = AntiCheatReloaded.getManager().getBackend().getMagic().MOREPACKETS_LIMIT();
|
||||
int averagePing = AntiCheatReloaded.getManager().getBackend().getMagic().MOREPACKETS_AVERAGE_PING();
|
||||
float pingLeniency = (float) ((ping / averagePing));
|
||||
if (pingLeniency < 1)
|
||||
pingLeniency = 1;
|
||||
if (pingLeniency > 2)
|
||||
pingLeniency = 2;
|
||||
float tpsLeniency = (float) ((19 / tps));
|
||||
if (tps > 19) {
|
||||
tpsLeniency = 1;
|
||||
}
|
||||
float leniency = pingLeniency * tpsLeniency;
|
||||
limit = Math.round(leniency * limit);
|
||||
final float finalLeniency = leniency;
|
||||
try {
|
||||
if (MOVE_COUNT.get(player.getUniqueId()) > limit) {
|
||||
final int packets = MOVE_COUNT.get(player.getUniqueId());
|
||||
MOVE_COUNT.remove(player.getUniqueId());
|
||||
event.setCancelled(true);
|
||||
// We are currently not in the main server thread, so switch
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener
|
||||
.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
"sent " + packets + " packets in one second (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.MOREPACKETS_LIMIT()
|
||||
+ ", leniency=" + finalLeniency + ")").getMessage(),
|
||||
player, CheckType.MOREPACKETS);
|
||||
player.teleport(currentLocation);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (NullPointerException nullPointer) {
|
||||
// TODO this is thrown sometimes, might have something to do with line 83
|
||||
}
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)) {
|
||||
return;
|
||||
}
|
||||
long packetTimeNow = System.currentTimeMillis();
|
||||
long lastPacketTime = LAST_PACKET_TIME.getOrDefault(uuid, packetTimeNow - 50L);
|
||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||
|
||||
long rate = packetTimeNow - lastPacketTime;
|
||||
packetBalance += 50;
|
||||
packetBalance -= rate;
|
||||
if (packetBalance >= magic.MOREPACKETS_TRIGGER_BALANCE()) {
|
||||
int ticks = (int) Math.round(packetBalance / 50);
|
||||
packetBalance = -1 * (magic.MOREPACKETS_TRIGGER_BALANCE() / 2);
|
||||
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
||||
} else if (packetBalance < -1 * (magic.MOREPACKETS_MINIMUM_CLAMP())) {
|
||||
// Clamp minimum, 50ms=1tick of lag leniency
|
||||
packetBalance = -1 * (magic.MOREPACKETS_MINIMUM_CLAMP());
|
||||
}
|
||||
|
||||
LAST_PACKET_TIME.put(uuid, packetTimeNow);
|
||||
PACKET_BALANCE.put(uuid, packetBalance);
|
||||
}
|
||||
|
||||
private static void flag(Player player, PacketEvent event, String message) {
|
||||
event.setCancelled(true);
|
||||
// We are currently not in the main server thread, so switch
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||
CheckType.MOREPACKETS);
|
||||
player.teleport(player.getLocation());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void compensate(Player player) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||
PACKET_BALANCE.put(uuid, packetBalance - magic.MOREPACKETS_TELEPORT_COMPENSATION());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,8 +32,8 @@ public class CommandMute extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheatReloaded Mute";
|
||||
private static final String COMMAND = "mute";
|
||||
private static final String USAGE = "anticheat reload";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
|
||||
private static final String USAGE = "anticheat mute";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_MUTE;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/anticheat mute" + GRAY + " to mute all notifications", };
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ public class CommandReport extends CommandBase {
|
||||
if (page <= pages && page > 0) {
|
||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
for (int x = 0; x < 6; x++) {
|
||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||
@@ -177,6 +178,7 @@ public class CommandReport extends CommandBase {
|
||||
if (pages == 0 && page == 1) {
|
||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||
cs.sendMessage(MENU_END);
|
||||
|
||||
@@ -50,6 +50,8 @@ public class Config extends ConfigurationFile {
|
||||
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
public ConfigValue<List<String>> disabledChecks;
|
||||
|
||||
public ConfigValue<Integer> notifyEveryVl;
|
||||
|
||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
@@ -80,5 +82,10 @@ public class Config extends ConfigurationFile {
|
||||
|
||||
disabledWorlds = new ConfigValue<List<String>>("disable-in");
|
||||
disabledChecks = new ConfigValue<List<String>>("disabled-checks");
|
||||
|
||||
notifyEveryVl = new ConfigValue<Integer>("system.notify-every-vl");
|
||||
if (notifyEveryVl.getValue() < 1) {
|
||||
notifyEveryVl.setValue(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,6 +282,10 @@ public interface Magic {
|
||||
* Minimum speed a player on a ladder can travel; Type=DOUBLE, Leniency=DECREASE.
|
||||
*/
|
||||
public double LADDER_Y_MIN();
|
||||
/**
|
||||
* Maximum speed a player on a ladder can travel downwards
|
||||
*/
|
||||
public double LADDER_DOWN_MAX();
|
||||
/**
|
||||
* Maximum speed a player can travel up; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
@@ -355,13 +359,17 @@ public interface Magic {
|
||||
*/
|
||||
public int TELEPORT_MIN();
|
||||
/**
|
||||
* Maximum amount of packets a player can send in a second; Type=INTEGER, Leniency=INCREASE.
|
||||
* The amount of milliseconds to compensate for a teleport; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int MOREPACKETS_LIMIT();
|
||||
public int MOREPACKETS_TELEPORT_COMPENSATION();
|
||||
/**
|
||||
* The average ping settings used to account for lag; TYPE=INTEGER, Leniency=INCREASE
|
||||
* The amount of milliseconds that were offset to flag for MorePackets; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int MOREPACKETS_AVERAGE_PING();
|
||||
public int MOREPACKETS_TRIGGER_BALANCE();
|
||||
/**
|
||||
* The maximum amount of overall lag compensating in milliseconds; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int MOREPACKETS_MINIMUM_CLAMP();
|
||||
/**
|
||||
* Maximum amount of low/zero velocity moments before flagging; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
@@ -374,10 +382,6 @@ public interface Magic {
|
||||
* The maximum amount of violations before flagging player as a cheater; TYPE=INTEGER, Leniency=INCREASE
|
||||
*/
|
||||
public int KILLAURA_MAX_ANGLE_VIOLATIONS();
|
||||
/**
|
||||
* The minimum score difference for the fight speed check to consider a player legit; TYPE=INTEGER, Leniency=DECREASE
|
||||
*/
|
||||
public int KILLAURA_FIGHTSPEED_MINDIFF();
|
||||
/**
|
||||
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
||||
*/
|
||||
@@ -390,4 +394,12 @@ public interface Magic {
|
||||
* Maximum distance allowed between two movement packets; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
public double BADPACKETS_MAX_DISTANCE();
|
||||
/**
|
||||
* Maximum amount of fastladder movements before flagging; TYPE=INTEGER, Leniency=INCREASE
|
||||
*/
|
||||
public int FASTLADDER_MAX_FLAGS();
|
||||
/**
|
||||
* The change milliseconds between two keepalives before considering a player to be lagging; TYPE=INTEGER, Leniency=DECREASE
|
||||
*/
|
||||
public int LAG_DETERMINATION();
|
||||
}
|
||||
@@ -50,27 +50,47 @@ public class EventListener implements Listener {
|
||||
|
||||
public static void log(String message, Player player, CheckType type) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
|
||||
int vlForType = type.getUses(player.getUniqueId()) + 1;
|
||||
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
|
||||
if (message == null || message.equals("")) {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type);
|
||||
if (debugMode) {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type);
|
||||
} else {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.GOLD + " (x" + vlForType + ")";
|
||||
}
|
||||
} else {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
}
|
||||
if (user != null) { // npc
|
||||
logCheat(type, user);
|
||||
if (user.increaseLevel(type)) {
|
||||
AntiCheatReloaded.getManager().log(message);
|
||||
if (debugMode) {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
} else {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.GOLD + " (x" + vlForType + ")" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
}
|
||||
removeDecrease(user);
|
||||
}
|
||||
|
||||
logCheat(type, user);
|
||||
if (user.increaseLevel(type) && (!debugMode && vlForType % notifyEveryVl == 0)) {
|
||||
AntiCheatReloaded.getManager().log(message);
|
||||
}
|
||||
removeDecrease(user);
|
||||
|
||||
if (CONFIG.getConfig().debugMode.getValue()) {
|
||||
if (debugMode) {
|
||||
player.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vlForType % notifyEveryVl == 0) {
|
||||
AntiCheatReloaded.getPlugin().sendToStaff(message);
|
||||
}
|
||||
AntiCheatReloaded.getPlugin().sendToStaff(message);
|
||||
}
|
||||
|
||||
private static void logCheat(CheckType type, User user) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -50,6 +51,8 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@@ -57,8 +60,9 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||
@@ -146,8 +150,16 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.isSneaking()) {
|
||||
getBackend().logToggleSneak(event.getPlayer());
|
||||
if (getCheckManager().willCheck(player, CheckType.SNEAK)) {
|
||||
CheckResult result = getBackend().checkSneakToggle(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.SNEAK);
|
||||
}
|
||||
}
|
||||
// getBackend().logToggleSneak(event.getPlayer());
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
@@ -222,6 +234,15 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerVehicleCollide(VehicleEntityCollisionEvent event) {
|
||||
if (!(event.getVehicle() instanceof Boat) || !(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = (Player) event.getEntity();
|
||||
getBackend().logBoatCollision(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||
@@ -388,7 +409,7 @@ public class PlayerListener extends EventListener {
|
||||
if (result.failed()) {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
/*TODO: player.damage(1); better system for this, too exploitable*/
|
||||
// TODO better handling of this
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.NOFALL);
|
||||
}
|
||||
@@ -400,7 +421,7 @@ public class PlayerListener extends EventListener {
|
||||
double z = distance.getZDifference();
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||
if (event.getFrom().getY() < event.getTo().getY()) {
|
||||
CheckResult result = getBackend().checkYSpeed(player, y);
|
||||
CheckResult result = SpeedCheck.checkYSpeed(player, distance);
|
||||
if (result.failed()) {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
@@ -449,14 +470,25 @@ public class PlayerListener extends EventListener {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||
// Does not use y value created before because that value is absolute
|
||||
CheckResult result = FastLadderCheck.runCheck(player, event.getTo().getY() - event.getFrom().getY());
|
||||
if (result.failed()) {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (!changed) {
|
||||
user.setGoodLocation(event.getFrom());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkAimbot(player, event);
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||
if (result.failed()) {
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
log(result.getMessage(), player, CheckType.AIMBOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class LoggingManager {
|
||||
}
|
||||
|
||||
public void logToConsole(String message) {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + message);
|
||||
Bukkit.getConsoleSender().sendMessage(message);
|
||||
}
|
||||
|
||||
public void logToFile(String message) {
|
||||
|
||||
@@ -59,7 +59,6 @@ import com.google.gson.JsonPrimitive;
|
||||
* <p>
|
||||
* Check out https://bStats.org/ to learn more about bStats!
|
||||
*/
|
||||
@SuppressWarnings({ "unused" })
|
||||
public class Metrics {
|
||||
|
||||
static {
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* 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.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class NameGenerator {
|
||||
|
||||
private static final List<String> BEGIN = Arrays.asList(new String[] { "Pixel", "Pro", "NoHax", "Just", "That",
|
||||
"New", "Ultra", "Killer", "Swift", "Anarchy", "Yolo", "Rammel" });
|
||||
|
||||
private static final List<String> END = Arrays.asList(new String[] { "Gamer", "PvP", "JustYolo", "Gaming",
|
||||
"Minecraft", "Games", "Bawz", "Tech", "Noob", "Extra", "kast", "" + new Random().nextInt(100) });
|
||||
|
||||
public static String generateName() {
|
||||
Random r = new Random();
|
||||
String begin = BEGIN.get(r.nextInt(BEGIN.size() - 1));
|
||||
String end = END.get(r.nextInt(END.size() - 1));
|
||||
if (r.nextBoolean())
|
||||
return begin + end + r.nextInt(9);
|
||||
else
|
||||
return begin + end;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class PacketListener {
|
||||
public static void listenMovementPackets() {
|
||||
AntiCheatReloaded.getProtocolManager()
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK }) {
|
||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK}) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
@@ -46,6 +46,14 @@ public class PacketListener {
|
||||
BadPacketsCheck.runCheck(player, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Compensate for teleport
|
||||
MorePacketsCheck.compensate(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,13 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
public enum Permission {
|
||||
/* Check Nodes */
|
||||
CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||
CHECK_FLIGHT, CHECK_ELYTRAFLY, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER, CHECK_AIMBOT,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD;
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD, SYSTEM_MUTE;
|
||||
|
||||
private static final String PERMISSION_ALL = "anticheat.*";
|
||||
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
||||
|
||||
@@ -102,6 +102,8 @@ public class UpdateManager {
|
||||
public VersionSplit(String version) throws Exception {
|
||||
if (version.endsWith("-ALPHA")) {
|
||||
version = version.substring(0, version.length() - 6);
|
||||
} else if (version.endsWith("-PRE")) {
|
||||
version = version.substring(0, version.length() - 4);
|
||||
}
|
||||
|
||||
String[] versionSplit = version.split("\\.");
|
||||
|
||||
@@ -48,7 +48,7 @@ public class User {
|
||||
private Long[] messageTimes = new Long[2];
|
||||
private String[] commands = new String[2];
|
||||
private Long[] commandTimes = new Long[2];
|
||||
|
||||
|
||||
private boolean isWaitingOnLevelSync;
|
||||
private Timestamp levelSyncTimestamp;
|
||||
|
||||
@@ -450,11 +450,12 @@ public class User {
|
||||
}
|
||||
|
||||
public boolean isLagging() {
|
||||
return Math.abs(this.ping - this.lastPing) > 50;
|
||||
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User {name = " + getName() + ", level = " + level + "}";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,6 +31,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
@@ -121,6 +123,14 @@ public final class Utilities {
|
||||
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST)) && !isSlime(block.getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
public static boolean couldBeOnBoat(Player player) {
|
||||
for (Entity entity : player.getNearbyEntities(0.25, 0.25, 0.25)) {
|
||||
if (entity instanceof Boat)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is fully submerged in water
|
||||
*
|
||||
@@ -219,6 +229,29 @@ public final class Utilities {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("SLAB");
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is a bed
|
||||
*
|
||||
* @param block block to bed
|
||||
* @return true if bed
|
||||
*/
|
||||
public static boolean isBed(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("BED");
|
||||
}
|
||||
|
||||
public static boolean isNearBed(Location location) {
|
||||
return isBed(location.getBlock())
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.WEST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is a stair
|
||||
@@ -249,7 +282,6 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isOnLilyPad(Player player) {
|
||||
Block block = player.getLocation().getBlock();
|
||||
// TODO: Can we fix X this?
|
||||
return block.getType() == LILY_PAD || block.getRelative(BlockFace.NORTH).getType() == LILY_PAD
|
||||
|| block.getRelative(BlockFace.SOUTH).getType() == LILY_PAD
|
||||
|| block.getRelative(BlockFace.EAST).getType() == LILY_PAD
|
||||
@@ -278,6 +310,26 @@ public final class Utilities {
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is near a liquid block
|
||||
*
|
||||
* @param player player to check
|
||||
* @return true if near liquid block
|
||||
*/
|
||||
public static boolean isNearWater(Player player) {
|
||||
return player.getLocation().getBlock().isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.WEST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH_EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH_WEST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is in a web
|
||||
@@ -290,6 +342,22 @@ public final class Utilities {
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == COB_WEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == COB_WEB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is near a climbable block
|
||||
*
|
||||
* @param player player to check
|
||||
* @return true if near climbable block
|
||||
*/
|
||||
public static boolean isNearClimbable(Player player) {
|
||||
return isClimbableBlock(player.getLocation().getBlock())
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.DOWN))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.UP))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.EAST))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is climbable
|
||||
|
||||
@@ -69,7 +69,21 @@ public class VersionUtil {
|
||||
}
|
||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
||||
}
|
||||
|
||||
public static boolean isRiptiding(Player player) {
|
||||
if (isBountifulUpdate()) {
|
||||
return false;
|
||||
}
|
||||
return player.isRiptiding();
|
||||
}
|
||||
|
||||
public static boolean isSlowFalling(Player player) {
|
||||
if (isBountifulUpdate()) {
|
||||
return false;
|
||||
}
|
||||
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
||||
}
|
||||
|
||||
public static boolean isFrostWalk(Player player) {
|
||||
if (player.getInventory().getBoots() == null || isBountifulUpdate()) {
|
||||
return false;
|
||||
|
||||
@@ -31,8 +31,13 @@ system:
|
||||
# Should Enterprise options be enabled? Only set this to true if you're an advanced user.
|
||||
enterprise: false
|
||||
# Running AntiCheatReloaded in debug mode will send alerts to the cheating players and enable debug logging
|
||||
# Use this when locating and/or reporting false positives or when testing AntiCheatReloaded
|
||||
# Do NOT enable this in a production environment!
|
||||
debug-mode: false
|
||||
# To prevent spamming, staff and the console will only be notified every x violations
|
||||
# Minimum value is 1, default is 5
|
||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||
notify-every-vl: 5
|
||||
# Use /AntiCheatReloaded check for a list of valid checks
|
||||
disabled-checks:
|
||||
- EXAMPLE_CHECK
|
||||
|
||||
@@ -4,12 +4,12 @@ ALERT:
|
||||
- '&c%player%''s last failed check was: %check%.'
|
||||
- '&cType ''/acr report %player%'' for more information.'
|
||||
WARNING:
|
||||
- '&6&lACR&7 You have been flagged for using cheats.'
|
||||
- '&6&lACR&7 If you continue to cheat, action will be taken.'
|
||||
BAN_REASON: '&cBanned by AntiCheatReloaded'
|
||||
BAN_BROADCAST: '&c%player% was banned for hacking.'
|
||||
KICK_REASON: '&cKicked by AntiCheatReloaded'
|
||||
KICK_BROADCAST: '&c%player% was kicked for hacking.'
|
||||
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
||||
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
||||
BAN_REASON: '&6&lACR &8> &7Banned by AntiCheatReloaded'
|
||||
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
||||
KICK_REASON: '&6&lACR &8> &7Kicked for cheating'
|
||||
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
||||
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
||||
SPAM_KICK_REASON: '&cKicked for spamming'
|
||||
SPAM_KICK_BROADCAST: '&c%player% was kicked for spamming'
|
||||
|
||||
@@ -138,6 +138,9 @@ LADDER_Y_MAX: 0.11761
|
||||
# Minimum speed a player on a ladder can travel
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
LADDER_Y_MIN: 0.11759
|
||||
# Maximum speed a player on a ladder can travel downwards
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
LADDER_DOWN_MAX: 0.15
|
||||
# Number of times a player can fail the nofall check before being considered a cheater
|
||||
# Can be decreased to improve detenction with the risk of false positives
|
||||
# Increase in case of false positives
|
||||
@@ -165,7 +168,7 @@ SPRINT_MAX: 0.2
|
||||
TELEPORT_MIN: 400
|
||||
# Time to exempt a player from moving because of teleporting
|
||||
# Increase in case of false positives
|
||||
TELEPORT_TIME: 800
|
||||
TELEPORT_TIME: 1000
|
||||
# Maximum time a player is considered to have a change in velocity
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_CHECKTIME: 2100
|
||||
@@ -238,12 +241,18 @@ Y_TIME: 800
|
||||
# Amount of suspicious mid-air movements before a player is suspected of glide
|
||||
# Increase this in case of false positives
|
||||
GLIDE_LIMIT: 5
|
||||
# Maximum amount of movement packets allowed per second
|
||||
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||
# Increase this in case of false positives
|
||||
MOREPACKETS_LIMIT: 30
|
||||
# If the MorePackets check gives false positives replace this with the average user ping on your server
|
||||
# Not a good idea to use a value lower than 75 or higher than 250
|
||||
MOREPACKETS_AVERAGE_PING: 80
|
||||
# Can be decreased in to tighten check
|
||||
MOREPACKETS_TELEPORT_COMPENSATION: 200
|
||||
# The amount of milliseconds that were offset to flag for MorePackets (50ms = 1 tick)
|
||||
# Increase this in case of false positives
|
||||
# Can be decreased in to tighten check
|
||||
MOREPACKETS_TRIGGER_BALANCE: 100
|
||||
# The maximum amount of overall lag compensating in milliseconds (50ms = 1 tick)
|
||||
# Increase this in case of false positives
|
||||
# Can be decreased in to tighten check
|
||||
MOREPACKETS_MINIMUM_CLAMP: 200
|
||||
# Maximum amount zero-velocity moments before a player is suspected
|
||||
# Increase this in case of false positives
|
||||
VELOCITY_MAX_FLAGS: 3
|
||||
@@ -253,10 +262,6 @@ KILLAURA_MAX_ANGLE_DIFFERENCE: 50
|
||||
# The maximum amount of violations before flagging player as a cheater
|
||||
# Increase this in case of false positives
|
||||
KILLAURA_MAX_ANGLE_VIOLATIONS: 3
|
||||
# The minimum score difference for the fight speed check to consider a player legit
|
||||
# Increasing this will tighten check but might punish combat consistancy
|
||||
# Decrease this in case of false positives
|
||||
KILLAURA_FIGHTSPEED_MINDIFF: 3
|
||||
# The maximum angle difference allowed when placing or breaking a block
|
||||
# Increase this in case of false positives, can be slightly decreased to tighten check
|
||||
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
||||
@@ -265,4 +270,11 @@ ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
||||
MIN_HEAL_TIME: 490
|
||||
# Maximum distance allowed between two movement packets
|
||||
# Increase this in case of false positives
|
||||
BADPACKETS_MAX_DISTANCE: 25.0
|
||||
BADPACKETS_MAX_DISTANCE: 25.0
|
||||
# Maximum amount of fastladder movements before flagging
|
||||
# Increase this in case of false positives
|
||||
FASTLADDER_MAX_FLAGS: 3
|
||||
# The change milliseconds between two keepalives before considering a player to be lagging
|
||||
# Decrease this in case of clientside lag-related false positives
|
||||
# Do not lower below 50 or increase above 75
|
||||
LAG_DETERMINATION: 60
|
||||
@@ -49,7 +49,7 @@ permissions:
|
||||
anticheat.check.flight:
|
||||
description: Allow players to use fly cheats
|
||||
default: false
|
||||
anticheat.check.elytra:
|
||||
anticheat.check.elytrafly:
|
||||
description: Allow players to use ElytraFly cheats
|
||||
default: false
|
||||
anticheat.check.waterwalk:
|
||||
@@ -64,17 +64,23 @@ permissions:
|
||||
anticheat.check.fastplace:
|
||||
description: Allow players to use build hacks and fastplace
|
||||
default: false
|
||||
anticheat.check.spam:
|
||||
description: Allow players to spam the server
|
||||
anticheat.check.chatspam:
|
||||
description: Allow players to spam chat messages
|
||||
default: false
|
||||
anticheat.check.commandspam:
|
||||
description: Allow players to spam chat messages
|
||||
default: false
|
||||
anticheat.check.sprint:
|
||||
description: Allow players to sprint when hungry
|
||||
default: false
|
||||
anticheat.check.sneak:
|
||||
description: Allow players to use auto-sneak
|
||||
description: Allow players to use sneak hacks
|
||||
default: false
|
||||
anticheat.check.speed:
|
||||
description: Allow players to speed
|
||||
description: Allow players to use speed hacks
|
||||
default: false
|
||||
anticheat.check.vclip:
|
||||
description: Allow players clip through walls
|
||||
default: false
|
||||
anticheat.check.spider:
|
||||
description: Allow players to climb non-climbable surfaces
|
||||
@@ -97,18 +103,15 @@ permissions:
|
||||
anticheat.check.longreach:
|
||||
description: Allow players to use longreaching hacks
|
||||
default: false
|
||||
anticheat.check.projectile:
|
||||
description: Allow players to quickly launch projectiles
|
||||
anticheat.check.unicode:
|
||||
description: Allow players to use unicode in chat
|
||||
default: false
|
||||
anticheat.check.fastprojectile:
|
||||
description: Allow players to spam projectiles (fastbow etc.)
|
||||
default: false
|
||||
anticheat.check.itemspam:
|
||||
description: Allow players to use inventory drop spam hacks
|
||||
default: false
|
||||
anticheat.check.visual:
|
||||
description: Allow players to interact with objects out of their view
|
||||
default: false
|
||||
anticheat.check.vclip:
|
||||
description: Allow players to become slimeballs and clip down through blocks
|
||||
default: false
|
||||
anticheat.check.fastinventory:
|
||||
description: Allow players to use fastloot and similar inventory hacks
|
||||
default: false
|
||||
@@ -116,7 +119,10 @@ permissions:
|
||||
description: Allow players to use autotool to switch tools quickly
|
||||
default: false
|
||||
anticheat.check.morepackets:
|
||||
description: Allow players to send lots of movement packets
|
||||
description: Allow players to send lots of movement packets or modify their timer
|
||||
default: false
|
||||
anticheat.check.badpackets:
|
||||
description: Allow players to send invalid movement packets
|
||||
default: false
|
||||
anticheat.check.velocity:
|
||||
description: Allow players to use knockback prevention
|
||||
@@ -124,25 +130,31 @@ permissions:
|
||||
anticheat.check.criticals:
|
||||
description: Allow players to use criticals
|
||||
default: false
|
||||
anticheat.check.unicode:
|
||||
description: Allow players to use unicode in chat
|
||||
default: false
|
||||
anticheat.check.illegalinteract:
|
||||
description: Allow players to place blocks in illegal places
|
||||
default: false
|
||||
anticheat.check.fastladder:
|
||||
description: Allow players to climb ladders faster
|
||||
default: false
|
||||
anticheat.check.aimbot:
|
||||
description: Allow players to use aimbot
|
||||
default: false
|
||||
anticheat.check.exempt:
|
||||
description: Total exemption from checks
|
||||
default: false
|
||||
children:
|
||||
anticheat.check.fly: true
|
||||
anticheat.check.flight: true
|
||||
anticheat.check.elytrafly: true
|
||||
anticheat.check.waterwalk: true
|
||||
anticheat.check.noswing: true
|
||||
anticheat.check.fastbreak: true
|
||||
anticheat.check.fastplace: true
|
||||
anticheat.check.spam: true
|
||||
anticheat.check.chatspam: true
|
||||
anticheat.check.commandspam: true
|
||||
anticheat.check.sprint: true
|
||||
anticheat.check.sneak: true
|
||||
anticheat.check.speed: true
|
||||
anticheat.check.vclip: true
|
||||
anticheat.check.spider: true
|
||||
anticheat.check.nofall: true
|
||||
anticheat.check.fastbow: true
|
||||
@@ -150,15 +162,15 @@ permissions:
|
||||
anticheat.check.fastheal: true
|
||||
anticheat.check.killaura: true
|
||||
anticheat.check.longreach: true
|
||||
anticheat.check.projectile: true
|
||||
anticheat.check.unicode: true
|
||||
anticheat.check.fastprojectile: true
|
||||
anticheat.check.itemspam: true
|
||||
anticheat.check.visual: true
|
||||
anticheat.check.vclip: true
|
||||
anticheat.check.fastinventory: true
|
||||
anticheat.check.autotool: true
|
||||
anticheat.check.fastanimation: true
|
||||
anticheat.check.morepackets: true
|
||||
anticheat.check.badpackets: true
|
||||
anticheat.check.velocity: true
|
||||
anticheat.check.criticals: true
|
||||
anticheat.check.unicode: true
|
||||
anticheat.check.illegalinteract: true
|
||||
anticheat.check.illegalinteract: true
|
||||
anticheat.check.fastladder: true
|
||||
anticheat.check.aimbot: true
|
||||
Reference in new issue
Block a user