Compare commits

..
12 Commits
Author SHA1 Message Date
Rammelkast 3af7bde9db Prepare for release 2020-04-01 13:07:06 +02:00
Rammelkast 7e37e8558b Introduced version command, fixed #58 2020-04-01 12:53:25 +02:00
Rammelkast d41d08ccc6 Added heuristic KillAura check 2020-03-31 14:59:10 +02:00
Rammelkast f88c31051b Code cleanup 2020-03-31 13:15:59 +02:00
Rammelkast 6afe0049c5 Added and tested backwards compatibility for 1.13 and 1.14. 2020-03-31 13:10:14 +02:00
Rammelkast f77d45a78d Changes loggig, renamed GhostHand to IllegalInteract. 2020-03-30 23:24:28 +02:00
Rammelkast 2ba98f9f9c Sort of fixed badly broken and untested GhostHand check, added update messaging.
Check will still need to be improved, but seems to work without false positives for now.
2020-03-30 22:55:18 +02:00
Rammelkast e89a6cfd88 Merge pull request #54 from EncryptSL/master
Clean Solution for sendToStaff (thanks @EncryptSL)
2020-03-26 10:48:13 +01:00
EncryptSL 07bf56cc93 Clean Solution for sendToStaff
Added clean solution for sendToStaff sendMessage
2020-03-25 20:40:35 +01:00
Rammelkast 773900594d Forgot to commit class 2020-03-25 18:25:57 +01:00
Rammelkast 27ca12aec3 Massive messaging and config changes.
Furthermore:
+ Added basic KillAura angle check (a start to #52)
+ Fixed sneak false positives
+ Added staff alert messaging (anticheat.system.alert permission, see #28)
+ Language file now support color coding
+ Added debug-mode for testservers
+ Insignificant pom.xml and README.md updates
2020-03-25 17:41:44 +01:00
Rammelkast fec1286c8d Added GhostHand and Unicode chat check and fixed broken fly check.
Furthermore:
+ Updated and documented magic.yml
+ Added support for missing CAVE_AIR material
+ Average ping for blink check can now be configured
+ Removed /acr update from help command
+ Added UpdateManager.java to be used in future update messages
+ Better MainHand/OffHand support

I've been busy :)
2020-03-24 20:15:31 +01:00
49 changed files with 1154 additions and 485 deletions

No files matched your search

+7 -2
View File
@@ -12,11 +12,11 @@ Bug Reporting
Issues should be filed by hitting the [issues](https://github.com/Rammelkast/AntiCheatReloaded/issues?state=open) tab above. Please make sure you search your issue before opening a new ticket. Issues should be filed by hitting the [issues](https://github.com/Rammelkast/AntiCheatReloaded/issues?state=open) tab above. Please make sure you search your issue before opening a new ticket.
Please include the following information with your issue, this allows me to fix it quicker; Please include the following information with your issue, this allows me to fix it quicker;
* The `/anticheat debug` log
* Your AntiCheatReloaded version * Your AntiCheatReloaded version
* Your server software (Bukkit/Spigot/Other) and it's version * Your server software (Bukkit/Spigot/Other) and it's version
* If you use ProtocolLib, your ProtocolLib version * Your ProtocolLib version
* Whether or not you are using protocol hacks (ViaVersion etc.) * Whether or not you are using protocol hacks (ViaVersion etc.)
* Any logs relating to the issue
Usage Usage
------- -------
@@ -44,3 +44,8 @@ Hacks blocked
* FastPlace * FastPlace
* Spam * Spam
* FastEat * FastEat
* ElytraFly
* Unicode chat
* GhostHand
* KillAura
* Scaffold
+3 -16
View File
@@ -3,9 +3,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.rammelkast.anticheatreloaded</groupId> <groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId> <artifactId>AntiCheatReloaded</artifactId>
<version>1.7.1-ALPHA</version> <version>1.8.0</version>
<name>AntiCheatReloaded</name> <name>AntiCheatReloaded</name>
<url>https://rammelkast.com</url> <url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
<properties> <properties>
<project.build.version>${project.version}</project.build.version> <project.build.version>${project.version}</project.build.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -64,24 +64,11 @@
</resource> </resource>
</resources> </resources>
</build> </build>
<profiles>
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<properties>
<project.build.version>${project.version}-b${env.BUILD_NUMBER}</project.build.version>
</properties>
</profile>
</profiles>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>4.5.0</version> <version>4.5.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
@@ -33,6 +33,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.ProtocolManager;
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck; import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
import com.rammelkast.anticheatreloaded.command.CommandHandler; import com.rammelkast.anticheatreloaded.command.CommandHandler;
import com.rammelkast.anticheatreloaded.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
@@ -43,6 +44,7 @@ import com.rammelkast.anticheatreloaded.event.PlayerListener;
import com.rammelkast.anticheatreloaded.event.VehicleListener; import com.rammelkast.anticheatreloaded.event.VehicleListener;
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager; import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import com.rammelkast.anticheatreloaded.metrics.Metrics; import com.rammelkast.anticheatreloaded.metrics.Metrics;
import com.rammelkast.anticheatreloaded.util.UpdateManager;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionUtil;
@@ -57,6 +59,7 @@ public class AntiCheatReloaded extends JavaPlugin {
private static ProtocolManager protocolManager; private static ProtocolManager protocolManager;
private static SecureRandom random; private static SecureRandom random;
private static Long loadTime; private static Long loadTime;
private static UpdateManager updateManager;
@Override @Override
public void onEnable() { public void onEnable() {
@@ -81,67 +84,23 @@ public class AntiCheatReloaded extends JavaPlugin {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) { if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
this.setupProtocol(); this.setupProtocol();
} else { } else {
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + "Shutting down, ProtocolLib not found!"); Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "Shutting down, ProtocolLib not found!");
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
return; return;
} }
getLogger().info("NMS version is " + VersionUtil.getVersion()); getLogger().info("NMS version is " + VersionUtil.getVersion());
if (!VersionUtil.isSupported()) { if (!VersionUtil.isSupported()) {
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + "The version of this server is NOT supported by ACR! The plugin will be buggy!"); Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "The version of this server is NOT supported by ACR! The plugin will be buggy!");
} }
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
getLogger().info("Enabling checks that use ProtcolLib");
// Enable packetlisteners // Enable packetlisteners
BlinkCheck.startTimer(); BlinkCheck.startTimer();
BlinkCheck.listenPackets(); BlinkCheck.listenPackets();
KillAuraCheck.listenPackets();
// Check if other AC's are installed updateManager = new UpdateManager();
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
public void run() {
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running NoCheatPlus!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable NoCheatPlus to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("Matrix") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running Matrix!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable NoCheatPlus to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running AAC!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AAC to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running Spartan!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AAC to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("NoAura") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running NoAura!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AAC to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("AntiCheat") != null || Bukkit.getPluginManager().getPlugin("AntiCheatPlus") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running AntiCheat!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AntiCheat to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
}
}, 90L);
// End tests // End tests
verboseLog("Finished loading."); verboseLog("Finished loading.");
@@ -158,15 +117,6 @@ public class AntiCheatReloaded extends JavaPlugin {
return kicked; return kicked;
} }
})); }));
metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations", new Callable<Integer>() {
@Override
public Integer call() throws Exception {
int violations = glideViolations;
// Reset so we don't keep sending the same value
glideViolations = 0;
return violations;
}
}));
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() { metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
@Override @Override
public String call() throws Exception { public String call() throws Exception {
@@ -178,7 +128,6 @@ public class AntiCheatReloaded extends JavaPlugin {
public String call() throws Exception { public String call() throws Exception {
return VersionUtil.getVersion(); return VersionUtil.getVersion();
} }
})); }));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -300,21 +249,21 @@ public class AntiCheatReloaded extends JavaPlugin {
* Amount of players kicked since start * Amount of players kicked since start
*/ */
private int playersKicked = 0; private int playersKicked = 0;
/**
* Amount of glide violations since start
*/
private int glideViolations = 0;
public void onPlayerKicked() { public void onPlayerKicked() {
this.playersKicked++; this.playersKicked++;
} }
public void onGlideViolation() {
this.glideViolations++;
}
public static void sendToMainThread(Runnable runnable) { public static void sendToMainThread(Runnable runnable) {
Bukkit.getServer().getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable); Bukkit.getServer().getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
} }
public void sendToStaff(String message) {
Bukkit.broadcast(message, "anticheat.system.alert");
}
public static UpdateManager getUpdateManager() {
return updateManager;
}
} }
@@ -33,14 +33,15 @@ import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck; import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck; import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck; import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck; import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck; import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
@@ -90,6 +91,7 @@ public class Backend {
private Map<UUID, Long> stepTime = new HashMap<UUID, Long>(); private Map<UUID, Long> stepTime = new HashMap<UUID, Long>();
private HashSet<Byte> transparent = new HashSet<Byte>(); private HashSet<Byte> transparent = new HashSet<Byte>();
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>(); private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
private Map<String, Integer> fastSneakViolations = new HashMap<String, Integer>();
private Magic magic; private Magic magic;
private AntiCheatManager manager = null; private AntiCheatManager manager = null;
@@ -169,10 +171,16 @@ public class Backend {
inventoryTime.remove(pU); inventoryTime.remove(pU);
inventoryClicks.remove(pU); inventoryClicks.remove(pU);
lastFallPacket.remove(pU); lastFallPacket.remove(pU);
fastSneakViolations.remove(player.getUniqueId().toString());
GlideCheck.LAST_DIFFERENCE.remove(pU); GlideCheck.LAST_DIFFERENCE.remove(pU);
GlideCheck.LAST_FALL_DISTANCE.remove(pU); GlideCheck.LAST_FALL_DISTANCE.remove(pU);
GlideCheck.VIOLATIONS.remove(pU); GlideCheck.VIOLATIONS.remove(pU);
SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId()); SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId());
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
KillAuraCheck.ANGLE_FLAGS.remove(player.getUniqueId().toString());
KillAuraCheck.CLICKSPEED_MAP.remove(player.getUniqueId().toString());
KillAuraCheck.DEVIATION_SCORES.remove(player.getUniqueId().toString());
KillAuraCheck.DIFF_MAP.remove(player.getUniqueId().toString());
} }
public CheckResult checkFastBow(Player player, float force) { public CheckResult checkFastBow(Player player, float force) {
@@ -186,7 +194,7 @@ public class Backend {
f = (f * f + f * 2.0F) / 3.0F; f = (f * f + f * 2.0F) / 3.0F;
f = f > 1.0F ? 1.0F : f; f = f > 1.0F ? 1.0F : f;
if (Math.abs(force - f) > magic.BOW_ERROR()) { if (Math.abs(force - f) > magic.BOW_ERROR()) {
return new CheckResult(CheckResult.Result.FAILED, player.getUniqueId() + " fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")"); return new CheckResult(CheckResult.Result.FAILED, "fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")");
} else { } else {
return PASS; return PASS;
} }
@@ -202,7 +210,7 @@ public class Backend {
projectileTime.remove(player.getUniqueId()); projectileTime.remove(player.getUniqueId());
projectilesShot.remove(player.getUniqueId()); projectilesShot.remove(player.getUniqueId());
if (time < magic.PROJECTILE_TIME_MIN()) { if (time < magic.PROJECTILE_TIME_MIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " wound up a bow too fast (actual time=" + time + ", min time=" + magic.PROJECTILE_TIME_MIN() + ")"); return new CheckResult(CheckResult.Result.FAILED, "wound up a bow too fast (actual time=" + time + ", min time=" + magic.PROJECTILE_TIME_MIN() + ")");
} }
} }
return PASS; return PASS;
@@ -218,7 +226,7 @@ public class Backend {
blockTime.remove(player.getUniqueId()); blockTime.remove(player.getUniqueId());
blocksDropped.remove(player.getUniqueId()); blocksDropped.remove(player.getUniqueId());
if (time < magic.DROP_TIME_MIN()) { if (time < magic.DROP_TIME_MIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " dropped an item too fast (actual time=" + time + ", min time=" + magic.DROP_TIME_MIN() + ")"); return new CheckResult(CheckResult.Result.FAILED,"dropped an item too fast (actual time=" + time + ", min time=" + magic.DROP_TIME_MIN() + ")");
} }
} }
return PASS; return PASS;
@@ -228,7 +236,7 @@ public class Backend {
if (isInstantBreakExempt(player)) { if (isInstantBreakExempt(player)) {
return new CheckResult(CheckResult.Result.PASSED); return new CheckResult(CheckResult.Result.PASSED);
} else { } else {
String string = player.getName() + " reached too far for a block"; String string = "reached too far for a block";
double distance = double distance =
player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE() player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE() : player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
@@ -243,7 +251,7 @@ public class Backend {
} }
public CheckResult checkLongReachDamage(Player player, double x, double y, double z) { public CheckResult checkLongReachDamage(Player player, double x, double y, double z) {
String string = player.getName() + " reached too far for an entity"; String string = "reached too far for an entity";
double i = x >= magic.ENTITY_MAX_DISTANCE() ? x : y > magic.ENTITY_MAX_DISTANCE() ? y : z > magic.ENTITY_MAX_DISTANCE() ? z : -1; double i = x >= magic.ENTITY_MAX_DISTANCE() ? x : y > magic.ENTITY_MAX_DISTANCE() ? y : z > magic.ENTITY_MAX_DISTANCE() ? z : -1;
if (i != -1) { if (i != -1) {
return new CheckResult(CheckResult.Result.FAILED, string + " (distance=" + i + ", max=" + magic.ENTITY_MAX_DISTANCE() + ")"); return new CheckResult(CheckResult.Result.FAILED, string + " (distance=" + i + ", max=" + magic.ENTITY_MAX_DISTANCE() + ")");
@@ -254,7 +262,7 @@ public class Backend {
public CheckResult checkSpider(Player player, double y) { public CheckResult checkSpider(Player player, double y) {
if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN() && !Utilities.isClimbableBlock(player.getLocation().getBlock())) { if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN() && !Utilities.isClimbableBlock(player.getLocation().getBlock())) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to climb a non-ladder (" + player.getLocation().getBlock().getType() + ")"); return new CheckResult(CheckResult.Result.FAILED, "tried to climb a non-ladder (" + player.getLocation().getBlock().getType() + ")");
} else { } else {
return PASS; return PASS;
} }
@@ -262,7 +270,7 @@ public class Backend {
public CheckResult checkYSpeed(Player player, double y) { 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)) { 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)) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + "'s y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")"); return new CheckResult(CheckResult.Result.FAILED, "y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
} else { } else {
return PASS; return PASS;
} }
@@ -281,7 +289,7 @@ public class Backend {
int i = nofallViolation.get(uuid); int i = nofallViolation.get(uuid);
if (i >= magic.NOFALL_LIMIT()) { if (i >= magic.NOFALL_LIMIT()) {
nofallViolation.put(player.getUniqueId(), 1); nofallViolation.put(player.getUniqueId(), 1);
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to avoid fall damage (fall distance = 0 " + i + " times in a row, max=" + magic.NOFALL_LIMIT() + ")"); return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 " + i + " times in a row, max=" + magic.NOFALL_LIMIT() + ")");
} else { } else {
return PASS; return PASS;
} }
@@ -293,15 +301,27 @@ public class Backend {
return PASS; return PASS;
} }
public CheckResult checkSneak(Player player, double x, double z) { public CheckResult checkSneak(Player player, Location location, double x, double z) {
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()) { if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle() && !Utilities.cantStandAtExp(location)) {
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1; double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
if (i != -1) { if (i != -1) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")"); if (this.fastSneakViolations.containsKey(player.getUniqueId().toString())) {
int flags = this.fastSneakViolations.get(player.getUniqueId().toString());
if (flags >= 3) { // TODO possible config
return new CheckResult(CheckResult.Result.FAILED, "was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
}
this.fastSneakViolations.put(player.getUniqueId().toString(), flags + 1);
return PASS;
} else { } else {
this.fastSneakViolations.put(player.getUniqueId().toString(), 1);
return PASS; return PASS;
} }
} else { } else {
this.fastSneakViolations.remove(player.getUniqueId().toString());
return PASS;
}
} else {
this.fastSneakViolations.remove(player.getUniqueId().toString());
return PASS; return PASS;
} }
} }
@@ -309,19 +329,12 @@ public class Backend {
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) { public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE && player.getFoodLevel() <= magic.SPRINT_FOOD_MIN()) { if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE && player.getFoodLevel() <= magic.SPRINT_FOOD_MIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " sprinted while hungry (food=" + player.getFoodLevel() + ", min=" + magic.SPRINT_FOOD_MIN() + ")"); return new CheckResult(CheckResult.Result.FAILED, "sprinted while hungry (food=" + player.getFoodLevel() + ", min=" + magic.SPRINT_FOOD_MIN() + ")");
} else { } else {
return PASS; return PASS;
} }
} }
public CheckResult checkSprintStill(Player player, Location from, Location to) {
/*if(!isMovingExempt(player) && player.isSprinting() && from.getX() == to.getX() && from.getZ() == to.getZ()) {
return new CheckResult(Result.FAILED, player.getName()+" sprinted while standing still (xyz = "+(int)from.getX()+","+(int)from.getY()+","+(int)from.getZ()+")");
}*/
return PASS;
}
public CheckResult checkVClip(Player player, Distance distance) { public CheckResult checkVClip(Player player, Distance distance) {
double from = Math.round(distance.fromY()); double from = Math.round(distance.fromY());
double to = Math.round(distance.toY()); double to = Math.round(distance.toY());
@@ -333,7 +346,7 @@ public class Backend {
for (int i = 0; i < (Math.round(distance.getYDifference())) + 1; i++) { for (int i = 0; i < (Math.round(distance.getYDifference())) + 1; i++) {
Block block = new Location(player.getWorld(), player.getLocation().getX(), to + i, player.getLocation().getZ()).getBlock(); Block block = new Location(player.getWorld(), player.getLocation().getX(), to + i, player.getLocation().getZ()).getBlock();
if (block.getType() != Material.AIR && block.getType().isSolid()) { if (block.getType() != Material.AIR && block.getType().isSolid()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to move through a solid block", (int) from + 3); return new CheckResult(CheckResult.Result.FAILED, "tried to move through a solid block", (int) from + 3);
} }
} }
@@ -354,48 +367,12 @@ public class Backend {
long time = System.currentTimeMillis() - stepTime.get(uuid); long time = System.currentTimeMillis() - stepTime.get(uuid);
steps.put(uuid, 0); steps.put(uuid, 0);
if (time < magic.TIMER_TIMEMIN()) { if (time < magic.TIMER_TIMEMIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to alter their timer, took " + step + " steps in " + time + " ms (min = " + magic.TIMER_TIMEMIN() + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "tried to alter their timer, took " + step + " steps in " + time + " ms (min = " + magic.TIMER_TIMEMIN() + " ms)");
} }
} }
return PASS; return PASS;
} }
public CheckResult checkSight(Player player, Entity entity) {
/*if (entity instanceof LivingEntity) {
LivingEntity le = (LivingEntity) entity;
// Check to make sure the entity's head is not surrounded
Block head = le.getWorld().getBlockAt((int) le.getLocation().getX(), (int) (le.getLocation().getY() + le.getEyeHeight()), (int) le.getLocation().getZ());
boolean solid = false;
// TODO: This sucks. See if it's possible to not have as many false-positives while still retaining most of the check.
for (int x = -2; x <= 2; x++) {
for (int z = -2; z <= 2; z++) {
for (int y = -1; y < 2; y++) {
if (head.getRelative(x, y, z).getTypeId() != 0) {
if (head.getRelative(x, y, z).getType().isSolid()) {
solid = true;
break;
}
}
}
}
}
if (solid) {
return PASS;
}
// TODO: Needs proper testing
Location mobLocation = le.getEyeLocation();
for (Block block : player.getLineOfSight(transparent, 5)) {
if (Math.abs(block.getLocation().getX() - mobLocation.getX()) < 2.3 || Math.abs(block.getLocation().getZ() - mobLocation.getZ()) < 2.3) {
return PASS;
}
}
return new CheckResult(Result.FAILED, player.getName()+" tried to damage an entity ("+le.getType()+") out of sight ");
}*/
return PASS;
}
public void logAscension(Player player, double y1, double y2) { public void logAscension(Player player, double y1, double y2) {
UUID name = player.getUniqueId(); UUID name = player.getUniqueId();
if (y1 < y2 && !isAscending.contains(name)) { if (y1 < y2 && !isAscending.contains(name)) {
@@ -413,12 +390,19 @@ public class Backend {
string = " with jump potion"; string = " with jump potion";
} }
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player) && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) { if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
&& !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) {
if (y1 < y2) { if (y1 < y2) {
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) { if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
&& !block.getRelative(BlockFace.EAST).isLiquid()
&& !block.getRelative(BlockFace.WEST).isLiquid()) {
increment(player, ascensionCount, max); increment(player, ascensionCount, max);
if (ascensionCount.get(player.getUniqueId()) >= max) { if (ascensionCount.get(player.getUniqueId()) >= max) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " ascended " + ascensionCount.get(player.getUniqueId()) + " times in a row (max = " + max + string + ")"); return new CheckResult(CheckResult.Result.FAILED,
"ascended " + ascensionCount.get(player.getUniqueId())
+ " times in a row (max = " + max + string + ")");
} }
} }
} else { } else {
@@ -435,7 +419,7 @@ public class Backend {
if (blockPunches.get(uuid) != null && player.getGameMode() != GameMode.CREATIVE) { if (blockPunches.get(uuid) != null && player.getGameMode() != GameMode.CREATIVE) {
int i = blockPunches.get(uuid); int i = blockPunches.get(uuid);
if (i < magic.BLOCK_PUNCH_MIN()) { if (i < magic.BLOCK_PUNCH_MIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to break a block of " + block.getType() + " after only " + i + " punches (min=" + magic.BLOCK_PUNCH_MIN() + ")"); return new CheckResult(CheckResult.Result.FAILED, "tried to break a block of " + block.getType() + " after only " + i + " punches (min=" + magic.BLOCK_PUNCH_MIN() + ")");
} else { } else {
blockPunches.put(uuid, 0); // it should reset after EACH block break. blockPunches.put(uuid, 0); // it should reset after EACH block break.
} }
@@ -460,7 +444,7 @@ public class Backend {
int i = fastBreakViolation.get(uuid); int i = fastBreakViolation.get(uuid);
if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) { if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) {
lastBlockBroken.put(uuid, System.currentTimeMillis()); lastBlockBroken.put(uuid, System.currentTimeMillis());
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " broke blocks too fast " + i + " times in a row (max=" + violations + ")"); return new CheckResult(CheckResult.Result.FAILED, "broke blocks too fast " + i + " times in a row (max=" + violations + ")");
} else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) { } else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) {
fastBreakViolation.put(uuid, 0); fastBreakViolation.put(uuid, 0);
} }
@@ -487,7 +471,7 @@ public class Backend {
int i = fastBreaks.get(uuid); int i = fastBreaks.get(uuid);
fastBreaks.put(uuid, 0); fastBreaks.put(uuid, 0);
fastBreakViolation.put(uuid, fastBreakViolation.get(uuid) + 1); fastBreakViolation.put(uuid, fastBreakViolation.get(uuid) + 1);
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to break " + i + " blocks in " + math + " ms (max=" + magic.FASTBREAK_LIMIT() + " in " + timemax + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "tried to break " + i + " blocks in " + math + " ms (max=" + magic.FASTBREAK_LIMIT() + " in " + timemax + " ms)");
} else if (fastBreaks.get(uuid) >= magic.FASTBREAK_LIMIT() || fastBreakViolation.get(uuid) > 0) { } else if (fastBreaks.get(uuid) >= magic.FASTBREAK_LIMIT() || fastBreakViolation.get(uuid) > 0) {
if (!blockBreakHolder.containsKey(uuid) || !blockBreakHolder.get(uuid)) { if (!blockBreakHolder.containsKey(uuid) || !blockBreakHolder.get(uuid)) {
blockBreakHolder.put(uuid, true); blockBreakHolder.put(uuid, true);
@@ -521,7 +505,7 @@ public class Backend {
AntiCheatReloaded.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math); AntiCheatReloaded.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) { if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
lastBlockPlaced.put(uuid, time); lastBlockPlaced.put(uuid, time);
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")"); return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) { } else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
AntiCheatReloaded.debugLog("Reset facePlaceViolation for " + uuid); AntiCheatReloaded.debugLog("Reset facePlaceViolation for " + uuid);
fastPlaceViolation.put(uuid, 0); fastPlaceViolation.put(uuid, 0);
@@ -535,7 +519,7 @@ public class Backend {
lastBlockPlaceTime.put(uuid, (time - last)); lastBlockPlaceTime.put(uuid, (time - last));
lastBlockPlaced.put(uuid, time); lastBlockPlaced.put(uuid, time);
fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1); fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1);
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to place a block " + thisTime + " ms after the last one (min=" + magic.FASTPLACE_TIMEMIN() + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "tried to place a block " + thisTime + " ms after the last one (min=" + magic.FASTPLACE_TIMEMIN() + " ms)");
} }
lastBlockPlaceTime.put(uuid, (time - last)); lastBlockPlaceTime.put(uuid, (time - last));
} }
@@ -566,14 +550,14 @@ public class Backend {
} }
Long l = user.getMessageTime(i); Long l = user.getMessageTime(i);
if (System.currentTimeMillis() - l > magic.CHAT_REPEAT_MIN() * 100) { if (System.currentTimeMillis() - l > magic.CHAT_REPEAT_MIN()) {
user.clearMessages(); user.clearMessages();
break; break;
} else { } else {
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue() && m.equalsIgnoreCase(msg) && i == 1) { if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue() && m.equalsIgnoreCase(msg) && i == 1) {
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\""); manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING()); return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN() * 2) { } else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.CHAT_MIN()) {
manager.getLoggingManager().logFineInfo(player.getName() + " spammed quickly \"" + msg + "\""); manager.getLoggingManager().logFineInfo(player.getName() + " spammed quickly \"" + msg + "\"");
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING()); return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
} }
@@ -609,13 +593,13 @@ public class Backend {
} }
Long l = user.getCommandTime(i); Long l = user.getCommandTime(i);
if (System.currentTimeMillis() - l > magic.COMMAND_REPEAT_MIN() * 100) { if (System.currentTimeMillis() - l > magic.COMMAND_REPEAT_MIN()) {
user.clearCommands(); user.clearCommands();
break; break;
} else { } else {
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue() && m.equalsIgnoreCase(cmd) && i == 1) { if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue() && m.equalsIgnoreCase(cmd) && i == 1) {
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING()); return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN() * 2) { } else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue() && System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN()) {
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING()); return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
} }
} }
@@ -641,7 +625,7 @@ public class Backend {
long time = System.currentTimeMillis() - inventoryTime.get(uuid); long time = System.currentTimeMillis() - inventoryTime.get(uuid);
inventoryClicks.put(uuid, 0); inventoryClicks.put(uuid, 0);
if (time < magic.INVENTORY_TIMEMIN()) { if (time < magic.INVENTORY_TIMEMIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " clicked inventory slots " + clicks + " times in " + time + " ms (max=" + magic.INVENTORY_CHECK() + " in " + magic.INVENTORY_TIMEMIN() + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "clicked inventory slots " + clicks + " times in " + time + " ms (max=" + magic.INVENTORY_CHECK() + " in " + magic.INVENTORY_TIMEMIN() + " ms)");
} }
} }
return PASS; return PASS;
@@ -649,15 +633,15 @@ public class Backend {
public CheckResult checkAutoTool(Player player) { public CheckResult checkAutoTool(Player player) {
if (itemInHand.containsKey(player.getUniqueId()) && itemInHand.get(player.getUniqueId()) != VersionUtil.getItemInHand(player).getType()) { if (itemInHand.containsKey(player.getUniqueId()) && itemInHand.get(player.getUniqueId()) != VersionUtil.getItemInHand(player).getType()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " switched tools too fast (had " + itemInHand.get(player.getUniqueId()) + ", has " + VersionUtil.getItemInHand(player).getType() + ")"); return new CheckResult(CheckResult.Result.FAILED, "switched tools too fast (had " + itemInHand.get(player.getUniqueId()) + ", has " + VersionUtil.getItemInHand(player).getType() + ")");
} else { } else {
return PASS; return PASS;
} }
} }
public CheckResult checkSprintDamage(Player player) { public CheckResult checkSprintDamage(Player player) {
if (isDoing(player, sprinted, magic.SPRINT_MIN())) { if (isDoing(player, sprinted, magic.SPRINT_MAX())) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " sprinted and damaged an entity too fast (min sprint=" + magic.SPRINT_MIN() + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "sprinted and damaged an entity too fast (min sprint=" + magic.SPRINT_MAX() + " ms)");
} else { } else {
return PASS; return PASS;
} }
@@ -670,7 +654,7 @@ public class Backend {
long l = lastHeal.get(player.getUniqueId()); long l = lastHeal.get(player.getUniqueId());
lastHeal.remove(player.getUniqueId()); lastHeal.remove(player.getUniqueId());
if ((System.currentTimeMillis() - l) < healTime) { if ((System.currentTimeMillis() - l) < healTime) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
} }
} }
return PASS; return PASS;
@@ -682,7 +666,7 @@ public class Backend {
long l = startEat.get(player.getUniqueId()); long l = startEat.get(player.getUniqueId());
startEat.remove(player.getUniqueId()); startEat.remove(player.getUniqueId());
if ((System.currentTimeMillis() - l) < magic.EAT_TIME_MIN()) { if ((System.currentTimeMillis() - l) < magic.EAT_TIME_MIN()) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " ate too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + magic.EAT_TIME_MIN() + " ms)"); return new CheckResult(CheckResult.Result.FAILED, "ate too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + magic.EAT_TIME_MIN() + " ms)");
} }
} }
return PASS; return PASS;
@@ -794,6 +778,7 @@ public class Backend {
GlideCheck.LAST_FALL_DISTANCE.remove(player.getUniqueId()); GlideCheck.LAST_FALL_DISTANCE.remove(player.getUniqueId());
GlideCheck.LAST_DIFFERENCE.remove(player.getUniqueId()); GlideCheck.LAST_DIFFERENCE.remove(player.getUniqueId());
GlideCheck.VIOLATIONS.remove(player.getUniqueId()); GlideCheck.VIOLATIONS.remove(player.getUniqueId());
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
} }
public void logExitFly(final Player player) { public void logExitFly(final Player player) {
@@ -36,11 +36,8 @@ import java.util.UUID;
*/ */
public enum CheckType { public enum CheckType {
ZOMBE_FLY(Permission.CHECK_ZOMBE_FLY),
ZOMBE_NOCLIP(Permission.CHECK_ZOMBE_NOCLIP),
ZOMBE_CHEAT(Permission.CHECK_ZOMBE_CHEAT),
FLIGHT(Permission.CHECK_FLIGHT), FLIGHT(Permission.CHECK_FLIGHT),
ELYTRA(Permission.CHECK_FLIGHT), ELYTRAFLY(Permission.CHECK_FLIGHT),
WATER_WALK(Permission.CHECK_WATERWALK), WATER_WALK(Permission.CHECK_WATERWALK),
NO_SWING(Permission.CHECK_NOSWING), NO_SWING(Permission.CHECK_NOSWING),
FAST_BREAK(Permission.CHECK_FASTBREAK), FAST_BREAK(Permission.CHECK_FASTBREAK),
@@ -56,7 +53,7 @@ public enum CheckType {
FAST_BOW(Permission.CHECK_FASTBOW), FAST_BOW(Permission.CHECK_FASTBOW),
FAST_EAT(Permission.CHECK_FASTEAT), FAST_EAT(Permission.CHECK_FASTEAT),
FAST_HEAL(Permission.CHECK_FASTHEAL), FAST_HEAL(Permission.CHECK_FASTHEAL),
FORCEFIELD(Permission.CHECK_FORCEFIELD), KILLAURA(Permission.CHECK_KILLAURA),
LONG_REACH(Permission.CHECK_LONGREACH), LONG_REACH(Permission.CHECK_LONGREACH),
FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE), FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE),
ITEM_SPAM(Permission.CHECK_ITEMSPAM), ITEM_SPAM(Permission.CHECK_ITEMSPAM),
@@ -65,7 +62,8 @@ public enum CheckType {
BLINK(Permission.CHECK_BLINK), BLINK(Permission.CHECK_BLINK),
VELOCITY(Permission.CHECK_VELOCITY), VELOCITY(Permission.CHECK_VELOCITY),
CRITICALS(Permission.CHECK_CRITICALS), CRITICALS(Permission.CHECK_CRITICALS),
CHAT_UNICODE(Permission.CHECK_UNICODE); CHAT_UNICODE(Permission.CHECK_UNICODE),
ILLEGAL_INTERACT(Permission.CHECK_ILLEGAL_INTERACT);
private final Permission permission; private final Permission permission;
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>(); private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
@@ -126,8 +124,19 @@ public enum CheckType {
* @return reference name * @return reference name
*/ */
public static String getName(CheckType type) { public static String getName(CheckType type) {
char[] chars = type.toString().replaceAll("_", " ").toLowerCase().toCharArray(); if (type.name().contains("_")) {
String[] split = type.name().toLowerCase().split("_");
String name = "";
for (String part : split) {
char[] chars = part.toCharArray();
chars[0] = Character.toUpperCase(chars[0]);
name += new String(chars);
}
return name;
} else {
char[] chars = type.name().toLowerCase().toCharArray();
chars[0] = Character.toUpperCase(chars[0]); chars[0] = Character.toUpperCase(chars[0]);
return new String(chars); return new String(chars);
} }
}
} }
@@ -39,8 +39,7 @@ public class CriticalsCheck {
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0) if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0)
&& p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) { && p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
e.setCancelled(true); e.setCancelled(true);
EventListener.log(new CheckResult(CheckResult.Result.FAILED, EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
p.getName() + " failed Criticals, tried to do a critical without needed conditions")
.getMessage(), .getMessage(),
p, CheckType.CRITICALS); p, CheckType.CRITICALS);
} }
@@ -0,0 +1,166 @@
/*
* 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.combat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.config.providers.Magic;
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
public class KillAuraCheck {
public static final Map<String, Integer> ANGLE_FLAGS = new HashMap<String, Integer>();
public static final Map<String, Integer> DEVIATION_SCORES = new HashMap<String, Integer>();
public static final Map<String, Integer> DIFF_MAP = new HashMap<String, Integer>();
public static final Map<String, ClickSpeed> CLICKSPEED_MAP = new HashMap<String, ClickSpeed>();
private static final KillauraAssist KILLAURA_ASSIST;
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static void listenPackets() {
/*AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(),
ListenerPriority.LOWEST, new PacketType[] { PacketType.Play.Client.POSITION_LOOK }) {
@Override
public void onPacketReceiving(PacketEvent e) {
Player player = e.getPlayer();
PacketContainer packet = e.getPacket();
}
});*/
}
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
Entity entity = event.getEntity();
if (entity instanceof LivingEntity) {
LivingEntity living = (LivingEntity) entity;
Location eyeLocation = player.getEyeLocation();
double yawDifference = KillauraAssist.calculateYawDifference(eyeLocation, living.getLocation());
double playerYaw = player.getEyeLocation().getYaw();
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_DIFFERENCE()) {
if (!ANGLE_FLAGS.containsKey(player.getUniqueId().toString())) {
ANGLE_FLAGS.put(player.getUniqueId().toString(), 1);
return PASS;
}
int flags = ANGLE_FLAGS.get(player.getUniqueId().toString());
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
ANGLE_FLAGS.remove(player.getUniqueId().toString());
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
}
ANGLE_FLAGS.put(player.getUniqueId().toString(), flags + 1);
}
}
return PASS;
}
public static CheckResult checkFightSpeed(Player player, EntityDamageEvent event) {
if (!CLICKSPEED_MAP.containsKey(player.getUniqueId().toString())) {
CLICKSPEED_MAP.put(player.getUniqueId().toString(), new ClickSpeed());
return PASS;
}
ClickSpeed clickSpeed = CLICKSPEED_MAP.get(player.getUniqueId().toString());
clickSpeed.registerClick();
int deviationScore = clickSpeed.getDeviationScore();
// Prevents false positives since scores under 2000 aren't reliable
if (deviationScore < 2000) {
return PASS;
}
if (!DEVIATION_SCORES.containsKey(player.getUniqueId().toString())) {
DEVIATION_SCORES.put(player.getUniqueId().toString(), deviationScore);
return PASS;
}
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
int lastScore = DEVIATION_SCORES.get(player.getUniqueId().toString());
DEVIATION_SCORES.put(player.getUniqueId().toString(), deviationScore);
int diff = Math.abs(deviationScore - lastScore);
if (!DIFF_MAP.containsKey(player.getUniqueId().toString())) {
DIFF_MAP.put(player.getUniqueId().toString(), diff);
return PASS;
}
int lastDiff = DIFF_MAP.get(player.getUniqueId().toString());
DIFF_MAP.put(player.getUniqueId().toString(), diff);
if (Math.abs(diff - lastDiff) < magic.KILLAURA_FIGHTSPEED_MINDIFF()) {
event.setCancelled(true);
return new CheckResult(CheckResult.Result.FAILED, "had a suspiciously consistant fighting speed (absdiff=" + Math.abs(diff - lastDiff) + ")");
}
return PASS;
}
private static class ClickSpeed {
private final List<Long> clicks;
private long lastClick;
public ClickSpeed() {
this.clicks = new ArrayList<Long>();
this.lastClick = System.currentTimeMillis();
}
public void registerClick() {
this.lastClick = System.currentTimeMillis();
this.clicks.add(this.lastClick);
}
public int getDeviationScore() {
long last = 0;
List<Integer> deviation = new ArrayList<Integer>();
List<Long> toRemove = new ArrayList<Long>();
for (long clickTime : this.clicks) {
if (clickTime > (this.lastClick - 5000)) {
if (last == 0) {
last = clickTime;
continue;
}
deviation.add((int) (clickTime - last));
} else {
toRemove.add(clickTime);
}
}
this.clicks.removeAll(toRemove);
if (deviation.isEmpty()) {
return -1;
}
float averageDeviationScore = deviation.get(0);
for (int i = 1; i < deviation.size(); i++) {
averageDeviationScore += deviation.get(i);
}
return Math.round(averageDeviationScore / deviation.size());
}
}
static {
KILLAURA_ASSIST = new KillauraAssist();
}
}
@@ -57,11 +57,11 @@ public class VelocityCheck {
else { else {
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1); VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic() if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
.VELOCITY_AMT()) { .VELOCITY_MAX_FLAGS()) {
EventListener.log(new CheckResult(CheckResult.Result.FAILED, EventListener.log(new CheckResult(CheckResult.Result.FAILED,
p.getName() + " failed Velocity, had zero/low velocity " "had zero/low velocity "
+ VL_COUNT.get(p.getUniqueId()) + " times (max=" + VL_COUNT.get(p.getUniqueId()) + " times (max="
+ AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT() + AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_MAX_FLAGS()
+ ", dist=" + then.distance(p.getLocation()) + ")").getMessage(), + ", dist=" + then.distance(p.getLocation()) + ")").getMessage(),
p, CheckType.VELOCITY); p, CheckType.VELOCITY);
VL_COUNT.remove(p.getUniqueId()); VL_COUNT.remove(p.getUniqueId());
@@ -23,7 +23,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@@ -56,7 +55,7 @@ public class BlinkCheck {
public static void listenPackets() { public static void listenPackets() {
AntiCheatReloaded.getProtocolManager() AntiCheatReloaded.getProtocolManager()
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, .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 @Override
public void onPacketReceiving(PacketEvent e) { public void onPacketReceiving(PacketEvent e) {
@@ -70,11 +69,14 @@ public class BlinkCheck {
&& !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) && !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
&& !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) { && !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
int ping = VersionUtil.getPlayerPing(p); int ping = VersionUtil.getPlayerPing(p);
int blinkMagic = AntiCheatReloaded.getManager().getBackend() int blinkMagic = AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET();
.getMagic().BLINK_PACKET(); int averagePing = AntiCheatReloaded.getManager().getBackend().getMagic()
float pingLeniency = (float) ((ping / 120)); .BLINK_AVERAGE_PING();
if (pingLeniency < 1) pingLeniency = 1; float pingLeniency = (float) ((ping / averagePing));
if (pingLeniency > 3) pingLeniency = 3; if (pingLeniency < 1)
pingLeniency = 1;
if (pingLeniency > 2.5F)
pingLeniency = 2.5F;
blinkMagic = Math.round(pingLeniency * blinkMagic); blinkMagic = Math.round(pingLeniency * blinkMagic);
final float finalPingLeniency = pingLeniency; final float finalPingLeniency = pingLeniency;
try { try {
@@ -84,12 +86,12 @@ public class BlinkCheck {
AntiCheatReloaded.sendToMainThread(new Runnable() { AntiCheatReloaded.sendToMainThread(new Runnable() {
@Override @Override
public void run() { public void run() {
EventListener.log( EventListener.log(new CheckResult(CheckResult.Result.FAILED,
new CheckResult(CheckResult.Result.FAILED, p.getName() "sent " + packets + " packets in one second (max="
+ " failed Blink, sent " + packets + AntiCheatReloaded.getManager().getBackend().getMagic()
+ " packets in one second (max=" + AntiCheatReloaded.getManager() .BLINK_PACKET()
.getBackend().getMagic().BLINK_PACKET() + ", leniency=" + finalPingLeniency + ", ping=" + ping
+ ", leniency=" + finalPingLeniency + ", ping=" + ping + ")").getMessage(), + ")").getMessage(),
p, CheckType.BLINK); p, CheckType.BLINK);
e.setCancelled(true); e.setCancelled(true);
e.getPlayer().teleport(cur); e.getPlayer().teleport(cur);
@@ -19,39 +19,66 @@
package com.rammelkast.anticheatreloaded.check.movement; package com.rammelkast.anticheatreloaded.check.movement;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Utilities;
/**
* TODO
*/
public class ElytraCheck { public class ElytraCheck {
public static final HashMap<String, Double> JUMP_Y_VALUE = new HashMap<String, Double>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult runCheck(Player player, Distance distance) { public static CheckResult runCheck(Player player, Distance distance) {
String uuid = player.getUniqueId().toString();
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) { if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
// This was a teleport, so skip check. // This was a teleport, so skip check.
JUMP_Y_VALUE.remove(uuid);
return PASS; return PASS;
} }
/*if (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
&& Utilities.cantStandAtExp(player.getLocation())
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
Material.fence, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARS })) {
}*/ if (player.isFlying() || player.hasPotionEffect(PotionEffectType.LEVITATION) || !player.isGliding()) {
//TODO 1.15 update JUMP_Y_VALUE.remove(uuid);
return PASS;
}
double changeY = distance.toY() - distance.fromY();
boolean upwardMovement = changeY > 0;
if (player.getInventory().getItemInMainHand().getType() == Material.TRIDENT) {
if (upwardMovement) {
// TODO continue check here
JUMP_Y_VALUE.remove(uuid);
return PASS;
}
}
if (changeY == 0.0D) {
// Seen no false positives here yet
return new CheckResult(CheckResult.Result.FAILED, "had no Y-axis dropoff when gliding with Elytra");
}
if (!JUMP_Y_VALUE.containsKey(uuid)) {
JUMP_Y_VALUE.put(uuid, distance.toY());
return PASS;
}
double lastY = JUMP_Y_VALUE.get(uuid);
if (lastY < distance.toY()) {
double diff = distance.toY() - lastY;
if (diff > 0.7675) {
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
Location to = player.getLocation();
to.setY(to.getY() - diff);
player.teleport(to);
}
return new CheckResult(CheckResult.Result.FAILED, "tried to glide above jump level");
}
}
return PASS; return PASS;
} }
@@ -56,11 +56,8 @@ public class FlightCheck {
&& Utilities.cantStandAtExp(player.getLocation()) && Utilities.cantStandAtExp(player.getLocation())
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN), && Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
new Material[] { Material.IRON_BARS }) new Material[] { Material.IRON_BARS })
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN), new String[] { && Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
"FENCE", new String[] { "FENCE", "FENCE_GATE" })) {
"FENCE_GATE"
})) {
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) { if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
BLOCKS_OVER_FLIGHT.put(uuid, 0D); BLOCKS_OVER_FLIGHT.put(uuid, 0D);
} }
@@ -72,16 +69,15 @@ public class FlightCheck {
BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) - distance.getYDifference())); BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) - distance.getYDifference()));
} }
if (BLOCKS_OVER_FLIGHT.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() if (BLOCKS_OVER_FLIGHT.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
&& (y1 <= y2)) { .FLIGHT_BLOCK_LIMIT() && (y1 <= y2)) {
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max=" "flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
+ AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")"); + AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
} }
} else { } else {
BLOCKS_OVER_FLIGHT.put(uuid, 0D); BLOCKS_OVER_FLIGHT.put(uuid, 0D);
} }
return PASS; return PASS;
} }
@@ -67,14 +67,14 @@ public class GlideCheck {
if (VIOLATIONS.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic() if (VIOLATIONS.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic()
.GLIDE_LIMIT()) { .GLIDE_LIMIT()) {
VIOLATIONS.remove(player.getUniqueId()); VIOLATIONS.remove(player.getUniqueId());
Location to = player.getLocation(); if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
to.setY(to.getY() - distanceToFall(to)); Location prev = player.getLocation();
player.teleport(to); prev.setY(prev.getY() - distanceToFall(prev));
// Report glide violation to statistics, just for the lulz jk player.teleport(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
AntiCheatReloaded.getPlugin().onGlideViolation(); .getGoodLocation(prev));
}
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " was set back for gliding (yDiff=" "type=glide, desc_amount=" + new BigDecimal(yDiff).setScale(2, RoundingMode.HALF_UP) + ")");
+ new BigDecimal(yDiff).setScale(2, RoundingMode.HALF_UP) + ")");
} else { } else {
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1); VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
} }
@@ -89,10 +89,8 @@ public class GlideCheck {
private static double distanceToFall(Location location) { private static double distanceToFall(Location location) {
location = location.clone(); location = location.clone();
double firstY = location.getY(); double highestY = location.getWorld().getHighestBlockYAt(location) + 1.02D;
while (location.clone().add(0, -0.1, 0).getBlock().getType() == Material.AIR) return location.getY() - highestY;
location.add(0, -0.1, 0);
return firstY - location.getY();
} }
} }
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@@ -67,9 +68,19 @@ public class SpeedCheck {
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION(); max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION();
} }
} else if (player.isSprinting()) { } else if (player.isSprinting()) {
String blockDownName = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().name();
if (blockDownName.endsWith("ICE")
&& ((player.getEyeLocation().getBlock().getRelative(BlockFace.UP).getType() != Material.AIR)
&& (player.getEyeLocation().getBlock().getRelative(BlockFace.UP)
.getType() != Material.CAVE_AIR))) {
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ") + " ";
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT()
+ (blockDownName.equals("BLUE_ICE") ? 0.20925D : 0.165D);
} else {
reason = "while sprinting "; reason = "while sprinting ";
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT(); max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
} }
}
float speed = player.getWalkSpeed(); float speed = player.getWalkSpeed();
max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0; max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;
@@ -79,7 +90,7 @@ public class SpeedCheck {
AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX()); AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX());
if (num >= AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX()) { if (num >= AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX()) {
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + "'s speed was too high " + reason + num + " times in a row (max=" "speed was too high " + reason + num + " times in a row (max="
+ AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX() + ", speed=" + AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX() + ", speed="
+ (x > z ? x : z) + ", max speed=" + max + ")"); + (x > z ? x : z) + ", max speed=" + max + ")");
} else { } else {
@@ -36,7 +36,7 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionUtil;
/** /**
* This check seems to be broken/outdated * This check should be replaced It works, but not great
*/ */
public class WaterWalkCheck { public class WaterWalkCheck {
@@ -55,32 +55,32 @@ public class WaterWalkCheck {
if (IS_IN_WATER.contains(uuid)) { if (IS_IN_WATER.contains(uuid)) {
if (IS_IN_WATER_CACHE.contains(uuid)) { if (IS_IN_WATER_CACHE.contains(uuid)) {
if (player.getNearbyEntities(1, 1, 1).isEmpty()) { if (player.getNearbyEntities(1, 1, 1).isEmpty()) {
boolean b; boolean violation;
if (!Utilities.sprintFly(player)) { if (!Utilities.sprintFly(player)) {
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER() violation = x > AntiCheatReloaded.getManager().getBackend().getMagic()
.XZ_SPEED_MAX_WATER()
|| z > AntiCheatReloaded.getManager().getBackend().getMagic() || z > AntiCheatReloaded.getManager().getBackend().getMagic()
.XZ_SPEED_MAX_WATER(); .XZ_SPEED_MAX_WATER();
} else { } else {
b = x > AntiCheatReloaded.getManager().getBackend().getMagic() violation = x > AntiCheatReloaded.getManager().getBackend().getMagic()
.XZ_SPEED_MAX_WATER_SPRINT() .XZ_SPEED_MAX_WATER_SPRINT()
|| z > AntiCheatReloaded.getManager().getBackend().getMagic() || z > AntiCheatReloaded.getManager().getBackend().getMagic()
.XZ_SPEED_MAX_WATER_SPRINT(); .XZ_SPEED_MAX_WATER_SPRINT();
} }
if (!b && !Utilities.isFullyInWater(player.getLocation()) if (!violation && !Utilities.isFullyInWater(player.getLocation())
&& Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D && Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D
&& !block.getType().equals(Material.LILY_PAD)) { && !block.getType().equals(Material.LILY_PAD)) {
b = true; violation = true;
} }
if (b) { if (violation) {
if (WATER_SPEED_VIOLATIONS.containsKey(uuid)) { if (WATER_SPEED_VIOLATIONS.containsKey(uuid)) {
int v = WATER_SPEED_VIOLATIONS.get(uuid); int v = WATER_SPEED_VIOLATIONS.get(uuid);
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic() if (v >= AntiCheatReloaded.getManager().getBackend().getMagic()
.WATER_SPEED_VIOLATION_MAX()) { .WATER_SPEED_VIOLATION_MAX()) {
WATER_SPEED_VIOLATIONS.put(uuid, 0); WATER_SPEED_VIOLATIONS.put(uuid, 0);
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " stood on water " + v + " times (can't stand on " "stood on water " + v + " times (can't stand on " + block.getType()
+ block.getType() + " or " + " or " + block.getRelative(BlockFace.DOWN).getType() + ")");
+ block.getRelative(BlockFace.DOWN).getType() + ")");
} else { } else {
WATER_SPEED_VIOLATIONS.put(uuid, v + 1); WATER_SPEED_VIOLATIONS.put(uuid, v + 1);
} }
@@ -105,8 +105,8 @@ public class WaterWalkCheck {
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) { if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
WATER_ASCENSION_VIOLATIONS.put(uuid, 0); WATER_ASCENSION_VIOLATIONS.put(uuid, 0);
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " stood on water " + v + " times (can't stand on " + block.getType() "stood on water " + v + " times (can't stand on " + block.getType() + " or "
+ " or " + block.getRelative(BlockFace.DOWN).getType() + ")"); + block.getRelative(BlockFace.DOWN).getType() + ")");
} else { } else {
WATER_ASCENSION_VIOLATIONS.put(uuid, v + 1); WATER_ASCENSION_VIOLATIONS.put(uuid, v + 1);
} }
@@ -70,19 +70,19 @@ public class YAxisCheck {
if (y1 > LAST_Y_COORD_CACHE.get(uuid) if (y1 > LAST_Y_COORD_CACHE.get(uuid)
&& Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic() && Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
.Y_MAXVIOLATIONS() .Y_MAXVIOLATIONS()
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) < AntiCheatReloaded.getManager() && (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) < AntiCheatReloaded
.getBackend().getMagic().Y_MAXVIOTIME()) { .getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
Location g = player.getLocation(); Location g = player.getLocation();
Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1); Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1);
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis()); LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) { if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
g.setY(LAST_Y_COORD_CACHE.get(uuid)); g.setY(LAST_Y_COORD_CACHE.get(uuid));
if (g.getBlock().getType() == Material.AIR) { if (g.getBlock().getType() == Material.AIR || g.getBlock().getType() == Material.CAVE_AIR) {
player.teleport(g); player.teleport(g);
} }
} }
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max =" "tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max ="
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")"); + AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
} else { } else {
if (Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic() if (Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
@@ -103,15 +103,15 @@ public class YAxisCheck {
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis()); LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) { if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
g.setY(LAST_Y_COORD_CACHE.get(uuid)); g.setY(LAST_Y_COORD_CACHE.get(uuid));
if (g.getBlock().getType() == Material.AIR) { if (g.getBlock().getType() == Material.AIR || g.getBlock().getType() == Material.CAVE_AIR) {
player.teleport(g); player.teleport(g);
} }
} }
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis in " return new CheckResult(CheckResult.Result.FAILED, "tried to fly on y-axis in " + i + " ms (min ="
+ i + " ms (min =" + AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")"); + AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")");
} else { } else {
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF() if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic()
+ 1 .Y_MAXDIFF() + 1
|| (System.currentTimeMillis() - LAST_Y_TIME.get(uuid)) > AntiCheatReloaded.getManager() || (System.currentTimeMillis() - LAST_Y_TIME.get(uuid)) > AntiCheatReloaded.getManager()
.getBackend().getMagic().Y_TIME()) { .getBackend().getMagic().Y_TIME()) {
LAST_Y_TIME.put(uuid, System.currentTimeMillis()); LAST_Y_TIME.put(uuid, System.currentTimeMillis());
@@ -0,0 +1,97 @@
/*
* 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.player;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.config.providers.Magic;
import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
public class IllegalInteract {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult performCheck(Player player, Event event) {
if (event instanceof BlockPlaceEvent) {
return checkBlockPlace(player, (BlockPlaceEvent) event);
} else if (event instanceof BlockBreakEvent) {
return checkBlockBreak(player, (BlockBreakEvent) event);
}
return PASS;
}
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
if (!isValidTarget(player, event.getBlock())) {
return new CheckResult(CheckResult.Result.FAILED,
"tried to break a block which was out of view");
}
return PASS;
}
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
if (!isValidTarget(player, event.getBlock())) {
return new CheckResult(CheckResult.Result.FAILED,
"tried to place a block out of their view");
}
return PASS;
}
private static boolean isValidTarget(Player player, Block block) {
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
double distance =
player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
: magic.BLOCK_MAX_DISTANCE();
Block targetBlock = player.getTargetBlockExact((int) Math.ceil(distance));
if (targetBlock == null) {
// TODO better check here
return true;
}
if (Utilities.isClimbableBlock(targetBlock)) {
if (targetBlock.getLocation().distance(player.getLocation()) <= distance) {
return true;
}
}
if (targetBlock.equals(block)) {
return true;
}
Location eyeLocation = player.getEyeLocation();
double yawDifference = KillauraAssist.calculateYawDifference(eyeLocation, block.getLocation());
double playerYaw = player.getEyeLocation().getYaw();
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
if (Math.round(angleDifference) > magic.ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE()) {
return false;
}
return true;
}
}
@@ -45,7 +45,7 @@ public class CommandBase {
public static final ChatColor AQUA = ChatColor.AQUA; public static final ChatColor AQUA = ChatColor.AQUA;
public static final Server SERVER = Bukkit.getServer(); public static final Server SERVER = Bukkit.getServer();
public static final String PERMISSIONS_ERROR = RED + "You don't have the permissions to use this command."; public static final String PERMISSIONS_ERROR = RED + "You don't have the permissions to use this command.";
public static final String MENU_END = "-----------------------------------------------------"; public static final String MENU_END = GOLD + "-----------------------------------------------------";
private final String name; private final String name;
private final String command; private final String command;
@@ -64,19 +64,23 @@ public class CommandBase {
public void run(CommandSender cs, String[] args) { public void run(CommandSender cs, String[] args) {
if (permission.get(cs)) { if (permission.get(cs)) {
execute(cs, args); execute(cs, args);
} else {
if (args == null) {
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
} else { } else {
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")"); cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
} }
} }
}
protected void execute(CommandSender cs, String[] args) { protected void execute(CommandSender cs, String[] args) {
return; // Stub return; // Stub
} }
public void sendHelp(CommandSender cs) { public void sendHelp(CommandSender cs) {
cs.sendMessage(RED + "== " + GRAY + getName() + RED + " =="); cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + ChatColor.GRAY + "Help Menu");
cs.sendMessage(RED + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage()); cs.sendMessage(GOLD + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage());
cs.sendMessage(RED + "Permission: " + GRAY + getPermission().toString()); cs.sendMessage(GOLD + "Permission: " + GRAY + getPermission().toString());
for (String string : getHelp()) { for (String string : getHelp()) {
cs.sendMessage(string); cs.sendMessage(string);
} }
@@ -33,6 +33,7 @@ import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
import com.rammelkast.anticheatreloaded.command.executors.CommandReload; import com.rammelkast.anticheatreloaded.command.executors.CommandReload;
import com.rammelkast.anticheatreloaded.command.executors.CommandReport; import com.rammelkast.anticheatreloaded.command.executors.CommandReport;
import com.rammelkast.anticheatreloaded.command.executors.CommandReset; import com.rammelkast.anticheatreloaded.command.executors.CommandReset;
import com.rammelkast.anticheatreloaded.command.executors.CommandVersion;
public class CommandHandler implements CommandExecutor { public class CommandHandler implements CommandExecutor {
@@ -46,6 +47,7 @@ public class CommandHandler implements CommandExecutor {
commands.add(new CommandReload()); commands.add(new CommandReload());
commands.add(new CommandReport()); commands.add(new CommandReport());
commands.add(new CommandReset()); commands.add(new CommandReset());
commands.add(new CommandVersion());
} }
@Override @Override
@@ -31,13 +31,12 @@ public class CommandHelp extends CommandBase {
private static final String USAGE = "anticheat help"; private static final String USAGE = "anticheat help";
private static final Permission PERMISSION = Permission.SYSTEM_HELP; private static final Permission PERMISSION = Permission.SYSTEM_HELP;
private static final String[] HELP = { private static final String[] HELP = {
RED + "/acr " + GRAY + "help", GOLD + "/acr " + GRAY + "help",
RED + "/acr " + GRAY + "reload", GOLD + "/acr " + GRAY + "reload",
RED + "/acr " + GRAY + "update", GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
RED + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]", GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
RED + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]", GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
RED + "/acr " + GRAY + "report " + WHITE + "[group/user]", GOLD + "/acr " + GRAY + "reset " + WHITE + "[user]",
RED + "/acr " + GRAY + "reset " + WHITE + "[user]",
}; };
public CommandHelp() { public CommandHelp() {
@@ -41,9 +41,9 @@ public class CommandReport extends CommandBase {
private static final String USAGE = "anticheat report [group/user]"; private static final String USAGE = "anticheat report [group/user]";
private static final Permission PERMISSION = Permission.SYSTEM_REPORT; private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
private static final String[] HELP = { private static final String[] HELP = {
GRAY + "Use: " + AQUA + "/anticheat report [group]" + GRAY + " to see all users in a given group", GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
GRAY + "Use: " + AQUA + "/anticheat report [user]" + GRAY + " to see a single user's report", GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
GRAY + "Use: " + AQUA + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report", GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
}; };
public CommandReport() { public CommandReport() {
@@ -71,7 +71,7 @@ public class CommandReport extends CommandBase {
int numPlayers = USER_MANAGER.getUsersInGroup(g).size(); int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players"); cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
} }
cs.sendMessage(GRAY + "Use " + AQUA + "/anticheat report [group]" + GRAY + " for a list of players in each group."); cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY + " for a list of players in each group.");
} else { } else {
// Test groups // Test groups
for (Group group : CONFIG.getGroups().getGroups()) { for (Group group : CONFIG.getGroups().getGroups()) {
@@ -81,6 +81,12 @@ public class CommandReport extends CommandBase {
} }
} }
Player targetPlayer = Bukkit.getPlayer(args[0]);
if (targetPlayer == null) {
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
return;
}
// Test users // Test users
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) { if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) {
@@ -104,7 +110,7 @@ public class CommandReport extends CommandBase {
String groupName = group == null ? "Low" : group.getName(); String groupName = group == null ? "Low" : group.getName();
int pages = (int) Math.ceil(((float) users.size()) / 7); int pages = (int) Math.ceil(((float) users.size()) / 7);
if (page <= pages && page > 0) { if (page <= pages && page > 0) {
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/" + pages + "]" + WHITE + "]---------------------"); cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Group: " + color + groupName); cs.sendMessage(GRAY + "Group: " + color + groupName);
for (int x = 0; x < 7; x++) { for (int x = 0; x < 7; x++) {
int index = ((page - 1) * 6) + (x + ((page - 1) * 1)); int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
@@ -116,7 +122,7 @@ public class CommandReport extends CommandBase {
cs.sendMessage(MENU_END); cs.sendMessage(MENU_END);
} else { } else {
if (pages == 0) { if (pages == 0) {
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------"); cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Group: " + color + groupName); cs.sendMessage(GRAY + "Group: " + color + groupName);
cs.sendMessage(GRAY + "There are no users in this group."); cs.sendMessage(GRAY + "There are no users in this group.");
cs.sendMessage(MENU_END); cs.sendMessage(MENU_END);
@@ -147,7 +153,7 @@ public class CommandReport extends CommandBase {
groupString += " (" + user.getLevel() + ")"; groupString += " (" + user.getLevel() + ")";
if (page <= pages && page > 0) { if (page <= pages && page > 0) {
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/" + pages + "]" + WHITE + "]---------------------"); cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + name); cs.sendMessage(GRAY + "Player: " + WHITE + name);
cs.sendMessage(GRAY + "Group: " + groupString); cs.sendMessage(GRAY + "Group: " + groupString);
for (int x = 0; x < 6; x++) { for (int x = 0; x < 6; x++) {
@@ -167,7 +173,7 @@ public class CommandReport extends CommandBase {
cs.sendMessage(MENU_END); cs.sendMessage(MENU_END);
} else { } else {
if (pages == 0 && page == 1) { if (pages == 0 && page == 1) {
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------"); cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + name); cs.sendMessage(GRAY + "Player: " + WHITE + name);
cs.sendMessage(GRAY + "Group: " + groupString); cs.sendMessage(GRAY + "Group: " + groupString);
cs.sendMessage(GRAY + "This user has not failed any checks."); cs.sendMessage(GRAY + "This user has not failed any checks.");
@@ -21,7 +21,6 @@ package com.rammelkast.anticheatreloaded.command.executors;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.command.CommandBase; import com.rammelkast.anticheatreloaded.command.CommandBase;
@@ -42,6 +41,7 @@ public class CommandReset extends CommandBase {
super(NAME, COMMAND, USAGE, HELP, PERMISSION); super(NAME, COMMAND, USAGE, HELP, PERMISSION);
} }
@SuppressWarnings("deprecation")
@Override @Override
protected void execute(CommandSender cs, String[] args) { protected void execute(CommandSender cs, String[] args) {
User user; User user;
@@ -55,7 +55,7 @@ public class CommandReset extends CommandBase {
user.resetLevel(); user.resetLevel();
user.clearMessages(); user.clearMessages();
AntiCheatReloaded.getManager().getBackend().resetChatLevel(user); AntiCheatReloaded.getManager().getBackend().resetChatLevel(user);
cs.sendMessage(args[0] + GREEN + " has been reset."); cs.sendMessage(GOLD + args[0] + GRAY + " has been reset.");
} else { } else {
cs.sendMessage(RED + "Player: " +args[0] + " not found."); cs.sendMessage(RED + "Player: " +args[0] + " not found.");
} }
@@ -0,0 +1,58 @@
/*
* 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.command.executors;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.Permission;
import com.rammelkast.anticheatreloaded.util.UpdateManager;
public class CommandVersion extends CommandBase {
private static final String NAME = "AntiCheatReloaded Version";
private static final String COMMAND = "version";
private static final String USAGE = "anticheat version";
private static final Permission PERMISSION = Permission.SYSTEM_NOTICE;
private static final String[] HELP = {
GRAY + "Use: " + AQUA + "/anticheat version" + GRAY + " to get update information", };
public CommandVersion() {
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
}
@Override
protected void execute(CommandSender cs, String[] args) {
UpdateManager updateManager = AntiCheatReloaded.getUpdateManager();
String status = RED + "behind";
if (updateManager.isLatest()) {
if (updateManager.isAhead()) {
status = GREEN + "ahead";
} else {
status = GOLD + "up-to-date";
}
}
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "ACR " + GRAY + "You are running version " + GOLD
+ updateManager.getCurrentVersion() + GRAY + ". The latest version is " + GOLD
+ updateManager.getLatestVersion() + GRAY + ". This means you are " + status + GRAY + ".");
}
}
@@ -57,10 +57,13 @@ public class Configuration {
// Now load others // Now load others
enterprise = new Enterprise(plugin, this); enterprise = new Enterprise(plugin, this);
flatfiles = new ArrayList<ConfigurationFile>() {{ flatfiles = new ArrayList<ConfigurationFile>() {
private static final long serialVersionUID = 4497798966909062852L;
{
add(config); add(config);
add(enterprise); add(enterprise);
}}; }
};
dbfiles = new ArrayList<ConfigurationTable>(); dbfiles = new ArrayList<ConfigurationTable>();
@@ -170,6 +170,7 @@ public class ConfigurationFile {
return path; return path;
} }
@SuppressWarnings("unchecked")
public T getValue() { public T getValue() {
return (T) value; return (T) value;
} }
@@ -180,6 +181,7 @@ public class ConfigurationFile {
return value; return value;
} }
@SuppressWarnings("unchecked")
public T getDefaultValue() { public T getDefaultValue() {
return (T) getDefaultConfigFile().get(path); return (T) getDefaultConfigFile().get(path);
} }
@@ -104,6 +104,7 @@ public class ConfigurationTable {
return false; return false;
} }
@SuppressWarnings("deprecation")
public void convertToUUID(String colName) { public void convertToUUID(String colName) {
String sqlSelect = "SELECT " + colName + " FROM " + getFullTable(); String sqlSelect = "SELECT " + colName + " FROM " + getFullTable();
String sqlUpdate = "UPDATE " + getFullTable() + " SET " + colName + " = ? WHERE " + colName + " = ?"; String sqlUpdate = "UPDATE " + getFullTable() + " SET " + colName + " = ? WHERE " + colName + " = ?";
@@ -33,9 +33,9 @@ public class Config extends ConfigurationFile {
public ConfigValue<Boolean> verboseStartup; public ConfigValue<Boolean> verboseStartup;
public ConfigValue<Boolean> silentMode; public ConfigValue<Boolean> silentMode;
public ConfigValue<Boolean> exemptOp; public ConfigValue<Boolean> exemptOp;
public ConfigValue<Boolean> eventChains; public ConfigValue<Boolean> eventChains;
public ConfigValue<Boolean> enterprise; public ConfigValue<Boolean> enterprise;
public ConfigValue<Boolean> debugMode;
public ConfigValue<Boolean> blockChatSpamSpeed; public ConfigValue<Boolean> blockChatSpamSpeed;
public ConfigValue<Boolean> blockCommandSpamSpeed; public ConfigValue<Boolean> blockCommandSpamSpeed;
@@ -64,6 +64,7 @@ public class Config extends ConfigurationFile {
exemptOp = new ConfigValue<Boolean>("system.exempt-op"); exemptOp = new ConfigValue<Boolean>("system.exempt-op");
eventChains = new ConfigValue<Boolean>("system.event-chains"); eventChains = new ConfigValue<Boolean>("system.event-chains");
enterprise = new ConfigValue<Boolean>("system.enterprise"); enterprise = new ConfigValue<Boolean>("system.enterprise");
debugMode = new ConfigValue<Boolean>("system.debug-mode");
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed"); blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition"); blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
@@ -74,6 +74,6 @@ public class YamlLevelsHolder extends ConfigurationFile implements Levels {
} }
private void saveLevel(UUID uuid, int level) { private void saveLevel(UUID uuid, int level) {
new ConfigValue<Integer>(uuid.toString(), false).setValue(new Integer(level)); new ConfigValue<Integer>(uuid.toString(), false).setValue(level);
} }
} }
@@ -154,10 +154,6 @@ public interface Magic {
* Number of chat spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE. * Number of chat spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE.
*/ */
public int CHAT_ACTION_TWO_LEVEL(); public int CHAT_ACTION_TWO_LEVEL();
/**
* Number of times a player can be caught in-flight before action is taken; Type=INTEGER, Leniency=INCREASE.
*/
public int FLIGHT_LIMIT();
/** /**
* Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE. * Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE.
*/ */
@@ -235,7 +231,7 @@ public interface Magic {
*/ */
public int COMMAND_REPEAT_MIN(); public int COMMAND_REPEAT_MIN();
/** /**
* Minimum time between chats; Type=SYSTEM, Leniency=INCREASE. * Minimum time between chats; Type=SYSTEM, Leniency=DECREASE.
*/ */
public int CHAT_MIN(); public int CHAT_MIN();
/** /**
@@ -245,7 +241,7 @@ public interface Magic {
/** /**
* Maximum speed you can travel while sprinting; Type=DOUBLE, Leniency=INCREASE. * Maximum speed you can travel while sprinting; Type=DOUBLE, Leniency=INCREASE.
*/ */
public double SPRINT_MIN(); public double SPRINT_MAX();
/** /**
* Minimum time in between block breaks; Type=INTEGER, Leniency=DECREASE. * Minimum time in between block breaks; Type=INTEGER, Leniency=DECREASE.
*/ */
@@ -263,7 +259,7 @@ public interface Magic {
*/ */
public double BOW_ERROR(); public double BOW_ERROR();
/** /**
* Minimum distance a player can break a block from; Type=DOUBLE, Leniency=INCREASE. * Maximum distance a player can break a block from; Type=DOUBLE, Leniency=INCREASE.
*/ */
public double BLOCK_MAX_DISTANCE(); public double BLOCK_MAX_DISTANCE();
/** /**
@@ -271,11 +267,11 @@ public interface Magic {
*/ */
public double BLOCK_MAX_DISTANCE_CREATIVE(); public double BLOCK_MAX_DISTANCE_CREATIVE();
/** /**
* Minimum distance a player can damage an entity from; Type=DOUBLE, Leniency=INCREASE. * Maximum distance a player can damage an entity from; Type=DOUBLE, Leniency=INCREASE.
*/ */
public double ENTITY_MAX_DISTANCE(); public double ENTITY_MAX_DISTANCE();
/** /**
* Minimum distance a player can damage an entity from in creative mode; Type=DOUBLE, Leniency=INCREASE. * Maximum distance a player can damage an entity from in creative mode; Type=DOUBLE, Leniency=INCREASE.
*/ */
public double ENTITY_MAX_DISTANCE_CREATIVE(); public double ENTITY_MAX_DISTANCE_CREATIVE();
/** /**
@@ -366,16 +362,32 @@ public interface Magic {
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE. * Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
*/ */
public int TELEPORT_MIN(); public int TELEPORT_MIN();
/**
* Maximum amount of times a player can hit a killaura bot; Type=INTEGER, Leniency=INCREASE.
*/
public int KILLAURA_BOTHITS();
/** /**
* Maximum amount of packets a player can send in a second; Type=INTEGER, Leniency=INCREASE. * Maximum amount of packets a player can send in a second; Type=INTEGER, Leniency=INCREASE.
*/ */
public int BLINK_PACKET(); public int BLINK_PACKET();
/** /**
* Maximum amount of low/zero velocity before flagging; Type=INTEGER, Leniency=INCREASE. * The average ping settings used to account for lag; TYPE=INTEGER, Leniency=INCREASE
*/ */
public int VELOCITY_AMT(); public int BLINK_AVERAGE_PING();
/**
* Maximum amount of low/zero velocity moments before flagging; Type=INTEGER, Leniency=INCREASE.
*/
public int VELOCITY_MAX_FLAGS();
/**
* The maximum angle difference allowed when attacking; TYPE=INTEGER, Leniency=INCREASE
*/
public int KILLAURA_MAX_ANGLE_DIFFERENCE();
/**
* 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
*/
public int ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE();
} }
@@ -30,6 +30,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
@@ -55,17 +56,28 @@ public class BlockListener extends EventListener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) { public void onBlockPlace(BlockPlaceEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (player != null && getCheckManager().willCheck(player, CheckType.FAST_PLACE)) { boolean noHack = true;
if (getCheckManager().willCheck(player, CheckType.FAST_PLACE)) {
CheckResult result = getBackend().checkFastPlace(player); CheckResult result = getBackend().checkFastPlace(player);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_PLACE); log(result.getMessage(), player, CheckType.FAST_PLACE);
} else { noHack = false;
decrease(player);
getBackend().logBlockPlace(player);
} }
} }
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
CheckResult result = IllegalInteract.performCheck(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
noHack = false;
}
}
if (noHack) {
decrease(player);
getBackend().logBlockPlace(player);
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners()); AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
} }
@@ -74,7 +86,6 @@ public class BlockListener extends EventListener {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final Block block = event.getBlock(); final Block block = event.getBlock();
boolean noHack = true; boolean noHack = true;
if (player != null) {
CheckResult result; CheckResult result;
if (getCheckManager().willCheck(player, CheckType.FAST_BREAK)) { if (getCheckManager().willCheck(player, CheckType.FAST_BREAK)) {
result = getBackend().checkFastBreak(player, block); result = getBackend().checkFastBreak(player, block);
@@ -101,6 +112,13 @@ public class BlockListener extends EventListener {
noHack = false; noHack = false;
} }
} }
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
result = IllegalInteract.performCheck(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
noHack = false;
}
} }
if (noHack) { if (noHack) {
decrease(player); decrease(player);
@@ -36,6 +36,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck; import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck; import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
import com.rammelkast.anticheatreloaded.util.Distance; import com.rammelkast.anticheatreloaded.util.Distance;
@@ -143,19 +144,27 @@ public class EntityListener extends EventListener {
noHack = false; noHack = false;
} }
} }
if (getCheckManager().willCheck(player, CheckType.FORCEFIELD)) { if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = getBackend().checkSprintDamage(player); CheckResult result = getBackend().checkSprintDamage(player);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FORCEFIELD); log(result.getMessage(), player, CheckType.KILLAURA);
noHack = false; noHack = false;
} }
} }
if (getCheckManager().willCheck(player, CheckType.FORCEFIELD)) { if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = getBackend().checkSight(player, e.getEntity()); CheckResult result = KillAuraCheck.checkAngle(player, event);
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FORCEFIELD); log(result.getMessage(), player, CheckType.KILLAURA);
noHack = false;
}
}
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = KillAuraCheck.checkFightSpeed(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA);
noHack = false; noHack = false;
} }
} }
@@ -19,6 +19,7 @@
package com.rammelkast.anticheatreloaded.event; package com.rammelkast.anticheatreloaded.event;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@@ -28,6 +29,7 @@ import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.manage.*; import com.rammelkast.anticheatreloaded.manage.*;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.HashMap; import java.util.HashMap;
@@ -45,13 +47,24 @@ public class EventListener implements Listener {
public static void log(String message, Player player, CheckType type) { public static void log(String message, Player player, CheckType type) {
User user = getUserManager().getUser(player.getUniqueId()); User user = getUserManager().getUser(player.getUniqueId());
if (message == null || message.equals("")) {
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.DARK_GRAY + " | " + ChatColor.GRAY + message + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + VersionUtil.getPlayerPing(player) + "ms";
}
if (user != null) { // npc if (user != null) { // npc
logCheat(type, user); logCheat(type, user);
if (user.increaseLevel(type) && message != null) { if (user.increaseLevel(type)) {
AntiCheatReloaded.getManager().log(message); AntiCheatReloaded.getManager().log(message);
} }
removeDecrease(user); removeDecrease(user);
} }
if (CONFIG.getConfig().debugMode.getValue()) {
player.sendMessage(message);
} else {
AntiCheatReloaded.getPlugin().sendToStaff(message);
}
} }
private static void logCheat(CheckType type, User user) { private static void logCheat(CheckType type, User user) {
@@ -50,6 +50,8 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded; import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
@@ -76,7 +78,8 @@ public class PlayerListener extends EventListener {
CheckResult result = getBackend().checkCommandSpam(player, event.getMessage()); CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
if (!silentMode()) player.sendMessage(ChatColor.RED + result.getMessage()); if (!silentMode())
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
getBackend().processCommandSpammer(player); getBackend().processCommandSpammer(player);
log(null, player, CheckType.COMMAND_SPAM); log(null, player, CheckType.COMMAND_SPAM);
} }
@@ -172,7 +175,7 @@ public class PlayerListener extends EventListener {
if (result.failed()) { if (result.failed()) {
event.setCancelled(!silentMode()); event.setCancelled(!silentMode());
if (!result.getMessage().equals("") && !silentMode()) { if (!result.getMessage().equals("") && !silentMode()) {
player.sendMessage(ChatColor.RED + result.getMessage()); player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
} }
getBackend().processChatSpammer(player); getBackend().processChatSpammer(player);
AntiCheatReloaded.sendToMainThread(new Runnable() { AntiCheatReloaded.sendToMainThread(new Runnable() {
@@ -188,7 +191,7 @@ public class PlayerListener extends EventListener {
CheckResult result = getBackend().checkChatUnicode(player, event.getMessage()); CheckResult result = getBackend().checkChatUnicode(player, event.getMessage());
if (result.failed()) { if (result.failed()) {
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(ChatColor.RED + result.getMessage()); player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
AntiCheatReloaded.sendToMainThread(new Runnable() { AntiCheatReloaded.sendToMainThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@@ -243,11 +246,20 @@ public class PlayerListener extends EventListener {
Player player = event.getPlayer(); Player player = event.getPlayer();
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (inv.getItemInMainHand().getType() == Material.BOW) { ItemStack itemInHand = ((event.getHand() == EquipmentSlot.HAND) ? inv.getItemInMainHand() : inv.getItemInOffHand());
if (itemInHand.getType() == Material.BOW) {
getBackend().logBowWindUp(player); getBackend().logBowWindUp(player);
} else if (Utilities.isFood(inv.getItemInMainHand().getType()) || Utilities.isFood(inv.getItemInOffHand().getType())) { } else if (Utilities.isFood(itemInHand.getType()) || Utilities.isFood(itemInHand.getType())) {
getBackend().logEatingStart(player); getBackend().logEatingStart(player);
} }
if (itemInHand.getType() == Material.FIREWORK_ROCKET) {
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
if (player.isGliding()) {
// TODO config max elytra height?
ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId().toString(), 9999.99D);
}
}
} }
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
@@ -297,17 +309,6 @@ public class PlayerListener extends EventListener {
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
String section = "\u00a7";
if (getCheckManager().willCheck(player, CheckType.ZOMBE_FLY)) {
player.sendMessage(section + "f " + section + "f " + section + "1 " + section + "0 " + section + "2 " + section + "4");
}
if (getCheckManager().willCheck(player, CheckType.ZOMBE_CHEAT)) {
player.sendMessage(section + "f " + section + "f " + section + "2 " + section + "0 " + section + "4 " + section + "8");
}
if (getCheckManager().willCheck(player, CheckType.ZOMBE_NOCLIP)) {
player.sendMessage(section + "f " + section + "f " + section + "4 " + section + "0 " + section + "9 " + section + "6");
}
getBackend().logJoin(player); getBackend().logJoin(player);
User user = new User(player.getUniqueId()); User user = new User(player.getUniqueId());
@@ -324,6 +325,10 @@ public class PlayerListener extends EventListener {
} }
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners()); AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
if (player.hasPermission("anticheat.admin") && !AntiCheatReloaded.getUpdateManager().isLatest()) {
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + "Your version of AntiCheatReloaded is outdated! You can download " + AntiCheatReloaded.getUpdateManager().getLatestVersion() + " from the Spigot forums or DevBukkit.");
}
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
@@ -343,13 +348,6 @@ public class PlayerListener extends EventListener {
//KillAuraCheck.doMove(event); //KillAuraCheck.doMove(event);
//TODO //TODO
if (getCheckManager().willCheckQuick(player, CheckType.SPRINT)) {
CheckResult result = getBackend().checkSprintStill(player, from, to);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.SPRINT);
}
}
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) { if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
CheckResult result = FlightCheck.runCheck(player, distance); CheckResult result = FlightCheck.runCheck(player, distance);
if (result.failed()) { if (result.failed()) {
@@ -366,10 +364,10 @@ public class PlayerListener extends EventListener {
log(result.getMessage(), player, CheckType.FLIGHT); log(result.getMessage(), player, CheckType.FLIGHT);
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRA)) { if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
CheckResult result = ElytraCheck.runCheck(player, distance); CheckResult result = ElytraCheck.runCheck(player, distance);
if (result.failed()) { if (result.failed()) {
log(result.getMessage(), player, CheckType.ELYTRA); log(result.getMessage(), player, CheckType.ELYTRAFLY);
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) { if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) {
@@ -434,7 +432,7 @@ public class PlayerListener extends EventListener {
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.SNEAK)) { if (getCheckManager().willCheckQuick(player, CheckType.SNEAK)) {
CheckResult result = getBackend().checkSneak(player, x, z); CheckResult result = getBackend().checkSneak(player, event.getTo(), x, z);
if (result.failed()) { if (result.failed()) {
if (!silentMode()) { if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone())); event.setTo(user.getGoodLocation(from.clone()));
@@ -11,12 +11,11 @@
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.-
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.rammelkast.anticheatreloaded.manage; package com.rammelkast.anticheatreloaded.manage;
import java.util.Map; import java.util.Map;
@@ -33,7 +32,6 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
/** /**
* The internal hub for all managers. * The internal hub for all managers.
*/ */
public class AntiCheatManager { public class AntiCheatManager {
private static AntiCheatReloaded plugin = null; private static AntiCheatReloaded plugin = null;
private static Configuration configuration; private static Configuration configuration;
@@ -71,12 +71,12 @@ public class LoggingManager {
} }
public void debugLog(String message) { public void debugLog(String message) {
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.GRAY + message); Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + message);
logToLogs(message); logToLogs(message);
} }
public void logToConsole(String message) { public void logToConsole(String message) {
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + message); Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + message);
} }
public void logToFile(String message) { public void logToFile(String message) {
@@ -36,12 +36,8 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
public class UserManager { public class UserManager {
private List<User> users = new ArrayList<User>(); private List<User> users = new ArrayList<User>();
private static AntiCheatManager manager; private AntiCheatManager manager;
private static Configuration config; private Configuration config;
private static final ChatColor GRAY = ChatColor.GRAY;
private static final ChatColor GOLD = ChatColor.GOLD;
private static final ChatColor RED = ChatColor.RED;
/** /**
* Initialize the user manager * Initialize the user manager
* *
@@ -162,15 +158,6 @@ public class UserManager {
} }
} }
/**
* Get the alert to use for a check being failed
*
* @return check fail alert message
*/
public List<String> getAlert() {
return config.getLang().ALERT();
}
/** /**
* Fire an alert * Fire an alert
* *
@@ -179,19 +166,6 @@ public class UserManager {
* @param type The CheckType that triggered the alert * @param type The CheckType that triggered the alert
*/ */
public void alert(User user, Group group, CheckType type) { public void alert(User user, Group group, CheckType type) {
ArrayList<String> messageArray = new ArrayList<String>();
List<String> alert = getAlert();
for (int i = 0; i < alert.size(); i++) {
String message = alert.get(i);
if (!message.equals("")) {
message = message.replaceAll("&player", GOLD + user.getName() + GRAY);
message = message.replaceAll("&check", GOLD + CheckType.getName(type) + GRAY);
message = message.replaceAll("&group", group.getColor() + group.getName() + GRAY);
message = message.replaceAll("&level", "" + user.getLevel() + GRAY);
messageArray.add(message);
}
}
Utilities.alert(messageArray);
execute(user, group.getActions(), type); execute(user, group.getActions(), type);
} }
@@ -226,16 +200,16 @@ public class UserManager {
} }
final String name = user.getName(); final String name = user.getName();
for (String event : actions) { for (String event : actions) {
event = event.replaceAll("&player", name).replaceAll("&world", user.getPlayer().getWorld().getName()).replaceAll("&check", type.name()); event = event.replaceAll("%player%", name).replaceAll("%world%", user.getPlayer().getWorld().getName()).replaceAll("%check%", type.name());
if (event.startsWith("COMMAND[")) { if (event.startsWith("COMMAND[")) {
for (String cmd : Utilities.getCommands(event)) { for (String cmd : Utilities.getCommands(event)) {
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
} }
} else if (event.equalsIgnoreCase("KICK")) { } else if (event.equalsIgnoreCase("KICK")) {
user.getPlayer().kickPlayer(RED + kickReason); user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', kickReason));
AntiCheatReloaded.getPlugin().onPlayerKicked(); AntiCheatReloaded.getPlugin().onPlayerKicked();
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")"; String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().KICK_BROADCAST().replaceAll("%player%", name) + " (" + CheckType.getName(type) + ")");
if (!msg.equals("")) { if (!msg.equals("")) {
manager.log(msg); manager.log(msg);
manager.playerLog(msg); manager.playerLog(msg);
@@ -244,13 +218,13 @@ public class UserManager {
List<String> message = warning; List<String> message = warning;
for (String string : message) { for (String string : message) {
if (!string.equals("")) { if (!string.equals("")) {
user.getPlayer().sendMessage(RED + string); user.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', string));
} }
} }
} else if (event.equalsIgnoreCase("BAN")) { } else if (event.equalsIgnoreCase("BAN")) {
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), RED + banReason, null, null); Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), ChatColor.translateAlternateColorCodes('&', banReason), null, null);
user.getPlayer().kickPlayer(RED + banReason); user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', banReason));
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")"; String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().BAN_BROADCAST().replaceAll("%player%", name) + " (" + CheckType.getName(type) + ")");
if (!msg.equals("")) { if (!msg.equals("")) {
manager.log(msg); manager.log(msg);
manager.playerLog(msg); manager.playerLog(msg);
@@ -59,7 +59,7 @@ import com.google.gson.JsonPrimitive;
* <p> * <p>
* Check out https://bStats.org/ to learn more about bStats! * Check out https://bStats.org/ to learn more about bStats!
*/ */
@SuppressWarnings({ "WeakerAccess", "unused" }) @SuppressWarnings({ "unused" })
public class Metrics { public class Metrics {
static { static {
@@ -29,6 +29,8 @@ public class Distance {
private final double YDiff; private final double YDiff;
private final double ZDiff; private final double ZDiff;
private final Location from;
public Distance(Location from, Location to) { public Distance(Location from, Location to) {
l1Y = to.getY(); l1Y = to.getY();
l2Y = from.getY(); l2Y = from.getY();
@@ -36,6 +38,8 @@ public class Distance {
XDiff = Math.abs(to.getX() - from.getX()); XDiff = Math.abs(to.getX() - from.getX());
ZDiff = Math.abs(to.getZ() - from.getZ()); ZDiff = Math.abs(to.getZ() - from.getZ());
YDiff = Math.abs(l1Y - l2Y); YDiff = Math.abs(l1Y - l2Y);
this.from = from;
} }
public double fromY() { public double fromY() {
@@ -57,4 +61,8 @@ public class Distance {
public double getYDifference() { public double getYDifference() {
return YDiff; return YDiff;
} }
public Location getFrom() {
return this.from;
}
} }
@@ -23,13 +23,13 @@ import org.bukkit.command.CommandSender;
public enum Permission { public enum Permission {
/* Check Nodes */ /* Check Nodes */
CHECK_ZOMBE_FLY, CHECK_ZOMBE_NOCLIP, CHECK_ZOMBE_CHEAT, CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK, CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, 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_FORCEFIELD, CHECK_LONGREACH, 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_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT,
/* System Nodes */ /* System Nodes */
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_SPY, SYSTEM_HELP, SYSTEM_UPDATE, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE, SYSTEM_LOG, SYSTEM_RESET, SYSTEM_SPY, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD; SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD;
private static final String PERMISSION_ALL = "anticheat.*"; private static final String PERMISSION_ALL = "anticheat.*";
@@ -0,0 +1,163 @@
/*
* 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
public class UpdateManager {
public static final int RESOURCE_ID = 23799;
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
+ RESOURCE_ID;
private final String latestVersion;
private final boolean isLatest;
private final boolean isAhead;
public UpdateManager() {
this.latestVersion = this.getOnlineData(SPIGOT_VERSION_URL);
if (this.latestVersion == null) {
this.isLatest = true;
this.isAhead = false;
return;
}
int splitCompare = 0;
try {
VersionSplit currentSplit = new VersionSplit(AntiCheatReloaded.getVersion());
VersionSplit newSplit = new VersionSplit(this.latestVersion);
splitCompare = currentSplit.compareTo(newSplit);
} catch (Exception e) {}
this.isLatest = splitCompare >= 0;
this.isAhead = splitCompare > 0;
}
private String getOnlineData(String url) {
String data = null;
InputStream stream = null;
try {
stream = new URL(url).openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream, Charset.forName("UTF-8")));
StringBuilder builder = new StringBuilder();
int readChar;
while ((readChar = reader.read()) != -1) {
builder.append((char) readChar);
}
data = builder.toString();
} catch (IOException exception) {}
finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
}
}
}
return data;
}
public boolean isLatest() {
return this.isLatest;
}
public boolean isAhead() {
return this.isAhead;
}
public String getCurrentVersion() {
return AntiCheatReloaded.getVersion();
}
public String getLatestVersion() {
return this.latestVersion;
}
public class VersionSplit implements Comparable<VersionSplit> {
private final int major, minor, build;
public VersionSplit(String version) throws Exception {
if (version.endsWith("-ALPHA")) {
version = version.substring(0, version.length() - 6);
}
String[] versionSplit = version.split("\\.");
if (versionSplit.length != 3) {
// Illegal version
throw new Exception("Version " + version + " is illegal!");
}
try {
int major = Integer.parseInt(versionSplit[0]);
int minor = Integer.parseInt(versionSplit[1]);
int build = Integer.parseInt(versionSplit[2]);
if (major <= 0) {
throw new Exception("Illegal version!");
}
this.major = major;
this.minor = minor;
this.build = build;
} catch (Exception e) {
throw new Exception("Illegal version!");
}
}
@Override
public int compareTo(VersionSplit other) {
if (other.major == this.major) {
if (other.minor == this.minor) {
if (other.build == this.build) {
return 0;
}
if (other.build > this.build) {
return -1;
}
return 1;
}
if (other.minor > this.minor) {
return -1;
}
return 1;
}
if (other.major > this.major) {
return -1;
}
return 1;
}
public int getMajor() {
return major;
}
public int getMinor() {
return minor;
}
public int getBuild() {
return build;
}
}
}
@@ -19,7 +19,13 @@
package com.rammelkast.anticheatreloaded.util; package com.rammelkast.anticheatreloaded.util;
import org.bukkit.Bukkit; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@@ -29,15 +35,6 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.NumberConversions; import org.bukkit.util.NumberConversions;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public final class Utilities { public final class Utilities {
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>(); private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
private static final List<Material> FOOD = new ArrayList<Material>(); private static final List<Material> FOOD = new ArrayList<Material>();
@@ -45,24 +42,6 @@ public final class Utilities {
public static final String SPY_METADATA = "ac-spydata"; public static final String SPY_METADATA = "ac-spydata";
/**
* Send a hack level alert to players and console
*
* @param message List of strings to send as the alert
*/
public static void alert(List<String> message) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (Permission.SYSTEM_ALERT.get(player)) {
for (String msg : message) {
player.sendMessage(msg);
}
}
}
for (String msg : message) {
AntiCheatReloaded.getManager().log(msg);
}
}
/** /**
* Check if only the block beneath them is standable (includes water + lava) * Check if only the block beneath them is standable (includes water + lava)
* *
@@ -70,9 +49,8 @@ public final class Utilities {
* @return true if they cannot stand there * @return true if they cannot stand there
*/ */
public static boolean cantStandAtSingle(Block block) { public static boolean cantStandAtSingle(Block block) {
// TODO: Implement Better to reduce false positives (done? lets test...)
Block otherBlock = block.getLocation().add(0, -0.5, 0).getBlock(); Block otherBlock = block.getLocation().add(0, -0.5, 0).getBlock();
boolean center = otherBlock.getType() == Material.AIR; boolean center = otherBlock.getType() == Material.AIR || otherBlock.getType() == Material.CAVE_AIR;
return center; return center;
} }
@@ -128,7 +106,7 @@ public final class Utilities {
* @return true if the player can stand here * @return true if the player can stand here
*/ */
public static boolean canStand(Block block) { public static boolean canStand(Block block) {
return !(block.isLiquid() || block.getType() == Material.AIR); return !(block.isLiquid() || block.getType() == Material.AIR || block.getType() == Material.CAVE_AIR);
} }
/** /**
@@ -181,7 +159,7 @@ public final class Utilities {
public static boolean isHoveringOverWater(Location player, int blocks) { public static boolean isHoveringOverWater(Location player, int blocks) {
for (int i = player.getBlockY(); i > player.getBlockY() - blocks; i--) { for (int i = player.getBlockY(); i > player.getBlockY() - blocks; i--) {
Block newloc = (new Location(player.getWorld(), player.getBlockX(), i, player.getBlockZ())).getBlock(); Block newloc = (new Location(player.getWorld(), player.getBlockX(), i, player.getBlockZ())).getBlock();
if (newloc.getType() != Material.AIR) { if (newloc.getType() != Material.AIR && newloc.getType() != Material.CAVE_AIR) {
return newloc.isLiquid(); return newloc.isLiquid();
} }
} }
@@ -228,7 +206,6 @@ public final class Utilities {
public static boolean isSlab(Block block) { public static boolean isSlab(Block block) {
Material type = block.getType(); Material type = block.getType();
return type.name().endsWith("SLAB"); return type.name().endsWith("SLAB");
// TODO does this even work?
} }
/** /**
@@ -240,7 +217,6 @@ public final class Utilities {
public static boolean isStair(Block block) { public static boolean isStair(Block block) {
Material type = block.getType(); Material type = block.getType();
return type.name().endsWith("STAIRS"); return type.name().endsWith("STAIRS");
// TODO does this even work?
} }
/** /**
@@ -417,7 +393,7 @@ public final class Utilities {
return false; return false;
} }
} }
return false; return true;
} }
/** /**
@@ -434,7 +410,7 @@ public final class Utilities {
return false; return false;
} }
} }
return false; return true;
} }
/** /**
@@ -481,6 +457,7 @@ public final class Utilities {
*/ */
public static ArrayList<String> stringToList(final String string) { public static ArrayList<String> stringToList(final String string) {
return new ArrayList<String>() { return new ArrayList<String>() {
private static final long serialVersionUID = 364115444874638230L;
{ {
add(string); add(string);
} }
@@ -528,7 +505,7 @@ public final class Utilities {
} }
static { static {
// START INSTANT BREAK MATERIALS // Start instant break materials
INSTANT_BREAK.add(Material.COMPARATOR); INSTANT_BREAK.add(Material.COMPARATOR);
INSTANT_BREAK.add(Material.REPEATER); INSTANT_BREAK.add(Material.REPEATER);
INSTANT_BREAK.add(Material.TORCH); INSTANT_BREAK.add(Material.TORCH);
@@ -546,13 +523,11 @@ public final class Utilities {
INSTANT_BREAK.add(Material.INFESTED_STONE_BRICKS); INSTANT_BREAK.add(Material.INFESTED_STONE_BRICKS);
INSTANT_BREAK.add(Material.TNT); INSTANT_BREAK.add(Material.TNT);
INSTANT_BREAK.add(Material.SLIME_BLOCK); INSTANT_BREAK.add(Material.SLIME_BLOCK);
INSTANT_BREAK.add(Material.HONEY_BLOCK);
INSTANT_BREAK.add(Material.CARROTS); INSTANT_BREAK.add(Material.CARROTS);
INSTANT_BREAK.add(Material.DEAD_BUSH); INSTANT_BREAK.add(Material.DEAD_BUSH);
INSTANT_BREAK.add(Material.FERN); INSTANT_BREAK.add(Material.FERN);
INSTANT_BREAK.add(Material.LARGE_FERN); INSTANT_BREAK.add(Material.LARGE_FERN);
INSTANT_BREAK.add(Material.CHORUS_FLOWER); INSTANT_BREAK.add(Material.CHORUS_FLOWER);
INSTANT_BREAK.add(Material.CORNFLOWER);
INSTANT_BREAK.add(Material.SUNFLOWER); INSTANT_BREAK.add(Material.SUNFLOWER);
INSTANT_BREAK.add(Material.LILY_PAD); INSTANT_BREAK.add(Material.LILY_PAD);
INSTANT_BREAK.add(Material.MELON_STEM); INSTANT_BREAK.add(Material.MELON_STEM);
@@ -564,7 +539,6 @@ public final class Utilities {
INSTANT_BREAK.add(Material.PUMPKIN_STEM); INSTANT_BREAK.add(Material.PUMPKIN_STEM);
INSTANT_BREAK.add(Material.ATTACHED_PUMPKIN_STEM); INSTANT_BREAK.add(Material.ATTACHED_PUMPKIN_STEM);
INSTANT_BREAK.add(Material.ACACIA_SAPLING); INSTANT_BREAK.add(Material.ACACIA_SAPLING);
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
INSTANT_BREAK.add(Material.BIRCH_SAPLING); INSTANT_BREAK.add(Material.BIRCH_SAPLING);
INSTANT_BREAK.add(Material.DARK_OAK_SAPLING); INSTANT_BREAK.add(Material.DARK_OAK_SAPLING);
INSTANT_BREAK.add(Material.JUNGLE_SAPLING); INSTANT_BREAK.add(Material.JUNGLE_SAPLING);
@@ -574,9 +548,20 @@ public final class Utilities {
INSTANT_BREAK.add(Material.TALL_GRASS); INSTANT_BREAK.add(Material.TALL_GRASS);
INSTANT_BREAK.add(Material.TALL_SEAGRASS); INSTANT_BREAK.add(Material.TALL_SEAGRASS);
INSTANT_BREAK.add(Material.WHEAT); INSTANT_BREAK.add(Material.WHEAT);
// END INSTANT BREAK MATERIALS // Start 1.14 objects
if (VersionUtil.isOfVersion("v1_14")) {
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
INSTANT_BREAK.add(Material.CORNFLOWER);
}
// End 1.14 objects
// Start 1.15 objects
if (VersionUtil.isOfVersion("v1_15")) {
INSTANT_BREAK.add(Material.HONEY_BLOCK);
}
// End 1.15 objects
// End instant break materials
// START FOOD // Start food
FOOD.add(Material.APPLE); FOOD.add(Material.APPLE);
FOOD.add(Material.BAKED_POTATO); FOOD.add(Material.BAKED_POTATO);
FOOD.add(Material.BEETROOT); FOOD.add(Material.BEETROOT);
@@ -597,7 +582,6 @@ public final class Utilities {
FOOD.add(Material.ENCHANTED_GOLDEN_APPLE); FOOD.add(Material.ENCHANTED_GOLDEN_APPLE);
FOOD.add(Material.GOLDEN_APPLE); FOOD.add(Material.GOLDEN_APPLE);
FOOD.add(Material.GOLDEN_CARROT); FOOD.add(Material.GOLDEN_CARROT);
FOOD.add(Material.HONEY_BOTTLE);
FOOD.add(Material.MELON_SLICE); FOOD.add(Material.MELON_SLICE);
FOOD.add(Material.MUSHROOM_STEW); FOOD.add(Material.MUSHROOM_STEW);
FOOD.add(Material.POISONOUS_POTATO); FOOD.add(Material.POISONOUS_POTATO);
@@ -614,12 +598,21 @@ public final class Utilities {
FOOD.add(Material.SALMON); FOOD.add(Material.SALMON);
FOOD.add(Material.ROTTEN_FLESH); FOOD.add(Material.ROTTEN_FLESH);
FOOD.add(Material.SPIDER_EYE); FOOD.add(Material.SPIDER_EYE);
FOOD.add(Material.TROPICAL_FISH);
// Start 1.14 objects
if (VersionUtil.isOfVersion("v1_14")) {
FOOD.add(Material.SUSPICIOUS_STEW); FOOD.add(Material.SUSPICIOUS_STEW);
FOOD.add(Material.SWEET_BERRIES); FOOD.add(Material.SWEET_BERRIES);
FOOD.add(Material.TROPICAL_FISH); }
// END FOOD // End 1.14 objects
// Start 1.15 objects
if (VersionUtil.isOfVersion("v1_15")) {
FOOD.add(Material.HONEY_BOTTLE);
}
// End 1.15 objects
// End food
// START COMBOS // Start combos
COMBO.put(Material.SHEARS, Material.BLACK_WOOL); COMBO.put(Material.SHEARS, Material.BLACK_WOOL);
COMBO.put(Material.SHEARS, Material.BLUE_WOOL); COMBO.put(Material.SHEARS, Material.BLUE_WOOL);
COMBO.put(Material.SHEARS, Material.BROWN_WOOL); COMBO.put(Material.SHEARS, Material.BROWN_WOOL);
@@ -642,6 +635,6 @@ public final class Utilities {
COMBO.put(Material.DIAMOND_SWORD, Material.COBWEB); COMBO.put(Material.DIAMOND_SWORD, Material.COBWEB);
COMBO.put(Material.STONE_SWORD, Material.COBWEB); COMBO.put(Material.STONE_SWORD, Material.COBWEB);
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB); COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
// END COMBOS // End combos
} }
} }
@@ -31,7 +31,7 @@ import org.bukkit.potion.PotionEffectType;
public class VersionUtil { public class VersionUtil {
private static final List<String> SUPPORTED_VERSIONS = Arrays private static final List<String> SUPPORTED_VERSIONS = Arrays
.asList(new String[] { "v1_15" }); .asList(new String[] { "v1_15", "v1_14", "v1_13" });
public static String getVersion() { public static String getVersion() {
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
@@ -46,6 +46,14 @@ public class VersionUtil {
return false; return false;
} }
public static boolean isOfVersion(String versionId) {
if (getVersion().startsWith(versionId)) {
return true;
}
return false;
}
public static boolean isFlying(Player p) { public static boolean isFlying(Player p) {
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION); return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
} }
@@ -16,21 +16,24 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.rammelkast.anticheatreloaded.util.checkassist;
package com.rammelkast.anticheatreloaded.check.player; import org.bukkit.Location;
import org.bukkit.util.Vector;
import java.util.HashMap; public class KillauraAssist {
import java.util.Map;
import java.util.UUID;
/** public KillauraAssist() {
*
* @author Rammelkast
*
*/
public class GhosthandCheck {
public static final Map<UUID, Integer> FLAG_COUNT = new HashMap<UUID, Integer>(); }
public static final int MAX_FLAGS = 3; // TODO config?
public static double calculateYawDifference(Location from, Location to) {
Location clonedFrom = from.clone();
Vector startVector = clonedFrom.toVector();
Vector targetVector = to.toVector();
clonedFrom.setDirection(targetVector.subtract(startVector));
return clonedFrom.getYaw();
}
} }
@@ -72,7 +72,7 @@ import java.util.TreeMap;
* <p/> * <p/>
* <b>Types of functions:</b><br /> * <b>Types of functions:</b><br />
* - Player: RESET, KICK, BAN, COMMAND[command] OR COMMAND[command1;command2] * - Player: RESET, KICK, BAN, COMMAND[command] OR COMMAND[command1;command2]
* <i>- when using commands <b>&player</b> will be replaced by the player name, <b>&world</b> will be replaced by the player's world, * <i>- when using commands <b>%player%</b> will be replaced by the player name, <b>&world</b> will be replaced by the player's world,
* and <b>&check</b> will be replaced by the check that caused this rule to be run</i><br /> * and <b>&check</b> will be replaced by the check that caused this rule to be run</i><br />
* <br /><br /> * <br /><br />
* <p/> * <p/>
@@ -82,9 +82,9 @@ import java.util.TreeMap;
*/ */
public class Rule { public class Rule {
private static String string;
private static final String VARIABLE_SET_REGEX = ".*(_).*=.*"; private static final String VARIABLE_SET_REGEX = ".*(_).*=.*";
private static final String FUNCTION_REGEX = ".*\\..*"; private static final String FUNCTION_REGEX = ".*\\..*";
private String string;
private Type type; private Type type;
public enum Type { public enum Type {
@@ -129,6 +129,7 @@ public class Rule {
* @param string the string value to load * @param string the string value to load
* @return an instance of Rule if an implementation exists to handle this rule, null if none are found * @return an instance of Rule if an implementation exists to handle this rule, null if none are found
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Rule load(String string) { public static Rule load(String string) {
for (Type type : Type.values()) { for (Type type : Type.values()) {
if (type.matches(string)) { if (type.matches(string)) {
+3
View File
@@ -30,6 +30,9 @@ system:
event-chains: true event-chains: true
# Should Enterprise options be enabled? Only set this to true if you're an advanced user. # Should Enterprise options be enabled? Only set this to true if you're an advanced user.
enterprise: false enterprise: false
# Running AntiCheatReloaded in debug mode will send alerts to the cheating players
# Do NOT enable this in a production environment!
debug-mode: false
# Use /AntiCheatReloaded check for a list of valid checks # Use /AntiCheatReloaded check for a list of valid checks
disabled-checks: disabled-checks:
- EXAMPLE_CHECK - EXAMPLE_CHECK
+1 -2
View File
@@ -1,5 +1,4 @@
# AntiCheat configuration file # AntiCheatReloaded configuration file
# Please report any bugs: https://github.com/gravitylow/AntiCheat/issues
# Server-specific settings # Server-specific settings
server: server:
# An identifiable name for this server # An identifiable name for this server
+1 -1
View File
@@ -2,4 +2,4 @@
groups: groups:
- 'Medium : 20 : YELLOW : WARN' - 'Medium : 20 : YELLOW : WARN'
- 'High : 50 : RED : KICK' - 'High : 50 : RED : KICK'
- 'Custom : -1 : GREEN : COMMAND[ban &player;say hello world]' - 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
+14 -14
View File
@@ -1,17 +1,17 @@
# AntiCheatReloaded language file # AntiCheatReloaded language file
ALERT: ALERT:
- '&player has just entered the &group hack group.' - '&c%player% has just entered the %group% hack group.'
- '&player''s last failed check was: &check.' - '&c%player%''s last failed check was: %check%.'
- 'Type ''/anticheat report &player'' for more information.' - '&cType ''/acr report %player%'' for more information.'
WARNING: WARNING:
- '[AntiCheatReloaded] Hacking is not permitted.' - '&6&lACR&7 You have been flagged for using cheats.'
- '[AntiCheatReloaded] If you continue to hack, action will be taken.' - '&6&lACR&7 If you continue to cheat, action will be taken.'
BAN_REASON: 'Banned by AntiCheatReloaded' BAN_REASON: '&cBanned by AntiCheatReloaded'
BAN_BROADCAST: '&player was banned for hacking.' BAN_BROADCAST: '&c%player% was banned for hacking.'
KICK_REASON: 'Kicked by AntiCheatReloaded' KICK_REASON: '&cKicked by AntiCheatReloaded'
KICK_BROADCAST: '&player was kicked for hacking.' KICK_BROADCAST: '&c%player% was kicked for hacking.'
SPAM_WARNING: 'Stop spamming the server or you will be kicked!' SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
SPAM_KICK_REASON: 'Kicked for spamming' SPAM_KICK_REASON: '&cKicked for spamming'
SPAM_KICK_BROADCAST: '&player was kicked for spamming' SPAM_KICK_BROADCAST: '&c%player% was kicked for spamming'
SPAM_BAN_REASON: 'Banned for spamming' SPAM_BAN_REASON: '&cBanned for spamming'
SPAM_BAN_BROADCAST: '&player was banned for spamming' SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
+192 -22
View File
@@ -1,91 +1,245 @@
# AntiCheatReloaded configuration file # Maximum times a player can interact between animations
# # Changing this value of almost never required
# This file is not yet fully documented
# For more information on the undocumented values visit:
# https://github.com/Rammelkast/AntiCheatReloaded/blob/master/src/main/java/com/rammelkast/anticheatreloaded/config/providers/Magic.java#L39-L380
#
ANIMATION_INTERACT_MAX: 3 ANIMATION_INTERACT_MAX: 3
# Minimum time between animations
# Changing this value is almost never required
ANIMATION_MIN: 200 ANIMATION_MIN: 200
# Number of times a player can fail the ascension check before being considered a cheater
# Increase in case of false positives
ASCENSION_COUNT_MAX: 8 ASCENSION_COUNT_MAX: 8
# Minimum time in between block breaks
# Decrease in case of false positives
BLOCK_BREAK_MIN: 0.1 BLOCK_BREAK_MIN: 0.1
# Maximum distance a player can break a block from
# Changing this value is almost never required
BLOCK_MAX_DISTANCE: 5.5 BLOCK_MAX_DISTANCE: 5.5
# Maximum distance a player can break a block from when in creative mode
# Changing this value is almost never required
BLOCK_MAX_DISTANCE_CREATIVE: 6.0 BLOCK_MAX_DISTANCE_CREATIVE: 6.0
# Minimum time in between block placing
# Decrease in case of false positives
BLOCK_PLACE_MIN: 0.1 BLOCK_PLACE_MIN: 0.1
# Number of times required to punch a block before it breaks
# Changing this value is almost never required
BLOCK_PUNCH_MIN: 5 BLOCK_PUNCH_MIN: 5
# Maximum percent error between predicted bow force and actual bow force
# Increase in case of false positives
BOW_ERROR: 0.25 BOW_ERROR: 0.25
CHAT_ACTION_ONE_LEVEL: 3 # Number of chat spam violations before action one is executed
CHAT_ACTION_TWO_LEVEL: 5 # Should be changed to personal preference
CHAT_MIN: 100 CHAT_ACTION_ONE_LEVEL: 5
CHAT_REPEAT_MIN: 260 # Number of chat spam violations before action two is executed
CHAT_WARN_LEVEL: 7 # Should be changed to personal preference
COMMAND_ACTION_ONE_LEVEL: 3 CHAT_ACTION_TWO_LEVEL: 10
COMMAND_ACTION_TWO_LEVEL: 5 # Minimum time between chats in milliseconds
COMMAND_MIN: 100 # Should be changed to personal preference
COMMAND_REPEAT_MIN: 260 CHAT_MIN: 500
# Time before repeating yourself in chat is ignored in milliseconds
# Should be changed to personal preference
CHAT_REPEAT_MIN: 600
# Number of command spam violations before action one is executed
# Should be changed to personal preference
COMMAND_ACTION_ONE_LEVEL: 5
# Number of command spam violations before action two is executed
# Should be changed to personal preference
COMMAND_ACTION_TWO_LEVEL: 10
# Minimum time between commands in milliseconds
# Should be changed to personal preference
COMMAND_MIN: 400
# Time before repeating a command in milliseconds
# Should be changed to personal preference
COMMAND_REPEAT_MIN: 500
# Time to exempt a player from moving because of taking damage
# Can be decreased very slightly to increase detection
# Increasing in case of false positives is almost never necessary and is not advised
DAMAGE_TIME: 3000 DAMAGE_TIME: 3000
# Number of item drops to wait for before checking how long they took to drop
# Changing this value is almost never required
DROP_CHECK: 10 DROP_CHECK: 10
# Minimum time it takes to drop X items
# Changing this value is almost never required
DROP_TIME_MIN: 800 DROP_TIME_MIN: 800
DROPPED_ITEM_TIME: 100 # Minimum time in between eating
# Decrease in case of false positives
EAT_TIME_MIN: 1000 EAT_TIME_MIN: 1000
# Time to exempt a player from moving because of entering/exiting a vehicle
# Increase in case of false positives
ENTERED_EXITED_TIME: 1000 ENTERED_EXITED_TIME: 1000
# Maximum distance a player can damage an entity from
# Changing this value is almost never required
ENTITY_MAX_DISTANCE: 5.9 ENTITY_MAX_DISTANCE: 5.9
# Maximum distance a player can damage an entity from when in creative mode
# Changing this value is almost never required
ENTITY_MAX_DISTANCE_CREATIVE: 6.5 ENTITY_MAX_DISTANCE_CREATIVE: 6.5
# Time to exempt a player from moving because of exiting fly mode
# Changing this value is almost never required
EXIT_FLY_TIME: 2000 EXIT_FLY_TIME: 2000
# Time to exempt a player from moving because of taking damage from an explosion
# Can be decreased very slightly to increase detection
# Increasing in case of false positives is almost never necessary and is not advised
EXPLOSION_DAMAGE_TIME: 5000 EXPLOSION_DAMAGE_TIME: 5000
# Max number of blocks that can be broken in a given time
# Increase in case of false positives
FASTBREAK_LIMIT: 2 FASTBREAK_LIMIT: 2
# Number of times fastbreak can be observed before considering a player a cheater
# Can be increased in case of false positives, but shouldn't be required
FASTBREAK_MAXVIOLATIONS: 2 FASTBREAK_MAXVIOLATIONS: 2
# Number of times fastbreak can be observed before considering a creative player a cheater
# Can be increased in case of false positives, but shouldn't be required
FASTBREAK_MAXVIOLATIONS_CREATIVE: 4 FASTBREAK_MAXVIOLATIONS_CREATIVE: 4
# Time a player is forced to wait after fastbreak has been detected
# Should be changed to personal preference
FASTBREAK_MAXVIOLATIONTIME: 10000 FASTBREAK_MAXVIOLATIONTIME: 10000
# Time to wait before checking block breaks
# Increase in case of false positives
FASTBREAK_TIMEMAX: 1000 FASTBREAK_TIMEMAX: 1000
# Time to wait before checking block breaks for creative mode users
# Increase in case of false positives
FASTBREAK_TIMEMAX_CREATIVE: 100 FASTBREAK_TIMEMAX_CREATIVE: 100
# Number of times fastplace can be observed before considering a player a cheater
# Increase in case of false positives
FASTPLACE_MAXVIOLATIONS: 2 FASTPLACE_MAXVIOLATIONS: 2
# Number of times fastplace can be observed before considering a creative player a cheater
# Increase in case of false positives
FASTPLACE_MAXVIOLATIONS_CREATIVE: 3 FASTPLACE_MAXVIOLATIONS_CREATIVE: 3
# Time a player is forced to wait after fastplace has been detected
# Should be changed to personal preference
FASTPLACE_MAXVIOLATIONTIME: 10000 FASTPLACE_MAXVIOLATIONTIME: 10000
# Minimum time in between block places
# Decrease in case of false positives, but shouldn't be required
FASTPLACE_TIMEMIN: 50 FASTPLACE_TIMEMIN: 50
# Number of blocks that can be broken without being hit before considering a player a cheater
# Increase in case of false positives
FASTPLACE_ZEROLIMIT: 3 FASTPLACE_ZEROLIMIT: 3
FLIGHT_BLOCK_LIMIT: 15.0 # How many blocks you can travel before being considered a cheater
FLIGHT_LIMIT: 150 # Can be decreased to increase detection with the risk of false positives
# Can be increased to decrease false positives, but shouldn't be necesary
FLIGHT_BLOCK_LIMIT: 5.5
# Time to exempt a player from fastbreak check because of using instant break
# Increase in case of false positives, but shouldn't be necessary
INSTANT_BREAK_TIME: 2 INSTANT_BREAK_TIME: 2
# The number of clicks we should wait before checking if the player has used fast inventory
# Increase in case of false positives
INVENTORY_CHECK: 10 INVENTORY_CHECK: 10
# The minimum time it should have taken for the player to click X times
# Increase in case of false positives
INVENTORY_TIMEMIN: 50 INVENTORY_TIMEMIN: 50
# Time to exempt a player from moving because of joining the server
# If your server is slow when a player joins, increasing this value is important
# Shouldn't be lower than 1500 or higher than 5000
JOIN_TIME: 2000 JOIN_TIME: 2000
# Time to exempt a player from moving because of taking damage with knockback effects
# Can be decreased very slightly to increase detection
# Increase in case of false positives, but shouldn't be necessary
KNOCKBACK_DAMAGE_TIME: 4000 KNOCKBACK_DAMAGE_TIME: 4000
# Maximum 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_MAX: 0.11761 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 LADDER_Y_MIN: 0.11759
NOFALL_LIMIT: 9 # 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
NOFALL_LIMIT: 8
# Number of projectiles to wait for before checking how long they took to fire off
# Do not decrease this value
PROJECTILE_CHECK: 10 PROJECTILE_CHECK: 10
# Minimum time it takes to fire X projectiles
# Decrease in case of false positives
PROJECTILE_TIME_MIN: 1500 PROJECTILE_TIME_MIN: 1500
# Time to exempt a player from moving because of entering/exiting sneak mode
# Increase in case of false positives, shouldn't be necessary
SNEAK_TIME: 250 SNEAK_TIME: 250
# Maximum times a player can fail the speed check before being considered a cheater
# Increase in case of false positives
SPEED_MAX: 3 SPEED_MAX: 3
# Number of times a player can sprint without proper food level before being considered a cheater
# Can either be increased or decreased to your liking. Shouldn't make a massive difference.
SPRINT_FOOD_MIN: 6 SPRINT_FOOD_MIN: 6
SPRINT_MIN: 0.2 # Maximum speed you can travel while sprinting
# This is a set value and shouldn't be changed unless you know what you're doing
SPRINT_MAX: 0.2
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
# This is a set value and shouldn't be changed unless you know what you're doing
TELEPORT_MIN: 400 TELEPORT_MIN: 400
# Time to exempt a player from moving because of teleporting
# Increase in case of false positives
TELEPORT_TIME: 1000 TELEPORT_TIME: 1000
# The number of steps we should wait before checking if the player has used timer cheating
# Increase in case of false positives
TIMER_STEP_CHECK: 50 TIMER_STEP_CHECK: 50
# The minimum time it should have taken for the player to travel X steps
# Decrease in case of false positives
TIMER_TIMEMIN: 2000 TIMER_TIMEMIN: 2000
# 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 VELOCITY_CHECKTIME: 2100
# This is a set value and shouldn't be changed unless you know what you're doing
VELOCITY_MAXTIMES: 2 VELOCITY_MAXTIMES: 2
# This is a set value and shouldn't be changed unless you know what you're doing
VELOCITY_PREVENT: 5000 VELOCITY_PREVENT: 5000
# This is a set value and shouldn't be changed unless you know what you're doing
VELOCITY_SCHETIME: 2 VELOCITY_SCHETIME: 2
# This is a set value and shouldn't be changed unless you know what you're doing
VELOCITY_TIME: 3 VELOCITY_TIME: 3
WATER_ASCENSION_VIOLATION_MAX: 13 # Number of times a player can fail the ascension check while in water before being considered a cheater
# Increase in case of false positives
WATER_ASCENSION_VIOLATION_MAX: 12
# Maximum speed that a player can climb a waterfall
# Can be increased in case of false positives, shouldn't be necesary
WATER_CLIMB_MAX: 0.15 WATER_CLIMB_MAX: 0.15
# Number of times a player can be caught speeding in water before being considered a cheater
# Increase in case of false positives
WATER_SPEED_VIOLATION_MAX: 4 WATER_SPEED_VIOLATION_MAX: 4
# Maximum speed a player can travel forwards or backwards
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX: 0.25 XZ_SPEED_MAX: 0.25
# aximum speed a player can travel forwards or backwards while flying
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_FLY: 0.56 XZ_SPEED_MAX_FLY: 0.56
# Maximum speed a player can travel forwards or backwards while under the influence
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_POTION: 0.7 XZ_SPEED_MAX_POTION: 0.7
# Maximum speed a player can travel forwards or backwards while sprinting while under the influence
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_POTION_SPRINT: 0.95 XZ_SPEED_MAX_POTION_SPRINT: 0.95
# Maximum speed a player can travel forwards or backwards while sneaking
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_SNEAK: 0.15 XZ_SPEED_MAX_SNEAK: 0.15
# Maximum speed a player can travel forwards or backwards on soul sand
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_SOULSAND: 0.13 XZ_SPEED_MAX_SOULSAND: 0.13
# Maximum speed a player can travel forwards or backwards on soul sand while under the influenc
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_SOULSAND_POTION: 0.16 XZ_SPEED_MAX_SOULSAND_POTION: 0.16
# Maximum speed a player can travel forwards or backwards on soul sand while sprintin
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_SOULSAND_SPRINT: 0.2 XZ_SPEED_MAX_SOULSAND_SPRINT: 0.2
# Maximum speed a player can travel forwards or backwards while sprinting
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_SPRINT: 0.65 XZ_SPEED_MAX_SPRINT: 0.65
# Maximum speed a player can travel forwards or backwards in water
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_WATER: 0.19 XZ_SPEED_MAX_WATER: 0.19
# Maximum speed a player can travel forwards or backwards in water while sprinting
# This is a set value and shouldn't be changed unless you know what you're doing
XZ_SPEED_MAX_WATER_SPRINT: 0.3 XZ_SPEED_MAX_WATER_SPRINT: 0.3
# Maximum difference between the player's last two Y values when traveling up
# Can be decreased slightly to improve detection with the risk of false positives
# Increase in case of false positives
Y_MAXDIFF: 5.0 Y_MAXDIFF: 5.0
# Number of times a player can fly on the y-axis before being considered a cheater
# Increase in case of false positives
Y_MAXVIOLATIONS: 1 Y_MAXVIOLATIONS: 1
# Time a player is forced to wait after flyhacking on the y-axis
# Should be changed to personal preference
Y_MAXVIOTIME: 5500 Y_MAXVIOTIME: 5500
# Maximum speed a player can travel up
# This is a set value and shouldn't be changed unless you know what you're doing
Y_SPEED_MAX: 0.5175 Y_SPEED_MAX: 0.5175
# Time in between Y difference measures
# This is a set value and shouldn't be changed unless you know what you're doing
Y_TIME: 800 Y_TIME: 800
# Amount of suspicious mid-air movements before a player is suspected of glide # Amount of suspicious mid-air movements before a player is suspected of glide
# Increase this in case of false positives # Increase this in case of false positives
@@ -93,6 +247,22 @@ GLIDE_LIMIT: 10
# Maximum amount of movement packets allowed per second # Maximum amount of movement packets allowed per second
# Increase this in case of false positives # Increase this in case of false positives
BLINK_PACKET: 25 BLINK_PACKET: 25
# If the blink check gives false positives replace this with the average user ping on your server
# Not a good idea to use a value lower than 100 or higher than 200
BLINK_AVERAGE_PING: 120
# Maximum amount zero-velocity moments before a player is suspected # Maximum amount zero-velocity moments before a player is suspected
# Increase this in case of false positives # Increase this in case of false positives
VELOCITY_AMT: 5 VELOCITY_MAX_FLAGS: 5
# The maximum angle difference allowed when attacking
# Increase this in case of false positives
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
+10 -18
View File
@@ -36,7 +36,7 @@ permissions:
description: Access reloading the system description: Access reloading the system
anticheat.system.reset: anticheat.system.reset:
description: Access resetting a player's cheat level description: Access resetting a player's cheat level
anticheat.system.update: anticheat.system.version:
description: Access information about whether the system is updated description: Access information about whether the system is updated
anticheat.system.calibrate: anticheat.system.calibrate:
description: Access the calibration system description: Access the calibration system
@@ -52,20 +52,11 @@ permissions:
anticheat.system.update: true anticheat.system.update: true
anticheat.system.calibrate: true anticheat.system.calibrate: true
anticheat.system.debug: true anticheat.system.debug: true
anticheat.check.zombe.fly:
description: Allow players to use zombe flymod
default: false
anticheat.check.zombe.noclip:
description: Allow players to use zombe noclip hack
default: false
anticheat.check.zombe.cheat:
description: Allow players to use zombe cheat hack
default: false
anticheat.check.flight: anticheat.check.flight:
description: Allow players to fly description: Allow players to use fly cheats
default: false default: false
anticheat.check.elytra: anticheat.check.elytra:
description: Allow players to fly when using elytra description: Allow players to use ElytraFly cheats
default: false default: false
anticheat.check.waterwalk: anticheat.check.waterwalk:
description: Allow players to walk on water description: Allow players to walk on water
@@ -106,8 +97,8 @@ permissions:
anticheat.check.fastheal: anticheat.check.fastheal:
description: Allow players to heal up instantly description: Allow players to heal up instantly
default: false default: false
anticheat.check.forcefield: anticheat.check.killaura:
description: Allow players to use a forcefield description: Allow players to use killaura
default: false default: false
anticheat.check.longreach: anticheat.check.longreach:
description: Allow players to use longreaching hacks description: Allow players to use longreaching hacks
@@ -142,13 +133,13 @@ permissions:
anticheat.check.unicode: anticheat.check.unicode:
description: Allow players to use unicode in chat description: Allow players to use unicode in chat
default: false default: false
anticheat.check.illegalinteract:
description: Allow players to place blocks in illegal places
default: false
anticheat.check.exempt: anticheat.check.exempt:
description: Total exemption from checks description: Total exemption from checks
default: false default: false
children: children:
anticheat.check.zombe.fly: true
anticheat.check.zombe.noclip: true
anticheat.check.zombe.cheat: true
anticheat.check.fly: true anticheat.check.fly: true
anticheat.check.waterwalk: true anticheat.check.waterwalk: true
anticheat.check.noswing: true anticheat.check.noswing: true
@@ -163,7 +154,7 @@ permissions:
anticheat.check.fastbow: true anticheat.check.fastbow: true
anticheat.check.fasteat: true anticheat.check.fasteat: true
anticheat.check.fastheal: true anticheat.check.fastheal: true
anticheat.check.forcefield: true anticheat.check.killaura: true
anticheat.check.longreach: true anticheat.check.longreach: true
anticheat.check.projectile: true anticheat.check.projectile: true
anticheat.check.itemspam: true anticheat.check.itemspam: true
@@ -176,3 +167,4 @@ permissions:
anticheat.check.velocity: true anticheat.check.velocity: true
anticheat.check.criticals: true anticheat.check.criticals: true
anticheat.check.unicode: true anticheat.check.unicode: true
anticheat.check.illegalinteract: true