mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0288a9734a | ||
|
|
a7419e3968 | ||
|
|
df3c410436 | ||
|
|
27bb684736 | ||
|
|
aa9fa9b290 | ||
|
|
da4a61e228 | ||
|
|
9771387909 | ||
|
|
76c595e255 | ||
|
|
91f5fcd31c | ||
|
|
80b5e64924 | ||
|
|
67e824ef28 | ||
|
|
661718d001 | ||
|
|
7c9a05ff92 | ||
|
|
3af7bde9db | ||
|
|
7e37e8558b | ||
|
|
d41d08ccc6 | ||
|
|
f88c31051b | ||
|
|
6afe0049c5 | ||
|
|
f77d45a78d | ||
|
|
2ba98f9f9c | ||
|
|
e89a6cfd88 | ||
|
|
07bf56cc93 | ||
|
|
773900594d | ||
|
|
27ca12aec3 | ||
|
|
fec1286c8d | ||
|
|
acea36929b | ||
|
|
8da9d7f365 | ||
|
|
c9c3b2397f | ||
|
|
a140afe33e | ||
|
|
08c484bfb1 | ||
|
|
ae66b0ed3c | ||
|
|
0963458be5 | ||
|
|
d9639c81d9 | ||
|
|
0428c4796a | ||
|
|
8e92077bb6 | ||
|
|
9d32c8f2de | ||
|
|
d6917b81f7 | ||
|
|
1a64403223 | ||
|
|
7ae3f010a3 |
No files matched your search
@@ -1,10 +1,11 @@
|
|||||||
AntiCheatReloaded
|
AntiCheatReloaded
|
||||||
=============
|
=============
|
||||||
AntiCheatReloaded is a fork of the old 'AntiCheat' project.
|
AntiCheatReloaded helps server admins combat the use of hacked clients and spambots. It analyses the behavior of players and can prevent malicious gameplay. The plugin offers a lot of customizability and can be connected across multiple servers in case it is used in a server network context. AntiCheatReloaded is based on gravitylow's AntiCheat and has been around since 2012.
|
||||||
AntiCheat helps server admins easily identify and block malicious users by monitoring and analyzing the behaviour of their players.
|
|
||||||
|
|
||||||
### BTC donations: 1DwUKboRQKrgR9o1oZC4VutkCUwdZStHtk
|
Installation
|
||||||
### LTC donations: LTXzGnVLXmiH5XJch1bKrcZtzQjaF9rd8V
|
------------
|
||||||
|
AntiCheatReloaded requires you to have ProtocolLib. You can download it [here](https://www.spigotmc.org/resources/protocollib.1997/).
|
||||||
|
Simply drag and drop the AntiCheatReloaded and ProtocolLib jars in your plugin folder. You can now use AntiCheatReloaded, but be sure to have a look at the configuration files, which allow you to change every aspect of the plugin.
|
||||||
|
|
||||||
Bug Reporting
|
Bug Reporting
|
||||||
------------
|
------------
|
||||||
@@ -12,25 +13,19 @@ 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
|
|
||||||
-------
|
|
||||||
Simply drag and drop the plugin file and the ProtocolLib jar into your Plugins folder.
|
|
||||||
|
|
||||||
Hacks blocked
|
Hacks blocked
|
||||||
-------
|
-------
|
||||||
* Blink
|
|
||||||
* Flight
|
* Flight
|
||||||
* Glide
|
* Glide
|
||||||
* Jesus
|
* Jesus
|
||||||
* Step
|
* Step
|
||||||
* Criticals
|
* Criticals
|
||||||
* KillAura
|
|
||||||
* Anti-Knockback
|
* Anti-Knockback
|
||||||
* FastBow
|
* FastBow
|
||||||
* FastDrop
|
* FastDrop
|
||||||
@@ -40,8 +35,14 @@ Hacks blocked
|
|||||||
* NoFall
|
* NoFall
|
||||||
* Sneak
|
* Sneak
|
||||||
* vClip
|
* vClip
|
||||||
* Timer
|
|
||||||
* FastBreak
|
* FastBreak
|
||||||
* FastPlace
|
* FastPlace
|
||||||
* Spam
|
* Spam
|
||||||
* FastEat
|
* FastEat
|
||||||
|
* ElytraFly
|
||||||
|
* Unicode chat
|
||||||
|
* GhostHand
|
||||||
|
* KillAura
|
||||||
|
* Scaffold
|
||||||
|
* MorePackets
|
||||||
|
* BadPackets
|
||||||
@@ -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.6.3-ALPHA</version>
|
<version>1.8.1</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>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>dmulloy2-repo</id>
|
<id>dmulloy2-repo</id>
|
||||||
<url>http://repo.dmulloy2.net/content/groups/public/</url>
|
<url>https://repo.dmulloy2.net/nexus/repository/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<build>
|
<build>
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>com.rammelkast.*</include>
|
<include>com.rammelkast.*</include>
|
||||||
|
<include>com.cryptomorin.*</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -64,37 +65,23 @@
|
|||||||
</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-API</artifactId>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.5.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>4.11</version>
|
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||||
<type>jar</type>
|
<scope>provided</scope>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
<version>1.15.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,17 +23,18 @@ import java.security.SecureRandom;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
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.packet.MorePacketsCheck;
|
||||||
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;
|
||||||
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||||
@@ -42,20 +44,26 @@ 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.PacketListener;
|
||||||
|
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;
|
||||||
|
|
||||||
public class AntiCheatReloaded extends JavaPlugin {
|
public class AntiCheatReloaded extends JavaPlugin {
|
||||||
|
|
||||||
|
public static final List<UUID> MUTE_ENABLED_MODS = new ArrayList<UUID>();
|
||||||
|
|
||||||
private static AntiCheatManager manager;
|
private static AntiCheatManager manager;
|
||||||
private static AntiCheatReloaded plugin;
|
private static AntiCheatReloaded plugin;
|
||||||
private static List<Listener> eventList = new ArrayList<Listener>();
|
private static List<Listener> eventList = new ArrayList<Listener>();
|
||||||
private static Configuration config;
|
private static Configuration config;
|
||||||
private static boolean verbose;
|
private static boolean verbose;
|
||||||
private static boolean developer;
|
|
||||||
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;
|
||||||
|
|
||||||
|
private double tps = -1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@@ -70,120 +78,83 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
eventList.add(new InventoryListener());
|
eventList.add(new InventoryListener());
|
||||||
// Order is important in some cases, don't screw with these unless
|
// Order is important in some cases, don't screw with these unless
|
||||||
// needed, especially config
|
// needed, especially config
|
||||||
setupConfig();
|
this.setupConfig();
|
||||||
setupEvents();
|
this.setupEvents();
|
||||||
setupCommands();
|
this.setupCommands();
|
||||||
// Enterprise must come before levels
|
// Enterprise must come before levels
|
||||||
setupEnterprise();
|
this.setupEnterprise();
|
||||||
restoreLevels();
|
this.restoreLevels();
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||||
setupProtocol();
|
this.setupProtocol();
|
||||||
} else {
|
} else {
|
||||||
getLogger().severe("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 not work as expected!");
|
||||||
}
|
}
|
||||||
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
|
|
||||||
// Enable packetlisteners
|
|
||||||
KillAuraCheck.listenPackets();
|
|
||||||
BlinkCheck.startTimer();
|
|
||||||
BlinkCheck.listenPackets();
|
|
||||||
|
|
||||||
// Check if other AC's are installed
|
getLogger().info("Enabling packet listeners");
|
||||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
PacketListener.listenKeepAlivePackets();
|
||||||
public void run() {
|
PacketListener.listenMovementPackets();
|
||||||
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
|
|
||||||
getLogger().severe("*----------------------------------------------*");
|
updateManager = new UpdateManager();
|
||||||
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("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.");
|
||||||
|
|
||||||
// Metrics
|
// Metrics
|
||||||
try {
|
try {
|
||||||
Metrics metrics = new Metrics(this);
|
Metrics metrics = new Metrics(this, 202);
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked") {
|
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public int getValue() {
|
public Integer call() throws Exception {
|
||||||
int kicked = playersKicked;
|
int kicked = playersKicked;
|
||||||
// Reset so we don't keep sending the same value
|
// Reset so we don't keep sending the same value
|
||||||
playersKicked = 0;
|
playersKicked = 0;
|
||||||
return kicked;
|
return kicked;
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("killaura_violations") {
|
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public int getValue() {
|
public String call() throws Exception {
|
||||||
int violations = killauraViolations;
|
|
||||||
// Reset so we don't keep sending the same value
|
|
||||||
killauraViolations = 0;
|
|
||||||
return violations;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations") {
|
|
||||||
@Override
|
|
||||||
public int getValue() {
|
|
||||||
int violations = glideViolations;
|
|
||||||
// Reset so we don't keep sending the same value
|
|
||||||
glideViolations = 0;
|
|
||||||
return violations;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version") {
|
|
||||||
@Override
|
|
||||||
public String getValue() {
|
|
||||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version") {
|
metrics.addCustomChart(new Metrics.SimplePie("nms_version", new Callable<String>() {
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String call() throws Exception {
|
||||||
return VersionUtil.getVersion();
|
return VersionUtil.getVersion();
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Launch TPS check
|
||||||
|
new BukkitRunnable() {
|
||||||
|
long sec;
|
||||||
|
long currentSec;
|
||||||
|
int ticks;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
sec = (System.currentTimeMillis() / 1000L);
|
||||||
|
if (currentSec == sec) {
|
||||||
|
ticks += 1;
|
||||||
|
} else {
|
||||||
|
currentSec = sec;
|
||||||
|
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
|
||||||
|
ticks = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.runTaskTimer(this, 40L, 1L);
|
||||||
|
// Launch MorePackets timer
|
||||||
|
MorePacketsCheck.startTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -261,18 +232,10 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
config = null;
|
config = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean developerMode() {
|
|
||||||
return developer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDeveloperMode(boolean b) {
|
|
||||||
developer = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debugLog(final String string) {
|
public static void debugLog(final String string) {
|
||||||
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (developer) {
|
if (getManager().getConfiguration().getConfig().debugMode.getValue()) {
|
||||||
manager.debugLog("[DEBUG] " + string);
|
manager.debugLog("[DEBUG] " + string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,25 +264,35 @@ 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 killaura violations since start
|
|
||||||
*/
|
|
||||||
private int killauraViolations = 0;
|
|
||||||
/**
|
|
||||||
* Amount of glide violations since start
|
|
||||||
*/
|
|
||||||
private int glideViolations = 0;
|
|
||||||
|
|
||||||
public void onPlayerKicked() {
|
public void onPlayerKicked() {
|
||||||
this.playersKicked++;
|
this.playersKicked++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onKillAuraViolation() {
|
public static void sendToMainThread(Runnable runnable) {
|
||||||
this.killauraViolations++;
|
Bukkit.getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onGlideViolation() {
|
public void sendToStaff(String message) {
|
||||||
this.glideViolations++;
|
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||||
|
if (player.hasPermission("anticheat.system.alert")) {
|
||||||
|
if (!MUTE_ENABLED_MODS.contains(player.getUniqueId())) {
|
||||||
|
player.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Bukkit.getConsoleSender().sendMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UpdateManager getUpdateManager() {
|
||||||
|
return updateManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTPS() {
|
||||||
|
if (this.tps < 0 || this.tps > 20) {
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
return this.tps;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -44,7 +45,7 @@ public class AntiCheatAPI {
|
|||||||
*
|
*
|
||||||
* @param type Check to start watching for
|
* @param type Check to start watching for
|
||||||
*/
|
*/
|
||||||
public static void activateCheck(CheckType type, Class caller) {
|
public static void activateCheck(CheckType type, Class<?> caller) {
|
||||||
chk.activateCheck(type, caller.getName());
|
chk.activateCheck(type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ public class AntiCheatAPI {
|
|||||||
*
|
*
|
||||||
* @param type Check to stop watching for
|
* @param type Check to stop watching for
|
||||||
*/
|
*/
|
||||||
public static void deactivateCheck(CheckType type, Class caller) {
|
public static void deactivateCheck(CheckType type, Class<?> caller) {
|
||||||
chk.deactivateCheck(type, caller.getName());
|
chk.deactivateCheck(type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ public class AntiCheatAPI {
|
|||||||
* @param player Player to stop watching
|
* @param player Player to stop watching
|
||||||
* @param type Check to stop watching for
|
* @param type Check to stop watching for
|
||||||
*/
|
*/
|
||||||
public static void exemptPlayer(Player player, CheckType type, Class caller) {
|
public static void exemptPlayer(Player player, CheckType type, Class<?> caller) {
|
||||||
chk.exemptPlayer(player, type, caller.getName());
|
chk.exemptPlayer(player, type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ public class AntiCheatAPI {
|
|||||||
* @param player Player to start watching
|
* @param player Player to start watching
|
||||||
* @param type Check to start watching for
|
* @param type Check to start watching for
|
||||||
*/
|
*/
|
||||||
public static void unexemptPlayer(Player player, CheckType type, Class caller) {
|
public static void unexemptPlayer(Player player, CheckType type, Class<?> caller) {
|
||||||
chk.unexemptPlayer(player, type, caller.getName());
|
chk.unexemptPlayer(player, type, caller.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,31 +112,6 @@ public class AntiCheatAPI {
|
|||||||
|
|
||||||
// PlayerManager API
|
// PlayerManager API
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a player's integer hack level
|
|
||||||
*
|
|
||||||
* @param player Player to check
|
|
||||||
* @return player's hack level
|
|
||||||
* @deprecated see {@link #getGroup(org.bukkit.entity.Player)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int getLevel(Player player) {
|
|
||||||
return umr.safeGetLevel(player.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a player's hack level
|
|
||||||
*
|
|
||||||
* @param player Player to set
|
|
||||||
* @param level Group to set to
|
|
||||||
* @deprecated see {@link #resetPlayer(org.bukkit.entity.Player)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void setLevel(Player player, int level) {
|
|
||||||
umr.safeSetLevel(player.getUniqueId(), level);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset a player's hack level to 0
|
* Reset a player's hack level to 0
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,10 +36,8 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CheckType {
|
public enum CheckType {
|
||||||
ZOMBE_FLY(Permission.CHECK_ZOMBE_FLY),
|
FLIGHT(Permission.CHECK_FLIGHT),
|
||||||
ZOMBE_NOCLIP(Permission.CHECK_ZOMBE_NOCLIP),
|
ELYTRAFLY(Permission.CHECK_FLIGHT),
|
||||||
ZOMBE_CHEAT(Permission.CHECK_ZOMBE_CHEAT),
|
|
||||||
FLY(Permission.CHECK_FLY),
|
|
||||||
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),
|
||||||
@@ -54,16 +53,18 @@ 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),
|
||||||
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
|
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
|
||||||
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
||||||
KILLAURA(Permission.CHECK_KILLAURA),
|
MOREPACKETS(Permission.CHECK_MOREPACKETS),
|
||||||
BLINK(Permission.CHECK_BLINK),
|
BADPACKETS(Permission.CHECK_BADPACKETS),
|
||||||
VELOCITY(Permission.VELOCITY),
|
VELOCITY(Permission.CHECK_VELOCITY),
|
||||||
CRITICALS(Permission.CRITICALS);
|
CRITICALS(Permission.CHECK_CRITICALS),
|
||||||
|
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>();
|
||||||
@@ -124,8 +125,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("_")) {
|
||||||
chars[0] = Character.toUpperCase(chars[0]);
|
String[] split = type.name().toLowerCase().split("_");
|
||||||
return new String(chars);
|
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]);
|
||||||
|
return new String(chars);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
package com.rammelkast.anticheatreloaded.check.combat;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -16,17 +34,23 @@ public class CriticalsCheck {
|
|||||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player damager) {
|
public static void doDamageEvent(EntityDamageByEntityEvent e, Player damager) {
|
||||||
if (!(e.getDamager() instanceof Player) || e.getCause() != DamageCause.ENTITY_ATTACK)
|
if (!(e.getDamager() instanceof Player) || e.getCause() != DamageCause.ENTITY_ATTACK)
|
||||||
return;
|
return;
|
||||||
Player p = (Player)e.getDamager();
|
Player p = (Player) e.getDamager();
|
||||||
if (isCritical(p)) {
|
if (isCritical(p)) {
|
||||||
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0) && p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0)
|
||||||
|
&& p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Criticals, tried to do a critical without needed conditions").getMessage(), p, CheckType.CRITICALS);
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||||
|
.getMessage(),
|
||||||
|
p, CheckType.CRITICALS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isCritical(Player player) {
|
private static boolean isCritical(Player player) {
|
||||||
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle() && !player.hasPotionEffect(PotionEffectType.BLINDNESS) && !Utilities.isHoveringOverWater(player.getLocation()) && player.getEyeLocation().getBlock().getType() != Material.LADDER;
|
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
||||||
|
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||||
|
&& !Utilities.isHoveringOverWater(player.getLocation())
|
||||||
|
&& player.getEyeLocation().getBlock().getType() != Material.LADDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,90 +1,122 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
package com.rammelkast.anticheatreloaded.check.combat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
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.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.NPC_1_12;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Rammelkast
|
|
||||||
*/
|
|
||||||
public class KillAuraCheck {
|
public class KillAuraCheck {
|
||||||
|
|
||||||
private static final Map<UUID, NPC_1_12> NPC_LIST = new HashMap<UUID, NPC_1_12>();
|
// Angle check
|
||||||
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
||||||
|
// Aimbot check
|
||||||
|
public static final Map<UUID, List<Float>> PITCH_MOVEMENTS_CACHE = new HashMap<UUID, List<Float>>();
|
||||||
|
public static final Map<UUID, Float> GCD_CACHE = new HashMap<UUID, Float>();
|
||||||
|
// Not used as of now, code not committed yet
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static void cleanPlayer(Player p) {
|
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
||||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
UUID uuid = player.getUniqueId();
|
||||||
return;
|
Entity entity = event.getEntity();
|
||||||
}
|
if (entity instanceof LivingEntity) {
|
||||||
NPC_LIST.remove(p.getUniqueId());
|
LivingEntity living = (LivingEntity) entity;
|
||||||
}
|
Location eyeLocation = player.getEyeLocation();
|
||||||
|
|
||||||
public static void listenPackets() {
|
double yawDifference = calculateYawDifference(eyeLocation, living.getLocation());
|
||||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
double playerYaw = player.getEyeLocation().getYaw();
|
||||||
return;
|
|
||||||
}
|
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
|
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_DIFFERENCE()) {
|
||||||
@Override
|
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
||||||
public void onPacketReceiving(PacketEvent e) {
|
ANGLE_FLAGS.put(uuid, 1);
|
||||||
Player p = e.getPlayer();
|
return PASS;
|
||||||
if (!NPC_LIST.containsKey(p.getUniqueId()))
|
|
||||||
return;
|
|
||||||
int id = e.getPacket().getIntegers().read(0);
|
|
||||||
if (NPC_LIST.containsKey(p.getUniqueId())) {
|
|
||||||
if (NPC_LIST.get(p.getUniqueId()).getID() != id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!VL_COUNT.containsKey(p.getUniqueId())) {
|
|
||||||
VL_COUNT.put(p.getUniqueId(), 1);
|
int flags = ANGLE_FLAGS.get(uuid);
|
||||||
NPC_LIST.get(p.getUniqueId()).damage();
|
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
||||||
}else {
|
ANGLE_FLAGS.remove(uuid);
|
||||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||||
if (VL_COUNT.get(p.getUniqueId()) >= 5) {
|
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=5)").getMessage(), p, CheckType.KILLAURA);
|
|
||||||
AntiCheatReloaded.getPlugin().onKillAuraViolation();
|
|
||||||
VL_COUNT.remove(p.getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ANGLE_FLAGS.put(uuid, flags + 1);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) {
|
/**
|
||||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
* Check idea by Hawk AntiCheat (https://github.com/HawkAnticheat/Hawk)
|
||||||
return;
|
*/
|
||||||
|
public static CheckResult checkAimbot(Player player, PlayerMoveEvent event) {
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
float pitchMovement = event.getTo().getPitch() - event.getFrom().getPitch();
|
||||||
|
if (!PITCH_MOVEMENTS_CACHE.containsKey(uuid)) {
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, new ArrayList<Float>());
|
||||||
|
return PASS;
|
||||||
}
|
}
|
||||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
List<Float> pitchMovements = PITCH_MOVEMENTS_CACHE.get(uuid);
|
||||||
NPC_LIST.get(p.getUniqueId()).damage(e, p);
|
if (pitchMovement != 0 && Math.abs(pitchMovement) <= 10 && Math.abs(event.getTo().getPitch()) != 90) {
|
||||||
else {
|
pitchMovements.add(Math.abs(pitchMovement));
|
||||||
NPC_1_12 npc = new NPC_1_12(p);
|
|
||||||
NPC_LIST.put(p.getUniqueId(), npc);
|
|
||||||
npc.spawn();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pitchMovements.size() >= 20) {
|
||||||
|
float greatestCommonDivisor = Utilities.gcdRational(pitchMovements);
|
||||||
|
if (!GCD_CACHE.containsKey(uuid)) {
|
||||||
|
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||||
|
}
|
||||||
|
|
||||||
|
float divisorDifference = Math.abs(greatestCommonDivisor - GCD_CACHE.get(uuid));
|
||||||
|
if (divisorDifference > 0.00425 || greatestCommonDivisor < 0.00001) {
|
||||||
|
pitchMovements.clear();
|
||||||
|
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "performed aimbot-like movements (divisor-diff=" + divisorDifference + ")");
|
||||||
|
}
|
||||||
|
pitchMovements.clear();
|
||||||
|
GCD_CACHE.put(uuid, greatestCommonDivisor);
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||||
|
}
|
||||||
|
PITCH_MOVEMENTS_CACHE.put(uuid, pitchMovements);
|
||||||
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doMove(PlayerMoveEvent e) {
|
|
||||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) {
|
|
||||||
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
package com.rammelkast.anticheatreloaded.check.combat;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -16,33 +35,36 @@ import com.rammelkast.anticheatreloaded.event.EventListener;
|
|||||||
|
|
||||||
public class VelocityCheck {
|
public class VelocityCheck {
|
||||||
|
|
||||||
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
public static void cleanPlayer(Player p) {
|
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
|
||||||
VL_COUNT.remove(p.getUniqueId());
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
|
||||||
}
|
|
||||||
|
|
||||||
public static void runCheck(EntityDamageByEntityEvent e, final Player p) {
|
|
||||||
if (AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) || AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
|
||||||
return;
|
return;
|
||||||
final Location then = p.getLocation();
|
final Location then = player.getLocation();
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!p.isOnline())
|
if (!player.isOnline())
|
||||||
return;
|
return;
|
||||||
if (then.distance(p.getLocation()) < 0.125) {
|
if (then.distance(player.getLocation()) < 0.125) {
|
||||||
if (!VL_COUNT.containsKey(p.getUniqueId()))
|
if (!VIOLATIONS.containsKey(player.getUniqueId()))
|
||||||
VL_COUNT.put(p.getUniqueId(), 1);
|
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||||
else {
|
else {
|
||||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT()) {
|
if (VIOLATIONS.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Velocity, had zero/low velocity " + VL_COUNT.get(p.getUniqueId()) + " times (max=" + AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT() + ", dist=" + then.distance(p.getLocation()) + ")").getMessage(), p, CheckType.VELOCITY);
|
.VELOCITY_MAX_FLAGS()) {
|
||||||
VL_COUNT.remove(p.getUniqueId());
|
EventListener.log(
|
||||||
|
new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"had zero/low velocity " + VIOLATIONS.get(player.getUniqueId()) + " times (max="
|
||||||
|
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
|
.VELOCITY_MAX_FLAGS()
|
||||||
|
+ ", dist=" + then.distance(player.getLocation()) + ")").getMessage(),
|
||||||
|
player, CheckType.VELOCITY);
|
||||||
|
VIOLATIONS.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
VL_COUNT.remove(p.getUniqueId());
|
VIOLATIONS.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
|
||||||
import com.comphenix.protocol.events.ListenerPriority;
|
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Rammelkast
|
|
||||||
*/
|
|
||||||
public class BlinkCheck {
|
|
||||||
|
|
||||||
public static final Map<UUID, Integer> MOVE_COUNT = new HashMap<UUID, Integer>();
|
|
||||||
|
|
||||||
public static void startTimer() {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MOVE_COUNT.clear();
|
|
||||||
}
|
|
||||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void listenPackets() {
|
|
||||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK}) {
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent e) {
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
Location cur = e.getPlayer().getLocation();
|
|
||||||
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
|
|
||||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
|
||||||
} else {
|
|
||||||
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
|
|
||||||
if (AntiCheatReloaded.getManager().getCheckManager().checkInWorld(p) && !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) && !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
|
||||||
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET()) {
|
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId()) + " packets in one second (max=" + AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET() + ")").getMessage(), p, CheckType.BLINK);
|
|
||||||
MOVE_COUNT.remove(p.getUniqueId());
|
|
||||||
e.setCancelled(true);
|
|
||||||
e.getPlayer().teleport(cur);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
public class ElytraCheck {
|
||||||
|
|
||||||
|
public static final HashMap<UUID, Double> JUMP_Y_VALUE = new HashMap<UUID, Double>();
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
|
// No elytra in server version
|
||||||
|
if (VersionUtil.isBountifulUpdate()) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
||||||
|
// This was a teleport, so skip check.
|
||||||
|
JUMP_Y_VALUE.remove(uuid);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.isFlying() || player.hasPotionEffect(PotionEffectType.LEVITATION) || !player.isGliding()) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
public class ElytraFly {
|
|
||||||
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -5,26 +24,28 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
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.Backend;
|
||||||
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;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast TODO rewrite this check
|
||||||
* TODO rewrite this check
|
|
||||||
*/
|
*/
|
||||||
public class FlightCheck {
|
public class FlightCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Double> BLOCKS_OVER_FLIGHT = new HashMap<UUID, Double>();
|
||||||
|
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
||||||
|
public static final Map<UUID, Integer> ASCENSION_COUNT = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static Map<UUID, Double> blocksOverFlight = new HashMap<UUID, Double>();
|
|
||||||
public static Map<UUID, Long> movingExempt = new HashMap<UUID, Long>();
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|| VersionUtil.isFlying(player)) {
|
|| VersionUtil.isFlying(player)) {
|
||||||
@@ -38,34 +59,68 @@ public class FlightCheck {
|
|||||||
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||||
&& 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.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL })) {
|
new Material[] { Utilities.IRON_BARS })
|
||||||
|
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||||
if (!blocksOverFlight.containsKey(uuid)) {
|
new String[] { "FENCE", "FENCE_GATE" })) {
|
||||||
blocksOverFlight.put(uuid, 0D);
|
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
|
||||||
|
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
||||||
}
|
}
|
||||||
|
|
||||||
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) + distance.getXDifference()
|
BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) + distance.getXDifference()
|
||||||
+ distance.getYDifference() + distance.getZDifference()));
|
+ distance.getYDifference() + distance.getZDifference()));
|
||||||
|
|
||||||
if (y1 > y2) {
|
if (y1 > y2) {
|
||||||
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) - distance.getYDifference()));
|
BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) - distance.getYDifference()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocksOverFlight.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 " + blocksOverFlight.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 {
|
||||||
blocksOverFlight.put(uuid, 0D);
|
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
||||||
}
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkAscension(Player player, double y1, double y2) {
|
||||||
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
int max = backend.getMagic().ASCENSION_COUNT_MAX();
|
||||||
|
String string = "";
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
|
max += 12;
|
||||||
|
string = " with jump potion";
|
||||||
|
}
|
||||||
|
Block block = player.getLocation().getBlock();
|
||||||
|
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
|
||||||
|
&& !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
|
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||||
|
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
|
||||||
|
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
|
||||||
|
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
|
||||||
|
// TODO isMoveUpBlock does not seem to be a success with stairs
|
||||||
|
if (y1 < y2) {
|
||||||
|
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
|
||||||
|
&& !block.getRelative(BlockFace.EAST).isLiquid()
|
||||||
|
&& !block.getRelative(BlockFace.WEST).isLiquid()) {
|
||||||
|
backend.increment(player, ASCENSION_COUNT, max);
|
||||||
|
if (ASCENSION_COUNT.get(player.getUniqueId()) >= max) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"ascended " + ASCENSION_COUNT.get(player.getUniqueId()) + " times in a row (max = " + max
|
||||||
|
+ string + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ASCENSION_COUNT.put(player.getUniqueId(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMovingExempt(Player player) {
|
public static boolean isMovingExempt(Player player) {
|
||||||
return isDoing(player, movingExempt, -1);
|
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
||||||
|
|||||||
@@ -1,18 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
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 com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
|
||||||
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;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
@@ -20,55 +37,94 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
|
|
||||||
public class GlideCheck {
|
public class GlideCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Double> LAST_MOTION_Y = new HashMap<UUID, Double>();
|
||||||
|
public static final Map<UUID, Float> LAST_FALL_DISTANCE = new HashMap<UUID, Float>();
|
||||||
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static Map<UUID, Double> lastDiff = new HashMap<UUID, Double>();
|
|
||||||
public static Map<UUID, Float> lastFallDistance = new HashMap<UUID, Float>();
|
|
||||||
public static Map<UUID, Integer> violations = new HashMap<UUID, Integer>();
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (VersionUtil.isFlying(player)) {
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|
|| VersionUtil.isFlying(player) || FlightCheck.isMovingExempt(player)) {
|
||||||
|
VIOLATIONS.put(player.getUniqueId(), 0);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
if (!lastDiff.containsKey(player.getUniqueId())) {
|
if (player.getLocation().getBlock().getType() == Material.LADDER
|
||||||
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
|| player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
if (!lastFallDistance.containsKey(player.getUniqueId())) {
|
if (!LAST_MOTION_Y.containsKey(player.getUniqueId())) {
|
||||||
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
|
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
double yDiff = distance.getYDifference();
|
if (!LAST_FALL_DISTANCE.containsKey(player.getUniqueId())) {
|
||||||
|
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
int violations = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||||
|
double motionY = distance.getYDifference();
|
||||||
float fallDistance = player.getFallDistance();
|
float fallDistance = player.getFallDistance();
|
||||||
if (yDiff == lastDiff.get(player.getUniqueId()) && fallDistance > lastFallDistance.get(player.getUniqueId())) {
|
if (motionY == LAST_MOTION_Y.get(player.getUniqueId())
|
||||||
if (!violations.containsKey(player.getUniqueId())) {
|
&& fallDistance > LAST_FALL_DISTANCE.get(player.getUniqueId())) {
|
||||||
violations.put(player.getUniqueId(), 1);
|
if (violations + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
||||||
|
VIOLATIONS.put(player.getUniqueId(), 0);
|
||||||
|
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||||
|
Location prev = player.getLocation().clone();
|
||||||
|
prev.setY(prev.getY() - distanceToFall(prev));
|
||||||
|
player.teleport(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
|
.getGoodLocation(prev));
|
||||||
|
}
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"type=glide, desc_amount=" + new BigDecimal(motionY).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||||
} else {
|
} else {
|
||||||
if (violations.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
VIOLATIONS.put(player.getUniqueId(), violations + 1);
|
||||||
violations.remove(player.getUniqueId());
|
return PASS;
|
||||||
Location to = player.getLocation();
|
}
|
||||||
to.setY(to.getY() - distanceToFall(to));
|
} else {
|
||||||
player.teleport(to);
|
if (fallDistance > LAST_FALL_DISTANCE.get(player.getUniqueId()) && !player.isOnGround()
|
||||||
// Report glide violation to statistics, just for the lulz jk
|
&& Utilities.isNotNearSlime(distance.getTo().getBlock()) && fallDistance < 1.5
|
||||||
AntiCheatReloaded.getPlugin().onGlideViolation();
|
&& !Utilities.isClimbableBlock(distance.getTo().getBlock()) && !player.isSneaking()
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
&& !AntiCheatReloaded.getManager().getBackend().isEating(player)) {
|
||||||
player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
|
// TODO that fallDistance check is a horrible way to prevent a certain false
|
||||||
} else {
|
// positive
|
||||||
violations.put(player.getUniqueId(), violations.get(player.getUniqueId()) + 1);
|
// Needs to be fixed since this only works for slight above ground movements
|
||||||
|
float predicted = calculateNextMotionY(LAST_MOTION_Y.get(player.getUniqueId()).floatValue());
|
||||||
|
float actual = Double.valueOf(motionY).floatValue();
|
||||||
|
float scaledDifference = Math.abs((predicted - actual) + 0.1568f);
|
||||||
|
if (scaledDifference > 3E-8) {
|
||||||
|
if (violations + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()
|
||||||
|
&& !Utilities.canStand(distance.getTo().getBlock())) {
|
||||||
|
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||||
|
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||||
|
Location prev = player.getLocation().clone();
|
||||||
|
prev.setY(prev.getY() - distanceToFall(prev));
|
||||||
|
player.teleport(AntiCheatReloaded.getManager().getUserManager()
|
||||||
|
.getUser(player.getUniqueId()).getGoodLocation(prev));
|
||||||
|
}
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "type=gravity, offset="
|
||||||
|
+ new BigDecimal(scaledDifference).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||||
|
} else {
|
||||||
|
VIOLATIONS.put(player.getUniqueId(), violations + 1);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
||||||
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
|
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
||||||
return PASS;
|
if (violations > Math.round(AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT() / 2)) {
|
||||||
|
VIOLATIONS.put(player.getUniqueId(), violations - 1);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float calculateNextMotionY(float motionY) {
|
||||||
|
return (motionY - 0.08f) * 0.98f;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -5,70 +23,90 @@ 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;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This check is an outdated mess which needs to be replaced
|
||||||
|
*/
|
||||||
public class SpeedCheck {
|
public class SpeedCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Integer> SPEED_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
public static Map<UUID, Integer> speedViolation = new HashMap<UUID, Integer>();
|
|
||||||
|
|
||||||
public static boolean isSpeedExempt(Player player) {
|
public static boolean isSpeedExempt(Player player, Backend backend) {
|
||||||
return AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)
|
return backend.isMovingExempt(player) || backend.justVelocity(player) || VersionUtil.isFlying(player);
|
||||||
|| AntiCheatReloaded.getManager().getBackend().justVelocity(player) || VersionUtil.isFlying(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkXZSpeed(Player player, double x, double z) {
|
public static CheckResult checkXZSpeed(Player player, double x, double z) {
|
||||||
if (!isSpeedExempt(player) && player.getVehicle() == null) {
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
if (!isSpeedExempt(player, backend) && player.getVehicle() == null) {
|
||||||
String reason = "";
|
String reason = "";
|
||||||
double max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX();
|
double max = backend.getMagic().XZ_SPEED_MAX();
|
||||||
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
||||||
if (player.isSprinting()) {
|
if (player.isSprinting()) {
|
||||||
reason = "on soulsand while sprinting ";
|
reason = "on soulsand while sprinting ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND_SPRINT();
|
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND_SPRINT();
|
||||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
reason = "on soulsand with speed potion ";
|
reason = "on soulsand with speed potion ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND_POTION();
|
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND_POTION();
|
||||||
} else {
|
} else {
|
||||||
reason = "on soulsand ";
|
reason = "on soulsand ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
|
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND();
|
||||||
}
|
}
|
||||||
} else if (VersionUtil.isFlying(player)) {
|
} else if (VersionUtil.isFlying(player)) {
|
||||||
reason = "while flying ";
|
reason = "while flying ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY();
|
max = backend.getMagic().XZ_SPEED_MAX_FLY();
|
||||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
if (player.isSprinting()) {
|
if (player.isSprinting()) {
|
||||||
reason = "with speed potion while sprinting ";
|
reason = "with speed potion while sprinting ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION_SPRINT();
|
max = backend.getMagic().XZ_SPEED_MAX_POTION_SPRINT();
|
||||||
} else {
|
} else {
|
||||||
reason = "with speed potion ";
|
reason = "with speed potion ";
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION();
|
max = backend.getMagic().XZ_SPEED_MAX_POTION();
|
||||||
}
|
}
|
||||||
} else if (player.isSprinting()) {
|
} else if (player.isSprinting()) {
|
||||||
reason = "while sprinting ";
|
String blockDownName = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().name();
|
||||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
|
if (blockDownName.endsWith("ICE")
|
||||||
|
&& (player.getEyeLocation().getBlock().getRelative(BlockFace.UP).getType() != Material.AIR)) {
|
||||||
|
if (player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")) {
|
||||||
|
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ")
|
||||||
|
+ " and trapdoor";
|
||||||
|
max = backend.getMagic().XZ_SPEED_MAX_SPRINT()
|
||||||
|
+ (blockDownName.equals("BLUE_ICE") ? 0.35925D : 0.35D);
|
||||||
|
} else {
|
||||||
|
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ") + " ";
|
||||||
|
max = backend.getMagic().XZ_SPEED_MAX_SPRINT()
|
||||||
|
+ (blockDownName.equals("BLUE_ICE") ? 0.20925D : 0.2D);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reason = "while sprinting ";
|
||||||
|
max = backend.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;
|
||||||
|
|
||||||
if (x > max || z > max) {
|
if (x > max || z > max) {
|
||||||
int num = AntiCheatReloaded.getManager().getBackend().increment(player, speedViolation,
|
int num = backend.increment(player, SPEED_VIOLATIONS, backend.getMagic().SPEED_MAX());
|
||||||
AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX());
|
if (num >= backend.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="
|
+ backend.getMagic().SPEED_MAX() + ", speed=" + (x > z ? x : z) + ", max speed="
|
||||||
+ (x > z ? x : z) + ", max speed=" + max + ")");
|
+ max + ")");
|
||||||
} else {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
speedViolation.put(player.getUniqueId(), 0);
|
SPEED_VIOLATIONS.put(player.getUniqueId(), 0);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -76,4 +114,19 @@ public class SpeedCheck {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CheckResult checkYSpeed(Player player, double y) {
|
||||||
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
if (!backend.isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping()
|
||||||
|
&& (y > backend.getMagic().Y_SPEED_MAX())
|
||||||
|
&& !backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_TIME())
|
||||||
|
&& !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)
|
||||||
|
&& !Utilities.isSlime(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
|
.getGoodLocation(player.getLocation()).getBlock())) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"y speed was too high (speed=" + y + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
||||||
|
} else {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -6,96 +25,94 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
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.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
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 {
|
||||||
|
|
||||||
|
public static final List<UUID> IS_IN_WATER = new ArrayList<UUID>();
|
||||||
|
public static final List<UUID> IS_IN_WATER_CACHE = new ArrayList<UUID>();
|
||||||
|
public static final Map<UUID, Integer> WATER_SPEED_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
public static final Map<UUID, Integer> WATER_ASCENSION_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static List<UUID> isInWater = new ArrayList<UUID>();
|
|
||||||
public static List<UUID> isInWaterCache = new ArrayList<UUID>();
|
|
||||||
public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>();
|
|
||||||
public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>();
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
||||||
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
|
|
||||||
if (player.getVehicle() == null && !player.isFlying() && !VersionUtil.isFrostWalk(player)) {
|
if (player.getVehicle() == null && !player.isFlying() && !VersionUtil.isFrostWalk(player)) {
|
||||||
if (block.isLiquid()) {
|
if (block.isLiquid()) {
|
||||||
if (isInWater.contains(uuid)) {
|
if (IS_IN_WATER.contains(uuid)) {
|
||||||
if (isInWaterCache.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 > backend.getMagic().XZ_SPEED_MAX_WATER()
|
||||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER();
|
|| z > backend.getMagic().XZ_SPEED_MAX_WATER();
|
||||||
} else {
|
} else {
|
||||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
violation = x > backend.getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
||||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic()
|
|| z > backend.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.WATER_LILY)) {
|
&& !block.getType().equals(Utilities.LILY_PAD)) {
|
||||||
b = true;
|
violation = true;
|
||||||
}
|
}
|
||||||
if (b) {
|
if (violation) {
|
||||||
if (waterSpeedViolation.containsKey(uuid)) {
|
if (WATER_SPEED_VIOLATIONS.containsKey(uuid)) {
|
||||||
int v = waterSpeedViolation.get(uuid);
|
int v = WATER_SPEED_VIOLATIONS.get(uuid);
|
||||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic()
|
if (v >= backend.getMagic().WATER_SPEED_VIOLATION_MAX()) {
|
||||||
.WATER_SPEED_VIOLATION_MAX()) {
|
WATER_SPEED_VIOLATIONS.put(uuid, 0);
|
||||||
waterSpeedViolation.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 {
|
||||||
waterSpeedViolation.put(uuid, v + 1);
|
WATER_SPEED_VIOLATIONS.put(uuid, v + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
waterSpeedViolation.put(uuid, 1);
|
WATER_SPEED_VIOLATIONS.put(uuid, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isInWaterCache.add(uuid);
|
IS_IN_WATER_CACHE.add(uuid);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isInWater.add(uuid);
|
IS_IN_WATER.add(uuid);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
} else if (block.getRelative(BlockFace.DOWN).isLiquid()
|
} else if (block.getRelative(BlockFace.DOWN).isLiquid() && !backend.isAscending(player)
|
||||||
&& !AntiCheatReloaded.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block)
|
&& Utilities.cantStandAt(block) && Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))
|
||||||
&& Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))) {
|
&& (y < 0.025 || y == 0.09999999999999964 || y == 0.14999999999999947
|
||||||
if (waterAscensionViolation.containsKey(uuid)) {
|
|| y == 0.04999999999999982)) {
|
||||||
int v = waterAscensionViolation.get(uuid);
|
if (WATER_ASCENSION_VIOLATIONS.containsKey(uuid)) {
|
||||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
int v = WATER_ASCENSION_VIOLATIONS.get(uuid);
|
||||||
waterAscensionViolation.put(uuid, 0);
|
if (v >= backend.getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
||||||
|
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 {
|
||||||
waterAscensionViolation.put(uuid, v + 1);
|
WATER_ASCENSION_VIOLATIONS.put(uuid, v + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
waterAscensionViolation.put(uuid, 1);
|
WATER_ASCENSION_VIOLATIONS.put(uuid, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isInWater.remove(uuid);
|
IS_IN_WATER.remove(uuid);
|
||||||
isInWaterCache.remove(uuid);
|
IS_IN_WATER_CACHE.remove(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|||||||
@@ -1,11 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
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;
|
||||||
@@ -20,13 +37,12 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
|
|
||||||
public class YAxisCheck {
|
public class YAxisCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Double> LAST_Y_COORD_CACHE = new HashMap<UUID, Double>();
|
||||||
|
public static final Map<UUID, Long> LAST_Y_TIME = new HashMap<UUID, Long>();
|
||||||
|
public static final Map<UUID, Integer> Y_AXIS_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
public static final Map<UUID, Long> LAST_Y_AXIS_VIOLATION = new HashMap<UUID, Long>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static Map<UUID, Double> lastYcoord = new HashMap<UUID, Double>();
|
|
||||||
public static Map<UUID, Long> lastYtime = new HashMap<UUID, Long>();
|
|
||||||
public static Map<UUID, Integer> yAxisViolations = new HashMap<UUID, Integer>();
|
|
||||||
public static Map<UUID, Long> yAxisLastViolation = new HashMap<UUID, Long>();
|
|
||||||
|
|
||||||
private static boolean hasJumpPotion(Player player) {
|
private static boolean hasJumpPotion(Player player) {
|
||||||
return player.hasPotionEffect(PotionEffectType.JUMP);
|
return player.hasPotionEffect(PotionEffectType.JUMP);
|
||||||
}
|
}
|
||||||
@@ -44,58 +60,62 @@ public class YAxisCheck {
|
|||||||
double y1 = player.getLocation().getY();
|
double y1 = player.getLocation().getY();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
// Fix Y axis spam.
|
// Fix Y axis spam.
|
||||||
if (!lastYcoord.containsKey(uuid) || !lastYtime.containsKey(uuid)
|
if (!LAST_Y_COORD_CACHE.containsKey(uuid) || !LAST_Y_TIME.containsKey(uuid)
|
||||||
|| !yAxisLastViolation.containsKey(uuid)) {
|
|| !LAST_Y_AXIS_VIOLATION.containsKey(uuid)) {
|
||||||
lastYcoord.put(uuid, y1);
|
LAST_Y_COORD_CACHE.put(uuid, y1);
|
||||||
yAxisViolations.put(uuid, 0);
|
Y_AXIS_VIOLATIONS.put(uuid, 0);
|
||||||
yAxisLastViolation.put(uuid, 0L);
|
LAST_Y_AXIS_VIOLATION.put(uuid, 0L);
|
||||||
lastYtime.put(uuid, System.currentTimeMillis());
|
LAST_Y_TIME.put(uuid, System.currentTimeMillis());
|
||||||
} else {
|
} else {
|
||||||
if (y1 > lastYcoord.get(uuid)
|
if (y1 > LAST_Y_COORD_CACHE.get(uuid)
|
||||||
&& yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
&& Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) < AntiCheatReloaded.getManager()
|
.Y_MAXVIOLATIONS()
|
||||||
.getBackend().getMagic().Y_MAXVIOTIME()) {
|
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) < AntiCheatReloaded
|
||||||
|
.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||||
Location g = player.getLocation();
|
Location g = player.getLocation();
|
||||||
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
|
Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1);
|
||||||
yAxisLastViolation.put(uuid, System.currentTimeMillis());
|
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||||
g.setY(lastYcoord.get(uuid));
|
g.setY(LAST_Y_COORD_CACHE.get(uuid));
|
||||||
if (g.getBlock().getType() == Material.AIR) {
|
if (g.getBlock().getType() == Material.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 " + yAxisViolations.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 (yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
if (Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheatReloaded.getManager()
|
.Y_MAXVIOLATIONS()
|
||||||
.getBackend().getMagic().Y_MAXVIOTIME()) {
|
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) > AntiCheatReloaded
|
||||||
yAxisViolations.put(uuid, 0);
|
.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||||
yAxisLastViolation.put(uuid, 0L);
|
Y_AXIS_VIOLATIONS.put(uuid, 0);
|
||||||
|
LAST_Y_AXIS_VIOLATION.put(uuid, 0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long i = System.currentTimeMillis() - lastYtime.get(uuid);
|
long i = System.currentTimeMillis() - LAST_Y_TIME.get(uuid);
|
||||||
double diff = AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
double diff = AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
||||||
+ (Utilities.isStair(player.getLocation().add(0, -1, 0).getBlock()) ? 0.5 : 0.0);
|
+ ((Utilities.isStair(player.getLocation().add(0, -1, 0).getBlock()) || Utilities.isStair(player.getLocation().add(0, -0.5, 0).getBlock())) ? 0.5 : 0.0);
|
||||||
if ((y1 - lastYcoord.get(uuid)) > diff && i < AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME()) {
|
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > diff
|
||||||
|
&& i < AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME()) {
|
||||||
Location g = player.getLocation();
|
Location g = player.getLocation();
|
||||||
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
|
Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1);
|
||||||
yAxisLastViolation.put(uuid, System.currentTimeMillis());
|
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||||
g.setY(lastYcoord.get(uuid));
|
g.setY(LAST_Y_COORD_CACHE.get(uuid));
|
||||||
if (g.getBlock().getType() == Material.AIR) {
|
if (g.getBlock().getType() == Material.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 - lastYcoord.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF() + 1
|
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
|| (System.currentTimeMillis() - lastYtime.get(uuid)) > AntiCheatReloaded.getManager().getBackend()
|
.Y_MAXDIFF() + 1
|
||||||
.getMagic().Y_TIME()) {
|
|| (System.currentTimeMillis() - LAST_Y_TIME.get(uuid)) > AntiCheatReloaded.getManager()
|
||||||
lastYtime.put(uuid, System.currentTimeMillis());
|
.getBackend().getMagic().Y_TIME()) {
|
||||||
lastYcoord.put(uuid, y1);
|
LAST_Y_TIME.put(uuid, System.currentTimeMillis());
|
||||||
|
LAST_Y_COORD_CACHE.put(uuid, y1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +125,7 @@ public class YAxisCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMoveUpBlock(Block block) {
|
public static boolean isMoveUpBlock(Block block) {
|
||||||
return VersionUtil.getMoveUpBlocks().contains(block.getType());
|
return Utilities.isStair(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* 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.packet;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
|
||||||
|
public class BadPacketsCheck {
|
||||||
|
|
||||||
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|
||||||
|
|| backend.isMovingExempt(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PacketContainer packet = event.getPacket();
|
||||||
|
float pitch = packet.getFloat().read(1);
|
||||||
|
// Check for derp
|
||||||
|
if (Math.abs(pitch) > 90) {
|
||||||
|
flag(player, event, "had an illegal pitch");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO more precise checking for this
|
||||||
|
if (AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).isLagging()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
double x = packet.getDoubles().read(0);
|
||||||
|
double y = packet.getDoubles().read(1);
|
||||||
|
double z = packet.getDoubles().read(2);
|
||||||
|
float yaw = packet.getFloat().read(0);
|
||||||
|
// Create location from new data
|
||||||
|
Location previous = player.getLocation();
|
||||||
|
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
|
||||||
|
double distance = previous.distanceSquared(current);
|
||||||
|
double maxDistance = backend.getMagic().BADPACKETS_MAX_DISTANCE();
|
||||||
|
boolean hasNewLocation = packet.getBooleans().read(0);
|
||||||
|
if (distance > maxDistance) {
|
||||||
|
flag(player, event, "moved too far between packets (distance=" + new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
||||||
|
return;
|
||||||
|
} else if (distance < 1E-10 && !hasNewLocation) {
|
||||||
|
// TODO this gives false positives when teleporting
|
||||||
|
// Only found this in 1.8.8 though
|
||||||
|
//flag(player, event, "sent the same packet twice");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void flag(Player player, PacketEvent event, String message) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
// We are currently not in the main server thread, so switch
|
||||||
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
|
CheckType.BADPACKETS);
|
||||||
|
player.teleport(player.getLocation());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
* 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.packet;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Rammelkast
|
||||||
|
*/
|
||||||
|
public class MorePacketsCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Integer> MOVE_COUNT = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
|
public static void startTimer() {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
MOVE_COUNT.clear();
|
||||||
|
}
|
||||||
|
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
|
// Confirm if we should even check for MorePackets
|
||||||
|
// If your TPS is lower than 15 you are running a shitshow
|
||||||
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS) || tps < 15) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location currentLocation = event.getPlayer().getLocation();
|
||||||
|
if (!MOVE_COUNT.containsKey(player.getUniqueId())) {
|
||||||
|
MOVE_COUNT.put(player.getUniqueId(), 1);
|
||||||
|
} else {
|
||||||
|
MOVE_COUNT.put(player.getUniqueId(), MOVE_COUNT.get(player.getUniqueId()) + 1);
|
||||||
|
int ping = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).getPing();
|
||||||
|
int limit = AntiCheatReloaded.getManager().getBackend().getMagic().MOREPACKETS_LIMIT();
|
||||||
|
int averagePing = AntiCheatReloaded.getManager().getBackend().getMagic().MOREPACKETS_AVERAGE_PING();
|
||||||
|
float pingLeniency = (float) ((ping / averagePing));
|
||||||
|
if (pingLeniency < 1)
|
||||||
|
pingLeniency = 1;
|
||||||
|
if (pingLeniency > 2)
|
||||||
|
pingLeniency = 2;
|
||||||
|
float tpsLeniency = (float) ((19 / tps));
|
||||||
|
if (tps > 19) {
|
||||||
|
tpsLeniency = 1;
|
||||||
|
}
|
||||||
|
float leniency = pingLeniency * tpsLeniency;
|
||||||
|
limit = Math.round(leniency * limit);
|
||||||
|
final float finalLeniency = leniency;
|
||||||
|
try {
|
||||||
|
if (MOVE_COUNT.get(player.getUniqueId()) > limit) {
|
||||||
|
final int packets = MOVE_COUNT.get(player.getUniqueId());
|
||||||
|
MOVE_COUNT.remove(player.getUniqueId());
|
||||||
|
event.setCancelled(true);
|
||||||
|
// We are currently not in the main server thread, so switch
|
||||||
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
EventListener
|
||||||
|
.log(new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
"sent " + packets + " packets in one second (max="
|
||||||
|
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||||
|
.MOREPACKETS_LIMIT()
|
||||||
|
+ ", leniency=" + finalLeniency + ")").getMessage(),
|
||||||
|
player, CheckType.MOREPACKETS);
|
||||||
|
player.teleport(currentLocation);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (NullPointerException nullPointer) {
|
||||||
|
// TODO this is thrown sometimes, might have something to do with line 83
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.check.player;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @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?
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* 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.check.combat.KillAuraCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
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 = VersionUtil.getTargetBlock(player, ((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 = KillAuraCheck.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -44,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,7 +65,11 @@ public class CommandBase {
|
|||||||
if (permission.get(cs)) {
|
if (permission.get(cs)) {
|
||||||
execute(cs, args);
|
execute(cs, args);
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
if (args == null) {
|
||||||
|
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
||||||
|
} else {
|
||||||
|
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,9 +78,9 @@ public class CommandBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,13 +27,13 @@ import org.bukkit.command.CommandExecutor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandDebug;
|
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandDeveloper;
|
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
|
||||||
|
import com.rammelkast.anticheatreloaded.command.executors.CommandMute;
|
||||||
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 {
|
||||||
|
|
||||||
@@ -41,12 +42,12 @@ public class CommandHandler implements CommandExecutor {
|
|||||||
public CommandHandler() {
|
public CommandHandler() {
|
||||||
commands.add(new CommandHelp());
|
commands.add(new CommandHelp());
|
||||||
commands.add(new CommandCheck());
|
commands.add(new CommandCheck());
|
||||||
commands.add(new CommandDebug());
|
|
||||||
commands.add(new CommandDeveloper());
|
|
||||||
commands.add(new CommandLog());
|
commands.add(new CommandLog());
|
||||||
commands.add(new CommandReload());
|
commands.add(new CommandReload());
|
||||||
commands.add(new CommandReport());
|
commands.add(new CommandReport());
|
||||||
|
commands.add(new CommandMute());
|
||||||
commands.add(new CommandReset());
|
commands.add(new CommandReset());
|
||||||
|
commands.add(new CommandVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,7 +29,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class CommandCheck extends CommandBase {
|
public class CommandCheck extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Check Management";
|
private static final String NAME = "AntiCheatReloaded Check Management";
|
||||||
private static final String COMMAND = "check";
|
private static final String COMMAND = "check";
|
||||||
private static final String USAGE = "anticheat check [check] [on/off]";
|
private static final String USAGE = "anticheat check [check] [on/off]";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheat for Bukkit.
|
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
|
||||||
*
|
|
||||||
* 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.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.PastebinReport;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
|
||||||
|
|
||||||
public class CommandDebug extends CommandBase {
|
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Debug Reporting";
|
|
||||||
private static final String COMMAND = "debug";
|
|
||||||
private static final String USAGE = "anticheat debug <user>";
|
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_DEBUG;
|
|
||||||
private static final String[] HELP = {
|
|
||||||
GRAY + "Use: " + AQUA + "/anticheat debug" + GRAY + " to create a debug report",
|
|
||||||
GRAY + "Use: " + AQUA + "/anticheat debug <user>" + GRAY + " to create a debug report for a user",
|
|
||||||
};
|
|
||||||
|
|
||||||
public CommandDebug() {
|
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
|
||||||
Player player = null;
|
|
||||||
if (args.length == 1) {
|
|
||||||
player = Bukkit.getPlayer(args[0]);
|
|
||||||
} else {
|
|
||||||
if (cs instanceof Player) {
|
|
||||||
player = (Player) cs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cs.sendMessage(GRAY + "Please wait while I collect some data...");
|
|
||||||
PastebinReport report = new PastebinReport(cs, player);
|
|
||||||
cs.sendMessage(GREEN + "Debug information posted to: " + WHITE + report.getURL());
|
|
||||||
cs.sendMessage(GREEN + "Please include this link when making bug reports.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheat for Bukkit.
|
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
|
||||||
*
|
|
||||||
* 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.command.CommandSender;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
|
||||||
|
|
||||||
public class CommandDeveloper extends CommandBase {
|
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Developer Mode";
|
|
||||||
private static final String COMMAND = "developer";
|
|
||||||
private static final String USAGE = "anticheat developer";
|
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_DEBUG;
|
|
||||||
private static final String[] HELP = {
|
|
||||||
GRAY + "Use: " + AQUA + "/anticheat developer" + GRAY + " to turn on developer mode",
|
|
||||||
};
|
|
||||||
|
|
||||||
public CommandDeveloper() {
|
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
|
||||||
AntiCheatReloaded.setDeveloperMode(!AntiCheatReloaded.developerMode());
|
|
||||||
cs.sendMessage(GREEN + "Developer mode " + (AntiCheatReloaded.developerMode() ? "ON" : "OFF"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -30,14 +31,14 @@ 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 + "/anti " + GRAY + "help",
|
GOLD + "/acr " + GRAY + "help",
|
||||||
RED + "/anti " + GRAY + "reload",
|
GOLD + "/acr " + GRAY + "reload",
|
||||||
RED + "/anti " + GRAY + "update",
|
GOLD + "/acr " + GRAY + "version",
|
||||||
RED + "/anti " + GRAY + "debug " + WHITE + "<user>",
|
GOLD + "/acr " + GRAY + "mute",
|
||||||
RED + "/anti " + GRAY + "check " + WHITE + "[check] [on/off]",
|
GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
||||||
RED + "/anti " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
||||||
RED + "/anti " + GRAY + "report " + WHITE + "[group/user]",
|
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
||||||
RED + "/anti " + GRAY + "reset " + WHITE + "[user]",
|
GOLD + "/acr " + GRAY + "reset " + WHITE + "[user]",
|
||||||
};
|
};
|
||||||
|
|
||||||
public CommandHelp() {
|
public CommandHelp() {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,7 +27,7 @@ import com.rammelkast.anticheatreloaded.util.Permission;
|
|||||||
|
|
||||||
public class CommandLog extends CommandBase {
|
public class CommandLog extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Logging";
|
private static final String NAME = "AntiCheatReloaded Logging";
|
||||||
private static final String COMMAND = "log";
|
private static final String COMMAND = "log";
|
||||||
private static final String USAGE = "anticheat log [file/console] [on/off]";
|
private static final String USAGE = "anticheat log [file/console] [on/off]";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_LOG;
|
private static final Permission PERMISSION = Permission.SYSTEM_LOG;
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* 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 java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
|
|
||||||
|
public class CommandMute extends CommandBase {
|
||||||
|
|
||||||
|
private static final String NAME = "AntiCheatReloaded Mute";
|
||||||
|
private static final String COMMAND = "mute";
|
||||||
|
private static final String USAGE = "anticheat reload";
|
||||||
|
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
|
||||||
|
private static final String[] HELP = {
|
||||||
|
GRAY + "Use: " + AQUA + "/anticheat mute" + GRAY + " to mute all notifications", };
|
||||||
|
|
||||||
|
public CommandMute() {
|
||||||
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
|
if (!(cs instanceof Player)) {
|
||||||
|
cs.sendMessage(ChatColor.BOLD + "" + GOLD + "ACR " + GRAY + "This command is only for players");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UUID uuid = ((Player) cs).getUniqueId();
|
||||||
|
if (AntiCheatReloaded.MUTE_ENABLED_MODS.contains(uuid)) {
|
||||||
|
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "ACR " + GRAY + "Player alerts have been unmuted");
|
||||||
|
AntiCheatReloaded.MUTE_ENABLED_MODS.remove(uuid);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "ACR " + GRAY + "Player alerts have been muted");
|
||||||
|
AntiCheatReloaded.MUTE_ENABLED_MODS.add(uuid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,7 +26,7 @@ import com.rammelkast.anticheatreloaded.util.Permission;
|
|||||||
|
|
||||||
public class CommandReload extends CommandBase {
|
public class CommandReload extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Reload";
|
private static final String NAME = "AntiCheatReloaded Reload";
|
||||||
private static final String COMMAND = "reload";
|
private static final String COMMAND = "reload";
|
||||||
private static final String USAGE = "anticheat reload";
|
private static final String USAGE = "anticheat reload";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
|
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
|
||||||
|
|||||||
+26
-31
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,6 +19,10 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@@ -26,23 +31,21 @@ import org.bukkit.entity.Player;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
import com.rammelkast.anticheatreloaded.util.Group;
|
||||||
import com.rammelkast.anticheatreloaded.util.*;
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import java.util.ArrayList;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class CommandReport extends CommandBase {
|
public class CommandReport extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Reports";
|
private static final String NAME = "AntiCheatReloaded Reports";
|
||||||
private static final String COMMAND = "report";
|
private static final String COMMAND = "report";
|
||||||
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() {
|
||||||
@@ -70,7 +73,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()) {
|
||||||
@@ -80,6 +83,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())) {
|
||||||
@@ -103,7 +112,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));
|
||||||
@@ -115,7 +124,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);
|
||||||
@@ -146,7 +155,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++) {
|
||||||
@@ -166,7 +175,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.");
|
||||||
@@ -175,19 +184,5 @@ public class CommandReport extends CommandBase {
|
|||||||
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
|
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AntiCheatReloaded.developerMode()) {
|
|
||||||
int permission = 0;
|
|
||||||
int check = 0;
|
|
||||||
for (Permission perm : Permission.values()) {
|
|
||||||
if (perm.get(user.getPlayer())) permission++;
|
|
||||||
}
|
|
||||||
CheckManager manager = AntiCheatReloaded.getManager().getCheckManager();
|
|
||||||
for (CheckType type : CheckType.values()) {
|
|
||||||
if (manager.willCheck(user.getPlayer(), type)) check++;
|
|
||||||
}
|
|
||||||
cs.sendMessage(ChatColor.GOLD + "User has " + permission + "/" + Permission.values().length + " permissions");
|
|
||||||
cs.sendMessage(ChatColor.GOLD + "User will be checked for " + check + "/" + CheckType.values().length + " checks");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,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;
|
||||||
@@ -29,7 +29,7 @@ import com.rammelkast.anticheatreloaded.util.User;
|
|||||||
|
|
||||||
public class CommandReset extends CommandBase {
|
public class CommandReset extends CommandBase {
|
||||||
|
|
||||||
private static final String NAME = "AntiCheat Resetting";
|
private static final String NAME = "AntiCheatReloaded Resetting";
|
||||||
private static final String COMMAND = "reset";
|
private static final String COMMAND = "reset";
|
||||||
private static final String USAGE = "anticheat reset [user]";
|
private static final String USAGE = "anticheat reset [user]";
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_RESET;
|
private static final Permission PERMISSION = Permission.SYSTEM_RESET;
|
||||||
@@ -41,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;
|
||||||
@@ -54,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_VERSION;
|
||||||
|
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 + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -56,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>() {
|
||||||
add(config);
|
private static final long serialVersionUID = 4497798966909062852L;
|
||||||
add(enterprise);
|
{
|
||||||
}};
|
add(config);
|
||||||
|
add(enterprise);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
dbfiles = new ArrayList<ConfigurationTable>();
|
dbfiles = new ArrayList<ConfigurationTable>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -169,7 +170,8 @@ public class ConfigurationFile {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getValue() {
|
@SuppressWarnings("unchecked")
|
||||||
|
public T getValue() {
|
||||||
return (T) value;
|
return (T) value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +181,8 @@ public class ConfigurationFile {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getDefaultValue() {
|
@SuppressWarnings("unchecked")
|
||||||
|
public T getDefaultValue() {
|
||||||
return (T) getDefaultConfigFile().get(path);
|
return (T) getDefaultConfigFile().get(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -103,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 + " = ?";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,13 +30,12 @@ public class Config extends ConfigurationFile {
|
|||||||
public static final String FILENAME = "config.yml";
|
public static final String FILENAME = "config.yml";
|
||||||
|
|
||||||
public ConfigValue<Boolean> logToConsole;
|
public ConfigValue<Boolean> logToConsole;
|
||||||
public ConfigValue<Boolean> autoUpdate;
|
|
||||||
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;
|
||||||
@@ -59,12 +59,12 @@ public class Config extends ConfigurationFile {
|
|||||||
public void open() {
|
public void open() {
|
||||||
logToConsole = new ConfigValue<Boolean>("system.log-to-console");
|
logToConsole = new ConfigValue<Boolean>("system.log-to-console");
|
||||||
|
|
||||||
autoUpdate = new ConfigValue<Boolean>("system.auto-update");
|
|
||||||
verboseStartup = new ConfigValue<Boolean>("system.verbose-startup");
|
verboseStartup = new ConfigValue<Boolean>("system.verbose-startup");
|
||||||
silentMode = new ConfigValue<Boolean>("system.silent-mode");
|
silentMode = new ConfigValue<Boolean>("system.silent-mode");
|
||||||
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");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+4
-3
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -73,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.providers;
|
package com.rammelkast.anticheatreloaded.config.providers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -153,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.
|
||||||
*/
|
*/
|
||||||
@@ -234,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();
|
||||||
/**
|
/**
|
||||||
@@ -244,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.
|
||||||
*/
|
*/
|
||||||
@@ -262,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();
|
||||||
/**
|
/**
|
||||||
@@ -270,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();
|
||||||
/**
|
/**
|
||||||
@@ -353,28 +350,44 @@ public interface Magic {
|
|||||||
* The minimum time it should have taken for the player to click X times; Type=INTEGER; Leniency=INCREASE.
|
* The minimum time it should have taken for the player to click X times; Type=INTEGER; Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int INVENTORY_TIMEMIN();
|
public int INVENTORY_TIMEMIN();
|
||||||
/**
|
|
||||||
* The number of steps we should wait before checking if the player has used timer cheating; Type=INTEGER; Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int TIMER_STEP_CHECK();
|
|
||||||
/**
|
|
||||||
* The minimum time it should have taken for the player to travel X steps; Type=SYSTEM; Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int TIMER_TIMEMIN();
|
|
||||||
/**
|
/**
|
||||||
* 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 MOREPACKETS_LIMIT();
|
||||||
/**
|
/**
|
||||||
* 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 MOREPACKETS_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();
|
||||||
|
/**
|
||||||
|
* The minimum time it takes to regenerate health; TYPE=INTEGER, Leniency=DECREASE
|
||||||
|
*/
|
||||||
|
public int MIN_HEAL_TIME();
|
||||||
|
/**
|
||||||
|
* Maximum distance allowed between two movement packets; Type=DOUBLE, Leniency=INCREASE.
|
||||||
|
*/
|
||||||
|
public double BADPACKETS_MAX_DISTANCE();
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,7 +17,6 @@
|
|||||||
* 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.config.providers;
|
package com.rammelkast.anticheatreloaded.config.providers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -29,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;
|
||||||
|
|
||||||
@@ -54,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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,32 +86,38 @@ 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);
|
if (result.failed()) {
|
||||||
if (result.failed()) {
|
event.setCancelled(!silentMode());
|
||||||
event.setCancelled(!silentMode());
|
log(result.getMessage(), player, CheckType.FAST_BREAK);
|
||||||
log(result.getMessage(), player, CheckType.FAST_BREAK);
|
noHack = false;
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheck(player, CheckType.NO_SWING)) {
|
}
|
||||||
result = getBackend().checkSwing(player, block);
|
if (getCheckManager().willCheck(player, CheckType.NO_SWING)) {
|
||||||
if (result.failed()) {
|
result = getBackend().checkSwing(player, block);
|
||||||
event.setCancelled(!silentMode());
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.NO_SWING);
|
event.setCancelled(!silentMode());
|
||||||
noHack = false;
|
log(result.getMessage(), player, CheckType.NO_SWING);
|
||||||
}
|
noHack = false;
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheck(player, CheckType.LONG_REACH)) {
|
}
|
||||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
if (getCheckManager().willCheck(player, CheckType.LONG_REACH)) {
|
||||||
result = getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
||||||
if (result.failed()) {
|
result = getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||||
event.setCancelled(!silentMode());
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.LONG_REACH);
|
event.setCancelled(!silentMode());
|
||||||
noHack = false;
|
log(result.getMessage(), player, CheckType.LONG_REACH);
|
||||||
}
|
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) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,6 +29,8 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
@@ -36,9 +39,7 @@ import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
|||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
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;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
|
||||||
|
|
||||||
public class EntityListener extends EventListener {
|
public class EntityListener extends EventListener {
|
||||||
|
|
||||||
@@ -104,9 +105,6 @@ public class EntityListener extends EventListener {
|
|||||||
if (event instanceof EntityDamageByEntityEvent) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
if (getCheckManager().willCheck((Player)e.getDamager(), CheckType.KILLAURA)) {
|
|
||||||
KillAuraCheck.doDamageEvent(e, (Player)e.getDamager());
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck((Player)e.getDamager(), CheckType.CRITICALS)) {
|
if (getCheckManager().willCheck((Player)e.getDamager(), CheckType.CRITICALS)) {
|
||||||
CriticalsCheck.doDamageEvent(e, (Player)e.getDamager());
|
CriticalsCheck.doDamageEvent(e, (Player)e.getDamager());
|
||||||
}
|
}
|
||||||
@@ -117,7 +115,7 @@ public class EntityListener extends EventListener {
|
|||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
Player p = (Player) e.getDamager();
|
Player p = (Player) e.getDamager();
|
||||||
getBackend().logDamage(p, 1);
|
getBackend().logDamage(p, 1);
|
||||||
int value = p.getInventory().getItemInHand().containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
int value = VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
||||||
getBackend().logDamage(player, value);
|
getBackend().logDamage(player, value);
|
||||||
if (getCheckManager().willCheck(p, CheckType.LONG_REACH)) {
|
if (getCheckManager().willCheck(p, CheckType.LONG_REACH)) {
|
||||||
Distance distance = new Distance(player.getLocation(), p.getLocation());
|
Distance distance = new Distance(player.getLocation(), p.getLocation());
|
||||||
@@ -147,19 +145,19 @@ 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;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,6 +19,13 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
@@ -25,117 +33,129 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
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.AntiCheatManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class EventListener implements Listener {
|
public class EventListener implements Listener {
|
||||||
private static final Map<CheckType, Integer> USAGE_LIST = new EnumMap<CheckType, Integer>(CheckType.class);
|
private static final Map<CheckType, Integer> USAGE_LIST = new EnumMap<CheckType, Integer>(CheckType.class);
|
||||||
private static final Map<UUID, Integer> DECREASE_LIST = new HashMap<UUID, Integer>();
|
private static final Map<UUID, Integer> DECREASE_LIST = new HashMap<UUID, Integer>();
|
||||||
private static final CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
private static final CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
||||||
private static final Backend BACKEND = AntiCheatReloaded.getManager().getBackend();
|
private static final Backend BACKEND = AntiCheatReloaded.getManager().getBackend();
|
||||||
private static final AntiCheatReloaded PLUGIN = AntiCheatReloaded.getManager().getPlugin();
|
private static final AntiCheatReloaded PLUGIN = AntiCheatReloaded.getManager().getPlugin();
|
||||||
private static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
private static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
||||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||||
|
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
||||||
|
|
||||||
public static void log(String message, Player player, CheckType type) {
|
public static void log(String message, Player player, CheckType type) {
|
||||||
User user = getUserManager().getUser(player.getUniqueId());
|
User user = getUserManager().getUser(player.getUniqueId());
|
||||||
if (user != null) { // npc
|
if (message == null || message.equals("")) {
|
||||||
logCheat(type, user);
|
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||||
if (user.increaseLevel(type) && message != null) {
|
+ CheckType.getName(type);
|
||||||
AntiCheatReloaded.getManager().log(message);
|
} else {
|
||||||
}
|
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||||
removeDecrease(user);
|
+ CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
||||||
}
|
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||||
}
|
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||||
|
}
|
||||||
|
if (user != null) { // npc
|
||||||
|
logCheat(type, user);
|
||||||
|
if (user.increaseLevel(type)) {
|
||||||
|
AntiCheatReloaded.getManager().log(message);
|
||||||
|
}
|
||||||
|
removeDecrease(user);
|
||||||
|
}
|
||||||
|
|
||||||
private static void logCheat(CheckType type, User user) {
|
if (CONFIG.getConfig().debugMode.getValue()) {
|
||||||
USAGE_LIST.put(type, getCheats(type) + 1);
|
player.sendMessage(message);
|
||||||
// Ignore plugins that are creating NPCs with no names (why the hell)
|
}
|
||||||
if (user != null && user.getUUID() != null) {
|
AntiCheatReloaded.getPlugin().sendToStaff(message);
|
||||||
type.logUse(user);
|
}
|
||||||
if (CONFIG.getConfig().enterprise.getValue() && CONFIG.getEnterprise().loggingEnabled.getValue()) {
|
|
||||||
CONFIG.getEnterprise().database.logEvent(user, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetCheck(CheckType type) {
|
private static void logCheat(CheckType type, User user) {
|
||||||
USAGE_LIST.put(type, 0);
|
USAGE_LIST.put(type, getCheats(type) + 1);
|
||||||
}
|
// Ignore plugins that are creating NPCs with no names (why the hell)
|
||||||
|
if (user != null && user.getUUID() != null) {
|
||||||
|
type.logUse(user);
|
||||||
|
if (CONFIG.getConfig().enterprise.getValue() && CONFIG.getEnterprise().loggingEnabled.getValue()) {
|
||||||
|
CONFIG.getEnterprise().database.logEvent(user, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int getCheats(CheckType type) {
|
public void resetCheck(CheckType type) {
|
||||||
int x = 0;
|
USAGE_LIST.put(type, 0);
|
||||||
if (USAGE_LIST.get(type) != null) {
|
}
|
||||||
x = USAGE_LIST.get(type);
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void removeDecrease(User user) {
|
public static int getCheats(CheckType type) {
|
||||||
int x = 0;
|
int x = 0;
|
||||||
// Ignore plugins that are creating NPCs with no names
|
if (USAGE_LIST.get(type) != null) {
|
||||||
if (user.getUUID() != null) {
|
x = USAGE_LIST.get(type);
|
||||||
if (DECREASE_LIST.get(user.getUUID()) != null) {
|
}
|
||||||
x = DECREASE_LIST.get(user.getUUID());
|
return x;
|
||||||
x -= 2;
|
}
|
||||||
if (x < 0) {
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DECREASE_LIST.put(user.getUUID(), x);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void decrease(Player player) {
|
private static void removeDecrease(User user) {
|
||||||
User user = getUserManager().getUser(player.getUniqueId());
|
int x = 0;
|
||||||
// Ignore plugins that are creating NPCs with no names
|
// Ignore plugins that are creating NPCs with no names
|
||||||
if (user.getUUID() != null) {
|
if (user.getUUID() != null) {
|
||||||
int x = 0;
|
if (DECREASE_LIST.get(user.getUUID()) != null) {
|
||||||
|
x = DECREASE_LIST.get(user.getUUID());
|
||||||
|
x -= 2;
|
||||||
|
if (x < 0) {
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DECREASE_LIST.put(user.getUUID(), x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DECREASE_LIST.get(user.getUUID()) != null) {
|
public static void decrease(Player player) {
|
||||||
x = DECREASE_LIST.get(user.getUUID());
|
User user = getUserManager().getUser(player.getUniqueId());
|
||||||
}
|
// Ignore plugins that are creating NPCs with no names
|
||||||
|
if (user.getUUID() != null) {
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
x += 1;
|
if (DECREASE_LIST.get(user.getUUID()) != null) {
|
||||||
DECREASE_LIST.put(user.getUUID(), x);
|
x = DECREASE_LIST.get(user.getUUID());
|
||||||
|
}
|
||||||
|
|
||||||
if (x >= 10) {
|
x += 1;
|
||||||
user.decreaseLevel();
|
DECREASE_LIST.put(user.getUUID(), x);
|
||||||
DECREASE_LIST.put(user.getUUID(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CheckManager getCheckManager() {
|
if (x >= 10) {
|
||||||
return CHECK_MANAGER;
|
user.decreaseLevel();
|
||||||
}
|
DECREASE_LIST.put(user.getUUID(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static AntiCheatManager getManager() {
|
public static CheckManager getCheckManager() {
|
||||||
return AntiCheatReloaded.getManager();
|
return CHECK_MANAGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Backend getBackend() {
|
public static AntiCheatManager getManager() {
|
||||||
return BACKEND;
|
return AntiCheatReloaded.getManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UserManager getUserManager() {
|
public static Backend getBackend() {
|
||||||
return USER_MANAGER;
|
return BACKEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AntiCheatReloaded getPlugin() {
|
public static UserManager getUserManager() {
|
||||||
return PLUGIN;
|
return USER_MANAGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Configuration getConfig() {
|
public static AntiCheatReloaded getPlugin() {
|
||||||
return CONFIG;
|
return PLUGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean silentMode() {
|
public static Configuration getConfig() {
|
||||||
return CONFIG.getConfig().silentMode.getValue();
|
return CONFIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean silentMode() {
|
||||||
|
return CONFIG.getConfig().silentMode.getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,7 +29,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
@@ -43,19 +43,22 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
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;
|
||||||
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.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraFly;
|
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;
|
||||||
@@ -76,7 +79,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);
|
||||||
}
|
}
|
||||||
@@ -152,7 +156,7 @@ public class PlayerListener extends EventListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerVelocity(PlayerVelocityEvent event) {
|
public void onPlayerVelocity(PlayerVelocityEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (getCheckManager().willCheck(player, CheckType.FLY)) {
|
if (getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||||
if (getBackend().justVelocity(player) && getBackend().extendVelocityTime(player)) {
|
if (getBackend().justVelocity(player) && getBackend().extendVelocityTime(player)) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
return;
|
return;
|
||||||
@@ -172,10 +176,29 @@ 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);
|
||||||
log(null, player, CheckType.CHAT_SPAM);
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
log(null, player, CheckType.CHAT_SPAM);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.CHAT_UNICODE)) {
|
||||||
|
CheckResult result = getBackend().checkChatUnicode(player, event.getMessage());
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||||
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
log(null, player, CheckType.CHAT_UNICODE);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,12 +247,28 @@ 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) {
|
||||||
Material m = inv.getItemInHand().getType();
|
ItemStack itemInHand;
|
||||||
if (m == Material.BOW) {
|
if (VersionUtil.isBountifulUpdate()) {
|
||||||
|
itemInHand = VersionUtil.getItemInHand(player);
|
||||||
|
} else {
|
||||||
|
itemInHand = ((event.getHand() == EquipmentSlot.HAND) ? inv.getItemInMainHand() : inv.getItemInOffHand());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemInHand.getType() == Material.BOW) {
|
||||||
getBackend().logBowWindUp(player);
|
getBackend().logBowWindUp(player);
|
||||||
} else if (Utilities.isFood(m)) {
|
} else if (Utilities.isFood(itemInHand.getType()) || Utilities.isFood(itemInHand.getType())) {
|
||||||
getBackend().logEatingStart(player);
|
getBackend().logEatingStart(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!VersionUtil.isBountifulUpdate()) {
|
||||||
|
if (itemInHand.getType() == Material.FIREWORK_ROCKET) {
|
||||||
|
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
||||||
|
if (player.isGliding()) {
|
||||||
|
// TODO config max elytra height?
|
||||||
|
ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId(), 9999.99D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
|
|
||||||
@@ -257,7 +296,7 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
||||||
if (event.getBed().getType() != Material.BED) return;
|
if (event.getBed().getType().name().endsWith("BED")) return;
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
@@ -265,7 +304,7 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
||||||
if (event.getBed().getType() != Material.BED) return;
|
if (event.getBed().getType().name().endsWith("BED")) return;
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
@@ -279,17 +318,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());
|
||||||
@@ -297,15 +325,11 @@ public class PlayerListener extends EventListener {
|
|||||||
getConfig().getLevels().loadLevelToUser(user);
|
getConfig().getLevels().loadLevelToUser(user);
|
||||||
getUserManager().addUser(user);
|
getUserManager().addUser(user);
|
||||||
|
|
||||||
if (player.hasMetadata(Utilities.SPY_METADATA)) {
|
|
||||||
for (Player p : player.getServer().getOnlinePlayers()) {
|
|
||||||
if (!Permission.SYSTEM_SPY.get(p)) {
|
|
||||||
p.hidePlayer(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
@@ -322,35 +346,25 @@ public class PlayerListener extends EventListener {
|
|||||||
final User user = getUserManager().getUser(player.getUniqueId());
|
final User user = getUserManager().getUser(player.getUniqueId());
|
||||||
user.setTo(to.getX(), to.getY(), to.getZ());
|
user.setTo(to.getX(), to.getY(), to.getZ());
|
||||||
|
|
||||||
KillAuraCheck.doMove(event);
|
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||||
|
|
||||||
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.FLY) && !VersionUtil.isFlying(player)) {
|
|
||||||
CheckResult result = FlightCheck.runCheck(player, distance);
|
CheckResult result = FlightCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FLY);
|
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLY) && !VersionUtil.isFlying(player)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||||
CheckResult result = GlideCheck.runCheck(player, distance);
|
CheckResult result = GlideCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
// NO TELEPORT NEEDED HERE, HANDLED BY CHECK ITSELF
|
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||||
log(result.getMessage(), player, CheckType.FLY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
||||||
CheckResult result = ElytraFly.runCheck(player, distance);
|
CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.FLY);
|
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()) {
|
||||||
@@ -369,7 +383,7 @@ public class PlayerListener extends EventListener {
|
|||||||
log(result.getMessage(), player, CheckType.VCLIP);
|
log(result.getMessage(), player, CheckType.VCLIP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL) && getCheckManager().willCheck(player, CheckType.FLY) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY()) {
|
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL) && getCheckManager().willCheck(player, CheckType.FLIGHT) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkNoFall(player, y);
|
CheckResult result = getBackend().checkNoFall(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
@@ -384,7 +398,7 @@ public class PlayerListener extends EventListener {
|
|||||||
if (event.getTo() != event.getFrom()) {
|
if (event.getTo() != event.getFrom()) {
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||||
if (event.getFrom().getY() < event.getTo().getY()) {
|
if (event.getFrom().getY() < event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkYSpeed(player, y);
|
CheckResult result = getBackend().checkYSpeed(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
@@ -415,7 +429,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()));
|
||||||
@@ -439,13 +453,20 @@ public class PlayerListener extends EventListener {
|
|||||||
user.setGoodLocation(event.getFrom());
|
user.setGoodLocation(event.getFrom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.KILLAURA)) {
|
||||||
|
CheckResult result = KillAuraCheck.checkAimbot(player, event);
|
||||||
|
if (result.failed()) {
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.HIGHEST)
|
@EventHandler(priority=EventPriority.HIGHEST)
|
||||||
public void onDeath(PlayerDeathEvent e) {
|
public void onRespawn(PlayerRespawnEvent event) {
|
||||||
KillAuraCheck.cleanPlayer(e.getEntity()); // Remove bots on death to reduce lag
|
getBackend().logTeleport(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
@@ -461,15 +482,15 @@ public class PlayerListener extends EventListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.FLY) && !player.isFlying()) {
|
if (getCheckManager().willCheck(player, CheckType.FLIGHT) && !player.isFlying()) {
|
||||||
CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to));
|
CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to));
|
||||||
CheckResult result2 = getBackend().checkAscension(player, from.getY(), to.getY());
|
CheckResult result2 = FlightCheck.checkAscension(player, from.getY(), to.getY());
|
||||||
String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : "";
|
String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : "";
|
||||||
if (!log.equals("")) {
|
if (!log.equals("")) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(log, player, CheckType.FLY);
|
log(log, player, CheckType.FLIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||||
@@ -25,34 +27,48 @@ import org.bukkit.event.vehicle.VehicleEnterEvent;
|
|||||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
public class VehicleListener extends EventListener {
|
public class VehicleListener extends EventListener {
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onVehicleEnter(VehicleEnterEvent event) {
|
public void onVehicleEnter(VehicleEnterEvent event) {
|
||||||
if (event.getEntered() instanceof Player) {
|
if (event.getEntered() instanceof Player) {
|
||||||
getBackend().logEnterExit((Player) event.getEntered());
|
getBackend().logEnterExit((Player) event.getEntered());
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onVehicleExit(VehicleExitEvent event) {
|
public void onVehicleExit(VehicleExitEvent event) {
|
||||||
if (event.getExited() instanceof Player) {
|
if (event.getExited() instanceof Player) {
|
||||||
getBackend().logEnterExit((Player) event.getExited());
|
getBackend().logEnterExit((Player) event.getExited());
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||||
|
if (VersionUtil.isBountifulUpdate()) {
|
||||||
|
if (event.getVehicle().getPassenger() != null) {
|
||||||
|
Entity entity = event.getVehicle().getPassenger();
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
getBackend().logEnterExit((Player) entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!event.getVehicle().getPassengers().isEmpty()) {
|
||||||
|
for (Entity entity : event.getVehicle().getPassengers()) {
|
||||||
|
if (entity instanceof Player) {
|
||||||
|
getBackend().logEnterExit((Player) entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
}
|
||||||
if (event.getVehicle().getPassenger() != null && event.getVehicle().getPassenger() instanceof Player) {
|
|
||||||
getBackend().logEnterExit((Player) event.getVehicle().getPassenger());
|
|
||||||
}
|
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -10,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;
|
||||||
@@ -32,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;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -18,19 +19,19 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.manage;
|
package com.rammelkast.anticheatreloaded.manage;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p/>
|
* <p/>
|
||||||
* The manager that AntiCheat will check with to see if it should watch certain checks and certain players.
|
* The manager that AntiCheat will check with to see if it should watch certain checks and certain players.
|
||||||
@@ -175,9 +176,7 @@ public class CheckManager {
|
|||||||
&& !isExempt(player, type)
|
&& !isExempt(player, type)
|
||||||
&& !type.checkPermission(player)
|
&& !type.checkPermission(player)
|
||||||
&& !isOpExempt(player);
|
&& !isOpExempt(player);
|
||||||
AntiCheatReloaded.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionUtil.isFlying(player))
|
||||||
// TODO temp fix
|
|
||||||
if ((type == CheckType.FLY || type == CheckType.SPEED) && player.isFlying())
|
|
||||||
return false;
|
return false;
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -43,7 +44,7 @@ public class LoggingManager {
|
|||||||
private final Configuration config;
|
private final Configuration config;
|
||||||
|
|
||||||
public LoggingManager(AntiCheatReloaded plugin, Logger logger, Configuration config) {
|
public LoggingManager(AntiCheatReloaded plugin, Logger logger, Configuration config) {
|
||||||
this.fileLogger = Logger.getLogger("net.gravitydevelopment.anticheat.AntiCheat");
|
this.fileLogger = Logger.getLogger("com.rammelkast.anticheatreloaded.AntiCheatReloaded");
|
||||||
this.config = config;
|
this.config = config;
|
||||||
try {
|
try {
|
||||||
File file = new File(plugin.getDataFolder(), "log");
|
File file = new File(plugin.getDataFolder(), "log");
|
||||||
@@ -70,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) {
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.manage;
|
|
||||||
|
|
||||||
import com.comphenix.protocol.Packets;
|
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
|
||||||
import com.comphenix.protocol.events.*;
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
|
|
||||||
public class PacketManager {
|
|
||||||
|
|
||||||
private ProtocolManager protocolManager;
|
|
||||||
private AntiCheatReloaded plugin;
|
|
||||||
private AntiCheatManager manager;
|
|
||||||
|
|
||||||
public PacketManager(ProtocolManager protocolManager, AntiCheatReloaded plugin, AntiCheatManager manager) {
|
|
||||||
this.protocolManager = protocolManager;
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.manager = manager;
|
|
||||||
addListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addListeners() {
|
|
||||||
// Arm Animation
|
|
||||||
protocolManager.addPacketListener(new PacketAdapter(plugin,
|
|
||||||
ConnectionSide.CLIENT_SIDE,
|
|
||||||
ListenerPriority.NORMAL,
|
|
||||||
Packets.Client.ARM_ANIMATION) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
|
||||||
if (event.getPacketID() == Packets.Client.ARM_ANIMATION) {
|
|
||||||
PacketContainer packet = event.getPacket();
|
|
||||||
//System.out.println("Arm animation from "+packet.getIntegers().read(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,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
|
||||||
*
|
*
|
||||||
@@ -161,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
|
||||||
*
|
*
|
||||||
@@ -178,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,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);
|
||||||
@@ -243,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);
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,205 +22,65 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public enum BlockHardness {
|
public enum BlockHardness {
|
||||||
STONE(1.50D),
|
STONE(1.50D), GRASS(0.60D), DIRT(0.50D), COBBLESTONE(2.00D), WOOD(2.00D), SAPLING(0.00D), WATER(100.00D),
|
||||||
GRASS(0.60D),
|
STATIONARY_WATER(100.00D), LAVA(0.00D), STATIONARY_LAVA(100.00D), SAND(0.50D), GRAVEL(0.60D), GOLD_ORE(3.00D),
|
||||||
DIRT(0.50D),
|
IRON_ORE(3.00D), COAL_ORE(3.00D), LOG(2.00D), LOG_2(2.00D), LEAVES(0.20D), LEAVES_2(0.20D), SPONGE(0.60D),
|
||||||
COBBLESTONE(2.00D),
|
GLASS(0.30D), LAPIS_ORE(3.00D), LAPIS_BLOCK(3.00D), DISPENSER(3.50D), DROPPER(3.50D), SANDSTONE(0.80D),
|
||||||
WOOD(2.00D),
|
NOTE_BLOCK(0.80D), BED(0.20D), RAILS(0.70D), DETECTOR_RAIL(0.70D), POWERED_RAIL(0.70D), ACTIVATOR_RAIL(0.70D),
|
||||||
SAPLING(0.00D),
|
WEB(4.00D), LONG_GRASS(0.00D), DOUBLE_PLANT(0.00D), DEAD_BUSH(0.00D), WOOL(0.80D), YELLOW_FLOWER(0.00D),
|
||||||
WATER(100.00D),
|
RED_ROSE(0.00D), BROWN_MUSHROOM(0.00D), RED_MUSHROOM(0.00D), GOLD_BLOCK(3.00D), IRON_BLOCK(5.00D),
|
||||||
STATIONARY_WATER(100.00D),
|
DOUBLE_STEP(2.00D), STEP(2.00D), BRICK(2.00D), TNT(0.00D), BOOKSHELF(1.50D), MOSSY_COBBLESTONE(2.00D),
|
||||||
LAVA(0.00D),
|
OBSIDIAN(50.00D), TORCH(0.00D), FIRE(0.00D), MOB_SPAWNER(5.00D), CHEST(2.50D), TRAPPED_CHEST(2.50D),
|
||||||
STATIONARY_LAVA(100.00D),
|
REDSTONE_WIRE(0.00D), DIAMOND_ORE(3.00D), DIAMOND_BLOCK(5.00D), WORKBENCH(2.50D), SOIL(0.60D), FURNACE(3.50D),
|
||||||
SAND(0.50D),
|
BURNING_FURNACE(3.50D), WOODEN_DOOR(3.00D), LADDER(0.40D), LEVER(0.50D), IRON_DOOR_BLOCK(5.00D), HOPPER(2.00D),
|
||||||
GRAVEL(0.60D),
|
STONE_PLATE(0.50D), WOOD_PLATE(0.50D), GOLD_PLATE(0.50D), IRON_PLATE(0.50D), QUARTZ_BLOCK(0.80D), QUARTZ_ORE(3.00D),
|
||||||
GOLD_ORE(3.00D),
|
REDSTONE_BLOCK(5.00D), REDSTONE_ORE(3.00D), GLOWING_REDSTONE_ORE(3.00D), REDSTONE_TORCH_OFF(0.00D),
|
||||||
IRON_ORE(3.00D),
|
REDSTONE_TORCH_ON(0.00D), REDSTONE_COMPARATOR_OFF(0.00D), REDSTONE_COMPARATOR_ON(0.00D), DAYLIGHT_DETECTOR(0.20D),
|
||||||
COAL_ORE(3.00D),
|
STONE_BUTTON(0.50D), SNOW(0.10D), ICE(0.50D), PACKED_ICE(0.50D), SNOW_BLOCK(0.20D), CACTUS(0.40D), CLAY(0.60D),
|
||||||
LOG(2.00D),
|
HARD_CLAY(1.25D), STAINED_CLAY(1.25D), SUGAR_CANE_BLOCK(0.00D), JUKEBOX(2.00D), FENCE(2.00D), NETHERRACK(0.40D),
|
||||||
LOG_2(2.00D),
|
SOUL_SAND(0.50D), GLOWSTONE(0.30D), PORTAL(-1.00D), CAKE_BLOCK(0.50D), LOCKED_CHEST(0.00D), TRAP_DOOR(3.00D),
|
||||||
LEAVES(0.20D),
|
MONSTER_EGGS(0.750D), SMOOTH_BRICK(1.50D), IRON_FENCE(5.00D), THIN_GLASS(0.30D), STAINED_GLASS(0.30D),
|
||||||
LEAVES_2(0.20D),
|
STAINED_GLASS_PANE(0.30D), PUMPKIN_STEM(0.00D), MELON_STEM(0.00D), VINE(0.20D), FENCE_GATE(2.00D), MYCEL(0.60D),
|
||||||
SPONGE(0.60D),
|
WATER_LILY(0.00D), NETHER_BRICK(2.00D), NETHER_FENCE(2.00D), ENCHANTMENT_TABLE(5.00D), BREWING_STAND(0.50D),
|
||||||
GLASS(0.30D),
|
CAULDRON(2.00D), ENDER_PORTAL(-1.00D), ENDER_PORTAL_FRAME(-1.00D), DRAGON_EGG(3.00D), REDSTONE_LAMP_OFF(0.30D),
|
||||||
LAPIS_ORE(3.00D),
|
REDSTONE_LAMP_ON(0.30D), WOOD_DOUBLE_STEP(2.00D), WOOD_STEP(2.00D), COCOA(0.20D), EMERALD_ORE(3.00D),
|
||||||
LAPIS_BLOCK(3.00D),
|
ENDER_CHEST(22.50D), EMERALD_BLOCK(5.00D), FLOWER_POT(0.00D), WOOD_BUTTON(0.50D), ANVIL(5.00D),
|
||||||
DISPENSER(3.50D),
|
HUGE_MUSHROOM_1(0.20D), HUGE_MUSHROOM_2(0.20D), BED_BLOCK(0.20D), WOOD_STAIRS(2.00D), COBBLESTONE_STAIRS(2.00D),
|
||||||
DROPPER(3.50D),
|
BRICK_STAIRS(2.00D), SMOOTH_STAIRS(1.50D), NETHER_BRICK_STAIRS(2.00D), SPRUCE_WOOD_STAIRS(2.00D),
|
||||||
SANDSTONE(0.80D),
|
BIRCH_WOOD_STAIRS(2.00D), JUNGLE_WOOD_STAIRS(2.00D), DARK_OAK_STAIRS(2.00D), ACACIA_STAIRS(2.00D),
|
||||||
NOTE_BLOCK(0.80D),
|
QUARTZ_STAIRS(0.80D), SANDSTONE_STAIRS(0.80D), COMMAND(0.00D), BEACON(3.00D), COBBLE_WALL(2.00D), CROPS(0.00D),
|
||||||
BED(0.20D),
|
CARROT(0.00D), POTATO(0.00D), SKULL(1.00D), NETHER_WARTS(0.00D), SIGN_POST(1.00D), WALL_SIGN(1.00D), PUMPKIN(1.00D),
|
||||||
RAILS(0.70D),
|
JACK_O_LANTERN(1.00D), DIODE_BLOCK_ON(0.00D), DIODE_BLOCK_OFF(0.00D), MELON_BLOCK(1.00D), ENDER_STONE(3.00D),
|
||||||
DETECTOR_RAIL(0.70D),
|
TRIPWIRE(0.00D), TRIPWIRE_HOOK(0.00D), HAY_BLOCK(0.50D), CARPET(0.10D), COAL_BLOCK(5.00D), PISTON_BASE(0.70D),
|
||||||
POWERED_RAIL(0.70D),
|
PISTON_EXTENSION(0.70D), PISTON_MOVING_PIECE(0.70D), PISTON_STICKY_BASE(0.70D);
|
||||||
ACTIVATOR_RAIL(0.70D),
|
|
||||||
WEB(4.00D),
|
|
||||||
LONG_GRASS(0.00D),
|
|
||||||
DOUBLE_PLANT(0.00D),
|
|
||||||
DEAD_BUSH(0.00D),
|
|
||||||
WOOL(0.80D),
|
|
||||||
YELLOW_FLOWER(0.00D),
|
|
||||||
RED_ROSE(0.00D),
|
|
||||||
BROWN_MUSHROOM(0.00D),
|
|
||||||
RED_MUSHROOM(0.00D),
|
|
||||||
GOLD_BLOCK(3.00D),
|
|
||||||
IRON_BLOCK(5.00D),
|
|
||||||
DOUBLE_STEP(2.00D),
|
|
||||||
STEP(2.00D),
|
|
||||||
BRICK(2.00D),
|
|
||||||
TNT(0.00D),
|
|
||||||
BOOKSHELF(1.50D),
|
|
||||||
MOSSY_COBBLESTONE(2.00D),
|
|
||||||
OBSIDIAN(50.00D),
|
|
||||||
TORCH(0.00D),
|
|
||||||
FIRE(0.00D),
|
|
||||||
MOB_SPAWNER(5.00D),
|
|
||||||
CHEST(2.50D),
|
|
||||||
TRAPPED_CHEST(2.50D),
|
|
||||||
REDSTONE_WIRE(0.00D),
|
|
||||||
DIAMOND_ORE(3.00D),
|
|
||||||
DIAMOND_BLOCK(5.00D),
|
|
||||||
WORKBENCH(2.50D),
|
|
||||||
SOIL(0.60D),
|
|
||||||
FURNACE(3.50D),
|
|
||||||
BURNING_FURNACE(3.50D),
|
|
||||||
WOODEN_DOOR(3.00D),
|
|
||||||
LADDER(0.40D),
|
|
||||||
LEVER(0.50D),
|
|
||||||
IRON_DOOR_BLOCK(5.00D),
|
|
||||||
HOPPER(2.00D),
|
|
||||||
STONE_PLATE(0.50D),
|
|
||||||
WOOD_PLATE(0.50D),
|
|
||||||
GOLD_PLATE(0.50D),
|
|
||||||
IRON_PLATE(0.50D),
|
|
||||||
QUARTZ_BLOCK(0.80D),
|
|
||||||
QUARTZ_ORE(3.00D),
|
|
||||||
REDSTONE_BLOCK(5.00D),
|
|
||||||
REDSTONE_ORE(3.00D),
|
|
||||||
GLOWING_REDSTONE_ORE(3.00D),
|
|
||||||
REDSTONE_TORCH_OFF(0.00D),
|
|
||||||
REDSTONE_TORCH_ON(0.00D),
|
|
||||||
REDSTONE_COMPARATOR_OFF(0.00D),
|
|
||||||
REDSTONE_COMPARATOR_ON(0.00D),
|
|
||||||
DAYLIGHT_DETECTOR(0.20D),
|
|
||||||
STONE_BUTTON(0.50D),
|
|
||||||
SNOW(0.10D),
|
|
||||||
ICE(0.50D),
|
|
||||||
PACKED_ICE(0.50D),
|
|
||||||
SNOW_BLOCK(0.20D),
|
|
||||||
CACTUS(0.40D),
|
|
||||||
CLAY(0.60D),
|
|
||||||
HARD_CLAY(1.25D),
|
|
||||||
STAINED_CLAY(1.25D),
|
|
||||||
SUGAR_CANE_BLOCK(0.00D),
|
|
||||||
JUKEBOX(2.00D),
|
|
||||||
FENCE(2.00D),
|
|
||||||
NETHERRACK(0.40D),
|
|
||||||
SOUL_SAND(0.50D),
|
|
||||||
GLOWSTONE(0.30D),
|
|
||||||
PORTAL(-1.00D),
|
|
||||||
CAKE_BLOCK(0.50D),
|
|
||||||
LOCKED_CHEST(0.00D),
|
|
||||||
TRAP_DOOR(3.00D),
|
|
||||||
MONSTER_EGGS(0.750D),
|
|
||||||
SMOOTH_BRICK(1.50D),
|
|
||||||
IRON_FENCE(5.00D),
|
|
||||||
THIN_GLASS(0.30D),
|
|
||||||
STAINED_GLASS(0.30D),
|
|
||||||
STAINED_GLASS_PANE(0.30D),
|
|
||||||
PUMPKIN_STEM(0.00D),
|
|
||||||
MELON_STEM(0.00D),
|
|
||||||
VINE(0.20D),
|
|
||||||
FENCE_GATE(2.00D),
|
|
||||||
MYCEL(0.60D),
|
|
||||||
WATER_LILY(0.00D),
|
|
||||||
NETHER_BRICK(2.00D),
|
|
||||||
NETHER_FENCE(2.00D),
|
|
||||||
ENCHANTMENT_TABLE(5.00D),
|
|
||||||
BREWING_STAND(0.50D),
|
|
||||||
CAULDRON(2.00D),
|
|
||||||
ENDER_PORTAL(-1.00D),
|
|
||||||
ENDER_PORTAL_FRAME(-1.00D),
|
|
||||||
DRAGON_EGG(3.00D),
|
|
||||||
REDSTONE_LAMP_OFF(0.30D),
|
|
||||||
REDSTONE_LAMP_ON(0.30D),
|
|
||||||
WOOD_DOUBLE_STEP(2.00D),
|
|
||||||
WOOD_STEP(2.00D),
|
|
||||||
COCOA(0.20D),
|
|
||||||
EMERALD_ORE(3.00D),
|
|
||||||
ENDER_CHEST(22.50D),
|
|
||||||
EMERALD_BLOCK(5.00D),
|
|
||||||
FLOWER_POT(0.00D),
|
|
||||||
WOOD_BUTTON(0.50D),
|
|
||||||
ANVIL(5.00D),
|
|
||||||
HUGE_MUSHROOM_1(0.20D),
|
|
||||||
HUGE_MUSHROOM_2(0.20D),
|
|
||||||
BED_BLOCK(0.20D),
|
|
||||||
WOOD_STAIRS(2.00D),
|
|
||||||
COBBLESTONE_STAIRS(2.00D),
|
|
||||||
BRICK_STAIRS(2.00D),
|
|
||||||
SMOOTH_STAIRS(1.50D),
|
|
||||||
NETHER_BRICK_STAIRS(2.00D),
|
|
||||||
SPRUCE_WOOD_STAIRS(2.00D),
|
|
||||||
BIRCH_WOOD_STAIRS(2.00D),
|
|
||||||
JUNGLE_WOOD_STAIRS(2.00D),
|
|
||||||
DARK_OAK_STAIRS(2.00D),
|
|
||||||
ACACIA_STAIRS(2.00D),
|
|
||||||
QUARTZ_STAIRS(0.80D),
|
|
||||||
SANDSTONE_STAIRS(0.80D),
|
|
||||||
COMMAND(0.00D),
|
|
||||||
BEACON(3.00D),
|
|
||||||
COBBLE_WALL(2.00D),
|
|
||||||
CROPS(0.00D),
|
|
||||||
CARROT(0.00D),
|
|
||||||
POTATO(0.00D),
|
|
||||||
SKULL(1.00D),
|
|
||||||
NETHER_WARTS(0.00D),
|
|
||||||
SIGN_POST(1.00D),
|
|
||||||
WALL_SIGN(1.00D),
|
|
||||||
PUMPKIN(1.00D),
|
|
||||||
JACK_O_LANTERN(1.00D),
|
|
||||||
DIODE_BLOCK_ON(0.00D),
|
|
||||||
DIODE_BLOCK_OFF(0.00D),
|
|
||||||
MELON_BLOCK(1.00D),
|
|
||||||
ENDER_STONE(3.00D),
|
|
||||||
TRIPWIRE(0.00D),
|
|
||||||
TRIPWIRE_HOOK(0.00D),
|
|
||||||
HAY_BLOCK(0.50D),
|
|
||||||
CARPET(0.10D),
|
|
||||||
COAL_BLOCK(5.00D),
|
|
||||||
PISTON_BASE(0.70D),
|
|
||||||
PISTON_EXTENSION(0.70D),
|
|
||||||
PISTON_MOVING_PIECE(0.70D),
|
|
||||||
PISTON_STICKY_BASE(0.70D);
|
|
||||||
|
|
||||||
Material mat;
|
Material mat;
|
||||||
double hardness;
|
double hardness;
|
||||||
|
|
||||||
BlockHardness(double hard) {
|
BlockHardness(double hard) {
|
||||||
mat = Material.getMaterial(name());
|
mat = Material.getMaterial(name());
|
||||||
hardness = hard;
|
hardness = hard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getBlockHardness(Material m) {
|
public static double getBlockHardness(Material m) {
|
||||||
try {
|
try {
|
||||||
BlockHardness h = getHardness(m);
|
BlockHardness h = getHardness(m);
|
||||||
return h == null ? 0D : h.hardness;
|
return h == null ? 0D : h.hardness;
|
||||||
}catch(Exception e) {
|
} catch (Exception e) {
|
||||||
return 0D;
|
return 0D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasBlockHardness(Material m) {
|
public static boolean hasBlockHardness(Material m) {
|
||||||
return getHardness(m) != null;
|
return getHardness(m) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockHardness getHardness(Material m) {
|
public static BlockHardness getHardness(Material m) {
|
||||||
for (BlockHardness e : BlockHardness.values()) {
|
for (BlockHardness e : BlockHardness.values()) {
|
||||||
if (e.mat.equals(m)) {
|
if (e.mat.equals(m)) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,39 +22,53 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class Distance {
|
public class Distance {
|
||||||
private final double l1Y;
|
private final double l1Y;
|
||||||
private final double l2Y;
|
private final double l2Y;
|
||||||
|
|
||||||
private final double XDiff;
|
private final double XDiff;
|
||||||
private final double YDiff;
|
private final double YDiff;
|
||||||
private final double ZDiff;
|
private final double ZDiff;
|
||||||
|
|
||||||
public Distance(Location from, Location to) {
|
private final Location from;
|
||||||
l1Y = to.getY();
|
private final Location to;
|
||||||
l2Y = from.getY();
|
|
||||||
|
|
||||||
XDiff = Math.abs(to.getX() - from.getX());
|
public Distance(Location from, Location to) {
|
||||||
ZDiff = Math.abs(to.getZ() - from.getZ());
|
l1Y = to.getY();
|
||||||
YDiff = Math.abs(l1Y - l2Y);
|
l2Y = from.getY();
|
||||||
}
|
|
||||||
|
|
||||||
public double fromY() {
|
XDiff = Math.abs(to.getX() - from.getX());
|
||||||
return l2Y;
|
ZDiff = Math.abs(to.getZ() - from.getZ());
|
||||||
}
|
YDiff = Math.abs(l1Y - l2Y);
|
||||||
|
|
||||||
public double toY() {
|
this.from = from;
|
||||||
return l1Y;
|
this.to = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getXDifference() {
|
public double fromY() {
|
||||||
return XDiff;
|
return l2Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getZDifference() {
|
public double toY() {
|
||||||
return ZDiff;
|
return l1Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getYDifference() {
|
public double getXDifference() {
|
||||||
return YDiff;
|
return XDiff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getZDifference() {
|
||||||
|
return ZDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getYDifference() {
|
||||||
|
return YDiff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getFrom() {
|
||||||
|
return this.from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Location getTo() {
|
||||||
|
return this.to;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,12 +26,14 @@ import java.util.logging.Formatter;
|
|||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
|
|
||||||
public class FileFormatter extends Formatter {
|
public class FileFormatter extends Formatter {
|
||||||
private static final DateFormat FORMAT = new SimpleDateFormat("h:mm:ss");
|
private static final DateFormat FORMAT = new SimpleDateFormat("h:mm:ss");
|
||||||
private static final String LINE_SEP = System.getProperty("line.separator");
|
private static final String LINE_SEP = System.getProperty("line.separator");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String format(LogRecord record) {
|
public String format(LogRecord record) {
|
||||||
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(FORMAT.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(LINE_SEP);
|
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|')
|
||||||
return output.toString();
|
.append(FORMAT.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage())
|
||||||
}
|
.append(' ').append(LINE_SEP);
|
||||||
|
return output.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -28,62 +29,67 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Group {
|
public class Group {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int level;
|
private int level;
|
||||||
private ChatColor color = ChatColor.RED;
|
private ChatColor color = ChatColor.RED;
|
||||||
private List<String> actions = new ArrayList<String>();
|
private List<String> actions = new ArrayList<String>();
|
||||||
|
|
||||||
public Group(String name, int level, String color, List<String> actions) {
|
public Group(String name, int level, String color, List<String> actions) {
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
|
|
||||||
ChatColor c = ChatColor.valueOf(color);
|
ChatColor c = ChatColor.valueOf(color);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("Event '" + name + "' was initialized with the color '" + color + "' which is invalid.");
|
AntiCheatReloaded.getPlugin().getLogger()
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("This event will not run properly. See http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html#enum_constant_summary for a list of valid colors");
|
.warning("Event '" + name + "' was initialized with the color '" + color + "' which is invalid.");
|
||||||
} else {
|
AntiCheatReloaded.getPlugin().getLogger().warning(
|
||||||
this.color = c;
|
"This event will not run properly. See http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html#enum_constant_summary for a list of valid colors");
|
||||||
}
|
} else {
|
||||||
}
|
this.color = c;
|
||||||
public String getName() {
|
}
|
||||||
return name;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public int getLevel() {
|
public String getName() {
|
||||||
return level;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getColor() {
|
public int getLevel() {
|
||||||
return color;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getActions() {
|
public ChatColor getColor() {
|
||||||
return actions;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Group load(String string) {
|
public List<String> getActions() {
|
||||||
try {
|
return actions;
|
||||||
if (string.split(" : ").length == 4) {
|
}
|
||||||
String name = string.split(" : ")[0];
|
|
||||||
int level = Integer.parseInt(string.split(" : ")[1]);
|
|
||||||
String color = string.split(" : ")[2];
|
|
||||||
List<String> actions = Arrays.asList(string.split(" : ")[3].split(","));
|
|
||||||
return new Group(name, level, color, actions);
|
|
||||||
} else {
|
|
||||||
throw new Exception();
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("An event was initialized with an invalid string: '" + string + "'");
|
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("The proper format is: 'name : threshold : color : action' such as 'High : 50 : RED : KICK'");
|
|
||||||
AntiCheatReloaded.getPlugin().getLogger().warning("This event will NOT run. (" + ex.getMessage() + ")");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public static Group load(String string) {
|
||||||
public String toString() {
|
try {
|
||||||
return name + " : " + level + " : " + color.name() + " : " + Utilities.listToCommaString(actions);
|
if (string.split(" : ").length == 4) {
|
||||||
}
|
String name = string.split(" : ")[0];
|
||||||
|
int level = Integer.parseInt(string.split(" : ")[1]);
|
||||||
|
String color = string.split(" : ")[2];
|
||||||
|
List<String> actions = Arrays.asList(string.split(" : ")[3].split(","));
|
||||||
|
return new Group(name, level, color, actions);
|
||||||
|
} else {
|
||||||
|
throw new Exception();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger()
|
||||||
|
.warning("An event was initialized with an invalid string: '" + string + "'");
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning(
|
||||||
|
"The proper format is: 'name : threshold : color : action' such as 'High : 50 : RED : KICK'");
|
||||||
|
AntiCheatReloaded.getPlugin().getLogger().warning("This event will NOT run. (" + ex.getMessage() + ")");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name + " : " + level + " : " + color.name() + " : " + Utilities.listToCommaString(actions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
public class NMS_1_9_PLUS {
|
|
||||||
|
|
||||||
static final EnumSet<Material> MOVE_UP_BLOCKS_1_9 = EnumSet.of(Material.ACACIA_STAIRS,
|
|
||||||
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
|
|
||||||
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
|
|
||||||
Material.RED_SANDSTONE_STAIRS, Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS,
|
|
||||||
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS, Material.PURPUR_STAIRS);
|
|
||||||
|
|
||||||
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
|
||||||
|
|
||||||
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,204 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
|
||||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
|
||||||
import net.minecraft.server.v1_12_R1.EnumItemSlot;
|
|
||||||
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
|
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
|
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn;
|
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
|
|
||||||
import net.minecraft.server.v1_12_R1.PlayerConnection;
|
|
||||||
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
|
||||||
import net.minecraft.server.v1_12_R1.World;
|
|
||||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
|
||||||
|
|
||||||
public class NPC_1_12 {
|
|
||||||
|
|
||||||
private final UUID owner;
|
|
||||||
private final String name;
|
|
||||||
private UUID uuid;
|
|
||||||
private EntityPlayer npc;
|
|
||||||
private int entityId;
|
|
||||||
private Location location;
|
|
||||||
|
|
||||||
public int getID() {
|
|
||||||
return this.entityId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NPC_1_12(Player owner) {
|
|
||||||
this.owner = owner.getUniqueId();
|
|
||||||
this.name = NameGenerator.generateName();
|
|
||||||
Location eyelocation = owner.getEyeLocation();
|
|
||||||
Vector vec = owner.getLocation().getDirection();
|
|
||||||
vec.setX(-3 * vec.getX());
|
|
||||||
vec.setZ(-3 * vec.getZ());
|
|
||||||
Location back = eyelocation.add(vec);
|
|
||||||
this.location = back; // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
public void spawn() {
|
|
||||||
final MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
|
|
||||||
final WorldServer nmsWorld = ((CraftWorld) this.getOwner().getWorld()).getHandle();
|
|
||||||
this.uuid = UUID.randomUUID();
|
|
||||||
(this.npc = new EntityPlayer(nmsServer, nmsWorld, new GameProfile(this.uuid, this.name),
|
|
||||||
new PlayerInteractManager((World) nmsWorld))).setLocation(this.location.getX(), this.location.getY(),
|
|
||||||
this.location.getZ(), 0.0f, 0.0f);
|
|
||||||
this.npc.collides = false;
|
|
||||||
this.npc.setInvisible(true);
|
|
||||||
this.npc.setEquipment(EnumItemSlot.CHEST, AntiCheatReloaded.getRandom().nextBoolean() ? CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_CHESTPLATE)) : CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_CHESTPLATE)));
|
|
||||||
this.npc.setEquipment(EnumItemSlot.FEET, AntiCheatReloaded.getRandom().nextBoolean() ? CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_BOOTS)) : CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_BOOTS)));
|
|
||||||
this.entityId = this.npc.getId();
|
|
||||||
final PlayerConnection connection = ((CraftPlayer) this.getOwner()).getHandle().playerConnection;
|
|
||||||
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
|
|
||||||
new EntityPlayer[] { this.npc }));
|
|
||||||
connection.sendPacket(new PacketPlayOutNamedEntitySpawn((EntityHuman) this.npc));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean up = true;
|
|
||||||
|
|
||||||
public void move(PlayerMoveEvent e) {
|
|
||||||
if (e.getTo().getPitch() <= -32.5) {
|
|
||||||
if (e.getTo().getPitch() <= -82.5) {
|
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
|
||||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
|
||||||
vec.setX(-3 * vec.getX());
|
|
||||||
vec.setY(e.getPlayer().getLocation().getY() - 8.25);
|
|
||||||
vec.setZ(-3 * vec.getZ());
|
|
||||||
Location back = eyelocation.add(vec);
|
|
||||||
this.location = back; // TODO
|
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
|
||||||
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
|
|
||||||
this.npc.setInvisible(false);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
npc.setInvisible(true);
|
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
}
|
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
|
||||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
|
||||||
vec.setX(-3 * vec.getX());
|
|
||||||
vec.setY(e.getPlayer().getLocation().getY());
|
|
||||||
vec.setZ(-3 * vec.getZ());
|
|
||||||
Location back = eyelocation.add(vec);
|
|
||||||
this.location = back; // TODO
|
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
|
||||||
}
|
|
||||||
} else if (e.getTo().getPitch() >= 22) {
|
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
|
||||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
|
||||||
vec.setX(-3 * vec.getX());
|
|
||||||
vec.setY(e.getPlayer().getLocation().getY() - 0.4);
|
|
||||||
vec.setZ(-3 * vec.getZ());
|
|
||||||
Location back = eyelocation.add(vec);
|
|
||||||
this.location = back; // TODO
|
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
|
||||||
} else {
|
|
||||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
|
||||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
|
||||||
vec.setX(-1.95 * vec.getX());
|
|
||||||
if (up)
|
|
||||||
vec.setY(vec.getY() + 0.5);
|
|
||||||
else
|
|
||||||
vec.setY(vec.getY() - 0.25);
|
|
||||||
if (new Random().nextInt(10) == 5)
|
|
||||||
up = !up;
|
|
||||||
vec.setZ(-1.95 * vec.getZ());
|
|
||||||
Location back = eyelocation.add(vec);
|
|
||||||
this.location = back; // TODO
|
|
||||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
|
||||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
|
||||||
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
|
|
||||||
this.npc.setInvisible(false);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
npc.setInvisible(true);
|
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
}
|
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getOwner() {
|
|
||||||
return Bukkit.getPlayer(owner);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void damage(EntityDamageByEntityEvent e, Player p) {
|
|
||||||
if (p != getOwner() || this.npc == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
|
||||||
this.npc.setInvisible(false);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
npc.setInvisible(true);
|
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
}
|
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(7));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void damage() {
|
|
||||||
if (this.npc == null || this.getOwner() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
|
||||||
this.npc.setInvisible(false);
|
|
||||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
npc.setInvisible(true);
|
|
||||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
|
||||||
}
|
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(8));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -6,31 +25,11 @@ import java.util.Random;
|
|||||||
|
|
||||||
public class NameGenerator {
|
public class NameGenerator {
|
||||||
|
|
||||||
private static final List<String> BEGIN = Arrays.asList(new String[]{
|
private static final List<String> BEGIN = Arrays.asList(new String[] { "Pixel", "Pro", "NoHax", "Just", "That",
|
||||||
"Pixel",
|
"New", "Ultra", "Killer", "Swift", "Anarchy", "Yolo", "Rammel" });
|
||||||
"Pro",
|
|
||||||
"NoHax",
|
|
||||||
"Just",
|
|
||||||
"That",
|
|
||||||
"New",
|
|
||||||
"Ultra",
|
|
||||||
"Killer",
|
|
||||||
"Swift",
|
|
||||||
"Yolo",
|
|
||||||
"Rammel"
|
|
||||||
});
|
|
||||||
|
|
||||||
private static final List<String> END = Arrays.asList(new String[]{
|
private static final List<String> END = Arrays.asList(new String[] { "Gamer", "PvP", "JustYolo", "Gaming",
|
||||||
"Gamer",
|
"Minecraft", "Games", "Bawz", "Tech", "Noob", "Extra", "kast", "" + new Random().nextInt(100) });
|
||||||
"PvP",
|
|
||||||
"JustYolo",
|
|
||||||
"Gaming",
|
|
||||||
"Minecraft",
|
|
||||||
"Games",
|
|
||||||
"Bawz",
|
|
||||||
"kast",
|
|
||||||
"" + new Random().nextInt(100)
|
|
||||||
});
|
|
||||||
|
|
||||||
public static String generateName() {
|
public static String generateName() {
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
package com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class NameUtil {
|
|
||||||
|
|
||||||
private static String[] firstParts = new String[] {
|
|
||||||
"Gamer",
|
|
||||||
"Pixel",
|
|
||||||
"Derp",
|
|
||||||
"Random",
|
|
||||||
"That",
|
|
||||||
"NoHaxJust",
|
|
||||||
"Derp",
|
|
||||||
"Fun",
|
|
||||||
"Luigi"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static String[] secondParts = new String[] {
|
|
||||||
"01",
|
|
||||||
"Boy",
|
|
||||||
"Guy",
|
|
||||||
"Mario",
|
|
||||||
"Plain",
|
|
||||||
"Simple",
|
|
||||||
"NotHacking",
|
|
||||||
"Random",
|
|
||||||
"11",
|
|
||||||
"06"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static Random theRandom = new Random();
|
|
||||||
|
|
||||||
public static String getRandomName() {
|
|
||||||
return firstParts[theRandom.nextInt(firstParts.length - 1)] + secondParts[theRandom.nextInt(secondParts.length - 1)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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 org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||||
|
|
||||||
|
public class PacketListener {
|
||||||
|
|
||||||
|
public static void listenMovementPackets() {
|
||||||
|
AntiCheatReloaded.getProtocolManager()
|
||||||
|
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||||
|
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK }) {
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
// Run MorePackets check
|
||||||
|
MorePacketsCheck.runCheck(player, event);
|
||||||
|
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
// Run BadPackets check
|
||||||
|
BadPacketsCheck.runCheck(player, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void listenKeepAlivePackets() {
|
||||||
|
AntiCheatReloaded.getProtocolManager()
|
||||||
|
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||||
|
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(event.getPlayer().getUniqueId());
|
||||||
|
user.onServerPing();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(event.getPlayer().getUniqueId());
|
||||||
|
user.onClientPong();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,228 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheat for Bukkit.
|
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
|
||||||
*
|
|
||||||
* 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 org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PastebinReport {
|
|
||||||
private static final String DATE = new SimpleDateFormat("yyyy-MM-dd kk:mm Z").format(new Date());
|
|
||||||
private static final String API_KEY = "d5ac92da966edb97a97860e6a052784f";
|
|
||||||
|
|
||||||
private StringBuilder report = new StringBuilder();
|
|
||||||
private String url = "";
|
|
||||||
|
|
||||||
public PastebinReport(CommandSender cs) {
|
|
||||||
Player player = null;
|
|
||||||
if (cs instanceof Player) {
|
|
||||||
player = (Player) cs;
|
|
||||||
}
|
|
||||||
createReport(player);
|
|
||||||
try {
|
|
||||||
writeReport();
|
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
postReport();
|
|
||||||
}
|
|
||||||
|
|
||||||
public PastebinReport(CommandSender cs, Player tp) {
|
|
||||||
createReport(tp);
|
|
||||||
try {
|
|
||||||
writeReport();
|
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
|
||||||
postReport();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getURL() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void appendPermissionsTester(Player player) {
|
|
||||||
if (player == null) {
|
|
||||||
append("No player defined.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Permission node : Permission.values()) {
|
|
||||||
report.append(player.getName() + ": " + node.toString() + " " + node.get(player));
|
|
||||||
if (node.get(player) && !node.whichPermission(player).equals(node.toString())) {
|
|
||||||
report.append(" (Applied by " + node.whichPermission(player) + ")");
|
|
||||||
}
|
|
||||||
report.append('\n');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createReport(Player player) {
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
|
|
||||||
append("------------ WARNING! ------------");
|
|
||||||
append("This report was run with NoCheatPlus enabled. Results may be inaccurate." + '\n');
|
|
||||||
}
|
|
||||||
append("------------ AntiCheat Report - " + DATE + " ------------");
|
|
||||||
appendSystemInfo();
|
|
||||||
append("------------Last 30 logs------------");
|
|
||||||
appendLogs();
|
|
||||||
append("------------Permission Tester------------");
|
|
||||||
appendPermissionsTester(player);
|
|
||||||
append("------------Event Chains------------");
|
|
||||||
appendEventHandlers();
|
|
||||||
append("------------Magic Diff------------");
|
|
||||||
appendMagicDiff();
|
|
||||||
append("-----------End Of Report------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void appendLogs() {
|
|
||||||
List<String> logs = AntiCheatReloaded.getManager().getLoggingManager().getLastLogs();
|
|
||||||
if (logs.size() == 0) {
|
|
||||||
append("No recent logs.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (String log : logs) {
|
|
||||||
append(log);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void appendSystemInfo() {
|
|
||||||
Runtime runtime = Runtime.getRuntime();
|
|
||||||
Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
|
||||||
append("AntiCheat Version: " + AntiCheatReloaded.getVersion());
|
|
||||||
append("Server Version: " + Bukkit.getVersion());
|
|
||||||
append("Server Implementation: " + Bukkit.getName());
|
|
||||||
append("Server ID: " + Bukkit.getServerId());
|
|
||||||
append("NMS Version: " + VersionUtil.getVersion());
|
|
||||||
append("Java Version: " + System.getProperty("java.vendor") + " " + System.getProperty("java.version"));
|
|
||||||
append("OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
|
|
||||||
append("Free Memory: " + runtime.freeMemory() / 1024 / 1024 + "MB");
|
|
||||||
append("Max Memory: " + runtime.maxMemory() / 1024 / 1024 + "MB");
|
|
||||||
append("Total Memory: " + runtime.totalMemory() / 1024 / 1024 + "MB");
|
|
||||||
append("Online Mode: " + Bukkit.getOnlineMode());
|
|
||||||
append("Players: " + Bukkit.getOnlinePlayers().size() + "/" + Bukkit.getMaxPlayers());
|
|
||||||
append("Plugin Count: " + Bukkit.getPluginManager().getPlugins().length);
|
|
||||||
append("Plugin Uptime: " + ((System.currentTimeMillis() - AntiCheatReloaded.getPlugin().getLoadTime()) / 1000) / 60 + " minutes");
|
|
||||||
append("Enterprise: " + config.getConfig().enterprise.getValue());
|
|
||||||
if (config.getConfig().enterprise.getValue()) {
|
|
||||||
append("- Server name: " + config.getEnterprise().serverName.getValue());
|
|
||||||
append("- Database type: " + config.getEnterprise().database.getType());
|
|
||||||
append("- Groups source: " + (config.getEnterprise().configGroups.getValue() ? "Database" : "Flatfile"));
|
|
||||||
append("- Rules source: " + (config.getEnterprise().configRules.getValue() ? "Database" : "Flatfile"));
|
|
||||||
append("- Levels source: " + (config.getEnterprise().syncLevels.getValue() ? "Database" : "Flatfile"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void appendMagicDiff() {
|
|
||||||
// This is hacky, and I like it
|
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
|
||||||
FileConfiguration file = YamlConfiguration.loadConfiguration(new File(AntiCheatReloaded.getPlugin().getDataFolder(), "magic.yml"));
|
|
||||||
boolean changed = false;
|
|
||||||
for (Field field : Magic.class.getFields()) {
|
|
||||||
Object defaultValue = file.get(field.getName());
|
|
||||||
try {
|
|
||||||
Field value = magic.getClass().getDeclaredField(field.getName());
|
|
||||||
String s1 = value.get(magic).toString();
|
|
||||||
String s2 = defaultValue.toString();
|
|
||||||
if (!s1.equals(s2) && !s1.equals(s2 + ".0")) {
|
|
||||||
changed = true;
|
|
||||||
append(field.getName() + ": " + s1 + " (Default: " + s2 + ")");
|
|
||||||
} else {
|
|
||||||
}
|
|
||||||
} catch (NoSuchFieldException ex) {
|
|
||||||
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!changed) {
|
|
||||||
append("No changes from default.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void appendEventHandlers() {
|
|
||||||
report.append(AntiCheatReloaded.getManager().getEventChainReport());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeReport() throws IOException {
|
|
||||||
File f = new File(AntiCheatReloaded.getPlugin().getDataFolder() + "/report.txt");
|
|
||||||
FileWriter r = new FileWriter(f);
|
|
||||||
BufferedWriter writer = new BufferedWriter(r);
|
|
||||||
writer.write(report.toString());
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void postReport() {
|
|
||||||
try {
|
|
||||||
URL urls = new URL("http://pastebin.com/api/api_post.php");
|
|
||||||
HttpURLConnection conn = (HttpURLConnection) urls.openConnection();
|
|
||||||
conn.setConnectTimeout(5000);
|
|
||||||
conn.setReadTimeout(5000);
|
|
||||||
conn.setRequestMethod("POST");
|
|
||||||
conn.addRequestProperty("Content-type", "application/x-www-form-urlencoded");
|
|
||||||
conn.setInstanceFollowRedirects(false);
|
|
||||||
conn.setDoOutput(true);
|
|
||||||
OutputStream out = conn.getOutputStream();
|
|
||||||
|
|
||||||
out.write(("api_option=paste" + "&api_dev_key=" + URLEncoder.encode(API_KEY, "utf-8") + "&api_paste_code=" + URLEncoder.encode(report.toString(), "utf-8") + "&api_paste_private=" + URLEncoder.encode("1", "utf-8") + "&api_paste_name=" + URLEncoder.encode("", "utf-8") + "&api_paste_expire_date=" + URLEncoder.encode("1M", "utf-8") + "&api_paste_format=" + URLEncoder.encode("text", "utf-8") + "&api_user_key=" + URLEncoder.encode("", "utf-8")).getBytes());
|
|
||||||
out.flush();
|
|
||||||
out.close();
|
|
||||||
|
|
||||||
if (conn.getResponseCode() == 200) {
|
|
||||||
InputStream receive = conn.getInputStream();
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(receive));
|
|
||||||
String line;
|
|
||||||
StringBuffer response = new StringBuffer();
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
response.append(line);
|
|
||||||
response.append("\r\n");
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
|
|
||||||
String result = response.toString().trim();
|
|
||||||
|
|
||||||
if (!result.contains("http://")) {
|
|
||||||
url = "Failed to post. Check report.txt";
|
|
||||||
} else {
|
|
||||||
url = result.trim();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
url = "Failed to post. Check report.txt";
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
url = "Failed to post. Check report.txt";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void append(String s) {
|
|
||||||
report.append(s + '\n');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,77 +22,46 @@ package com.rammelkast.anticheatreloaded.util;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
public enum Permission {
|
public enum Permission {
|
||||||
/* Check Nodes */
|
/* Check Nodes */
|
||||||
CHECK_ZOMBE_FLY,
|
CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||||
CHECK_ZOMBE_NOCLIP,
|
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||||
CHECK_ZOMBE_CHEAT,
|
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
||||||
CHECK_FLY,
|
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT,
|
||||||
CHECK_WATERWALK,
|
|
||||||
CHECK_NOSWING,
|
|
||||||
CHECK_FASTBREAK,
|
|
||||||
CHECK_FASTPLACE,
|
|
||||||
CHECK_CHATSPAM,
|
|
||||||
CHECK_COMMANDSPAM,
|
|
||||||
CHECK_SPRINT,
|
|
||||||
CHECK_SNEAK,
|
|
||||||
CHECK_SPEED,
|
|
||||||
CHECK_VCLIP,
|
|
||||||
CHECK_SPIDER,
|
|
||||||
CHECK_NOFALL,
|
|
||||||
CHECK_FASTBOW,
|
|
||||||
CHECK_FASTEAT,
|
|
||||||
CHECK_FASTHEAL,
|
|
||||||
CHECK_FORCEFIELD,
|
|
||||||
CHECK_LONGREACH,
|
|
||||||
CHECK_FASTPROJECTILE,
|
|
||||||
CHECK_ITEMSPAM,
|
|
||||||
CHECK_VISUAL,
|
|
||||||
CHECK_FASTINVENTORY,
|
|
||||||
CHECK_AUTOTOOL,
|
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG,
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||||
SYSTEM_RESET,
|
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD;
|
||||||
SYSTEM_SPY,
|
|
||||||
SYSTEM_HELP,
|
|
||||||
SYSTEM_UPDATE,
|
|
||||||
SYSTEM_REPORT,
|
|
||||||
SYSTEM_ALERT,
|
|
||||||
SYSTEM_NOTICE,
|
|
||||||
SYSTEM_CALIBRATE,
|
|
||||||
SYSTEM_CHECK,
|
|
||||||
SYSTEM_DEBUG,
|
|
||||||
SYSTEM_RELOAD, CHECK_KILLAURA, CHECK_BLINK, VELOCITY, CRITICALS;
|
|
||||||
|
|
||||||
private static final String PERMISSION_ALL = "anticheat.*";
|
private static final String PERMISSION_ALL = "anticheat.*";
|
||||||
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
||||||
|
|
||||||
public static boolean getCommandExempt(CommandSender cs, String commandLabel) {
|
public static boolean getCommandExempt(CommandSender cs, String commandLabel) {
|
||||||
// Check permission, base, and all will have already been checked
|
// Check permission, base, and all will have already been checked
|
||||||
return cs.hasPermission(CHECK_COMMANDSPAM.toString() + commandLabel);
|
return cs.hasPermission(CHECK_COMMANDSPAM.toString() + commandLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean get(CommandSender cs) {
|
public boolean get(CommandSender cs) {
|
||||||
if ((this == CHECK_CHATSPAM || this == CHECK_COMMANDSPAM) && cs.hasPermission(PERMISSION_SPAM)) return true;
|
if ((this == CHECK_CHATSPAM || this == CHECK_COMMANDSPAM) && cs.hasPermission(PERMISSION_SPAM))
|
||||||
return cs.hasPermission(toString()) || cs.hasPermission(getBase()) || cs.hasPermission(PERMISSION_ALL);
|
return true;
|
||||||
}
|
return cs.hasPermission(toString()) || cs.hasPermission(getBase()) || cs.hasPermission(PERMISSION_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
public String getBase() {
|
public String getBase() {
|
||||||
return "anticheat." + this.name().toLowerCase().split("_")[0] + ".*";
|
return "anticheat." + this.name().toLowerCase().split("_")[0] + ".*";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String whichPermission(CommandSender cs) {
|
public String whichPermission(CommandSender cs) {
|
||||||
for (String s : new String[]{PERMISSION_ALL, getBase(), toString()}) {
|
for (String s : new String[] { PERMISSION_ALL, getBase(), toString() }) {
|
||||||
if (cs.hasPermission(s)) {
|
if (cs.hasPermission(s)) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "anticheat." + this.name().toLowerCase().replace("_", ".");
|
return "anticheat." + this.name().toLowerCase().replace("_", ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,27 +23,22 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
public enum ToolHardness {
|
public enum ToolHardness {
|
||||||
|
|
||||||
// NOTHING(null, 1.5)
|
// NOTHING(null, 1.5)
|
||||||
WOOD(0.75D),
|
WOOD(0.75D), STONE(0.40D), IRON(0.25D), DIAMOND(0.20D), SHEARS(0.55D), GOLD(0.15D);
|
||||||
STONE(0.40D),
|
|
||||||
IRON(0.25D),
|
|
||||||
DIAMOND(0.20D),
|
|
||||||
SHEARS(0.55D),
|
|
||||||
GOLD(0.15D);
|
|
||||||
|
|
||||||
double hardness;
|
double hardness;
|
||||||
|
|
||||||
ToolHardness(double hard) {
|
ToolHardness(double hard) {
|
||||||
hardness = hard;
|
hardness = hard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getToolHardness(Material tool) {
|
public static double getToolHardness(Material tool) {
|
||||||
for (ToolHardness e : ToolHardness.values()) {
|
for (ToolHardness e : ToolHardness.values()) {
|
||||||
if (tool.name().contains(e.name())) {
|
if (tool.name().contains(e.name())) {
|
||||||
return e.hardness;
|
return e.hardness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1.50D;
|
return 1.50D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
/*
|
||||||
|
* 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();
|
||||||
|
reader.close();
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -35,397 +36,425 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final int id;
|
private final int id;
|
||||||
private int level = 0;
|
private int level = 0;
|
||||||
private Location goodLocation;
|
private Location goodLocation;
|
||||||
private List<ItemStack> inventorySnapshot = null;
|
private List<ItemStack> inventorySnapshot = null;
|
||||||
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
||||||
private int toX, toY, toZ;
|
private int toX, toY, toZ;
|
||||||
private String[] messages = new String[2];
|
private String[] messages = new String[2];
|
||||||
private Long[] messageTimes = new Long[2];
|
private Long[] messageTimes = new Long[2];
|
||||||
private String[] commands = new String[2];
|
private String[] commands = new String[2];
|
||||||
private Long[] commandTimes = new Long[2];
|
private Long[] commandTimes = new Long[2];
|
||||||
|
|
||||||
private boolean isWaitingOnLevelSync;
|
private boolean isWaitingOnLevelSync;
|
||||||
private Timestamp levelSyncTimestamp;
|
private Timestamp levelSyncTimestamp;
|
||||||
|
|
||||||
/**
|
private long lastServerPing, lastClientPong;
|
||||||
* Initialize an AntiCheat user
|
private int ping = -1;
|
||||||
*
|
private int lastPing = -1;
|
||||||
* @param uuid Player's UUID
|
|
||||||
*/
|
|
||||||
public User(UUID uuid) {
|
|
||||||
this.uuid = uuid;
|
|
||||||
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
|
|
||||||
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an AntiCheat user
|
* Initialize an AntiCheat user
|
||||||
*
|
*
|
||||||
* @param name Player's name
|
* @param uuid Player's UUID
|
||||||
*/
|
*/
|
||||||
/* public User(String name) {
|
public User(UUID uuid) {
|
||||||
this.uuid = Bukkit.getPlayer(name).getUniqueId();
|
this.uuid = uuid;
|
||||||
this.name = name;
|
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
|
||||||
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* Get the player's UUID
|
|
||||||
*
|
|
||||||
* @return Player UUID
|
|
||||||
*/
|
|
||||||
public UUID getUUID() {
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player's name
|
* Get the player's UUID
|
||||||
*
|
*
|
||||||
* @return Player name
|
* @return Player UUID
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public UUID getUUID() {
|
||||||
return name;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player's entity ID
|
* Get the player's name
|
||||||
*
|
*
|
||||||
* @return Entity id
|
* @return Player name
|
||||||
*/
|
*/
|
||||||
public int getId() {
|
public String getName() {
|
||||||
return id;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Bukkit player
|
* Get the player's entity ID
|
||||||
*
|
*
|
||||||
* @return Player
|
* @return Entity id
|
||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public int getId() {
|
||||||
return Bukkit.getPlayer(uuid);
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the user's level value
|
* Get the Bukkit player
|
||||||
*
|
*
|
||||||
* @return level
|
* @return Player
|
||||||
*/
|
*/
|
||||||
public int getLevel() {
|
public Player getPlayer() {
|
||||||
return level;
|
return Bukkit.getPlayer(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the user's group
|
* Get the user's level value
|
||||||
*
|
*
|
||||||
* @return group
|
* @return level
|
||||||
*/
|
*/
|
||||||
public Group getGroup() {
|
public int getLevel() {
|
||||||
List<Group> groups = config.getGroups().getGroups();
|
return level;
|
||||||
for (int i = 0; i < groups.size(); i++) {
|
}
|
||||||
if (i == 0 && level < groups.get(i).getLevel()) break;
|
|
||||||
else if (i == groups.size() - 1) return groups.get(i);
|
|
||||||
else if (level >= groups.get(i).getLevel() && level < groups.get(i + 1).getLevel()) return groups.get(i);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increase the player's level (from failing a check)
|
* Get the user's group
|
||||||
*
|
*
|
||||||
* @param type The check failed
|
* @return group
|
||||||
* @return true if the level was increased
|
*/
|
||||||
*/
|
public Group getGroup() {
|
||||||
public boolean increaseLevel(CheckType type) {
|
List<Group> groups = config.getGroups().getGroups();
|
||||||
if (getPlayer() != null && getPlayer().isOnline()) {
|
for (int i = 0; i < groups.size(); i++) {
|
||||||
if (silentMode() && type.getUses(uuid) % 4 != 0) {
|
if (i == 0 && level < groups.get(i).getLevel())
|
||||||
// Prevent silent mode from increasing the level way too fast
|
break;
|
||||||
return false;
|
else if (i == groups.size() - 1)
|
||||||
} else {
|
return groups.get(i);
|
||||||
if (level < config.getGroups().getHighestLevel()) {
|
else if (level >= groups.get(i).getLevel() && level < groups.get(i + 1).getLevel())
|
||||||
level++;
|
return groups.get(i);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Check levels
|
/**
|
||||||
for (Group l : getLevels()) {
|
* Increase the player's level (from failing a check)
|
||||||
if (l.getLevel() == level) {
|
*
|
||||||
AntiCheatReloaded.getManager().getUserManager().alert(this, l, type);
|
* @param type The check failed
|
||||||
if (l.getLevel() == config.getGroups().getHighestLevel()) {
|
* @return true if the level was increased
|
||||||
level = l.getLevel() - 10;
|
*/
|
||||||
}
|
public boolean increaseLevel(CheckType type) {
|
||||||
}
|
if (getPlayer() != null && getPlayer().isOnline()) {
|
||||||
}
|
if (silentMode() && type.getUses(uuid) % 4 != 0) {
|
||||||
|
// Prevent silent mode from increasing the level way too fast
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if (level < config.getGroups().getHighestLevel()) {
|
||||||
|
level++;
|
||||||
|
|
||||||
// Execute rules
|
// Check levels
|
||||||
for (Rule rule : config.getRules().getRules()) {
|
for (Group l : getLevels()) {
|
||||||
rule.check(this, type);
|
if (l.getLevel() == level) {
|
||||||
}
|
AntiCheatReloaded.getManager().getUserManager().alert(this, l, type);
|
||||||
return true;
|
if (l.getLevel() == config.getGroups().getHighestLevel()) {
|
||||||
}
|
level = l.getLevel() - 10;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// Execute rules
|
||||||
* Decrease the player's level by one value
|
for (Rule rule : config.getRules().getRules()) {
|
||||||
*/
|
rule.check(this, type);
|
||||||
public void decreaseLevel() {
|
}
|
||||||
level = level != 0 ? level - 1 : 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the users level to a specific value. Must be 0 < level < config-defined highest level
|
* Decrease the player's level by one value
|
||||||
*
|
*/
|
||||||
* @param level level to set
|
public void decreaseLevel() {
|
||||||
* @return true if the level was valid and set properly
|
level = level != 0 ? level - 1 : 0;
|
||||||
*/
|
}
|
||||||
public boolean setLevel(int level) {
|
|
||||||
isWaitingOnLevelSync = false;
|
|
||||||
if (level >= 0) {
|
|
||||||
if (level <= config.getGroups().getHighestLevel()) {
|
|
||||||
this.level = level;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
this.level = config.getGroups().getHighestLevel();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the user's level to zero and clear all check failures
|
* Set the users level to a specific value. Must be 0 < level < config-defined
|
||||||
*/
|
* highest level
|
||||||
public void resetLevel() {
|
*
|
||||||
level = 0;
|
* @param level level to set
|
||||||
for (CheckType type : CheckType.values()) {
|
* @return true if the level was valid and set properly
|
||||||
type.clearUse(uuid);
|
*/
|
||||||
}
|
public boolean setLevel(int level) {
|
||||||
}
|
isWaitingOnLevelSync = false;
|
||||||
|
if (level >= 0) {
|
||||||
|
if (level <= config.getGroups().getHighestLevel()) {
|
||||||
|
this.level = level;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
this.level = config.getGroups().getHighestLevel();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last known valid location of the player for use in resetting
|
* Reset the user's level to zero and clear all check failures
|
||||||
*
|
*/
|
||||||
* @param location default value to be returned if no known good location exists
|
public void resetLevel() {
|
||||||
* @return last known valid location
|
level = 0;
|
||||||
*/
|
for (CheckType type : CheckType.values()) {
|
||||||
public Location getGoodLocation(Location location) {
|
type.clearUse(uuid);
|
||||||
if (goodLocation == null) {
|
}
|
||||||
return location;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return goodLocation;
|
/**
|
||||||
}
|
* Get the last known valid location of the player for use in resetting
|
||||||
|
*
|
||||||
|
* @param location default value to be returned if no known good location exists
|
||||||
|
* @return last known valid location
|
||||||
|
*/
|
||||||
|
public Location getGoodLocation(Location location) {
|
||||||
|
if (goodLocation == null) {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
return goodLocation;
|
||||||
* Set the last known valid location of the player
|
}
|
||||||
*
|
|
||||||
* @param location location to be set
|
|
||||||
* @return true if the location was valid and set properly
|
|
||||||
*/
|
|
||||||
public boolean setGoodLocation(Location location) {
|
|
||||||
if (Utilities.cantStandAtExp(location) || (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
goodLocation = location;
|
/**
|
||||||
return true;
|
* Set the last known valid location of the player
|
||||||
}
|
*
|
||||||
|
* @param location location to be set
|
||||||
|
* @return true if the location was valid and set properly
|
||||||
|
*/
|
||||||
|
public boolean setGoodLocation(Location location) {
|
||||||
|
if (Utilities.cantStandAtExp(location)
|
||||||
|
|| (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
goodLocation = location;
|
||||||
* Store a copy of the player's inventory, for use in resetting
|
return true;
|
||||||
*
|
}
|
||||||
* @param is ItemStack list to store
|
|
||||||
*/
|
|
||||||
public void setInventorySnapshot(ItemStack[] is) {
|
|
||||||
inventorySnapshot = new ArrayList<ItemStack>();
|
|
||||||
for (int i = 0; i < is.length; i++) {
|
|
||||||
if (is[i] != null) {
|
|
||||||
inventorySnapshot.add(is[i].clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the current inventory snapshot
|
* Store a copy of the player's inventory, for use in resetting
|
||||||
*/
|
*
|
||||||
public void removeInventorySnapshot() {
|
* @param is ItemStack list to store
|
||||||
inventorySnapshot = null;
|
*/
|
||||||
}
|
public void setInventorySnapshot(ItemStack[] is) {
|
||||||
|
inventorySnapshot = new ArrayList<ItemStack>();
|
||||||
|
for (int i = 0; i < is.length; i++) {
|
||||||
|
if (is[i] != null) {
|
||||||
|
inventorySnapshot.add(is[i].clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore the player's inventory with the current inventory snapshot
|
* Remove the current inventory snapshot
|
||||||
*
|
*/
|
||||||
* @param inventory Player's inventory
|
public void removeInventorySnapshot() {
|
||||||
*/
|
inventorySnapshot = null;
|
||||||
public void restoreInventory(Inventory inventory) {
|
}
|
||||||
if (inventorySnapshot != null) {
|
|
||||||
inventory.clear();
|
|
||||||
for (ItemStack is : inventorySnapshot) {
|
|
||||||
if (is != null) {
|
|
||||||
inventory.addItem(is);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's to location
|
* Restore the player's inventory with the current inventory snapshot
|
||||||
*
|
*
|
||||||
* @param x X value
|
* @param inventory Player's inventory
|
||||||
* @param y Y value
|
*/
|
||||||
* @param z Z value
|
public void restoreInventory(Inventory inventory) {
|
||||||
*/
|
if (inventorySnapshot != null) {
|
||||||
public void setTo(double x, double y, double z) {
|
inventory.clear();
|
||||||
toX = (int) x;
|
for (ItemStack is : inventorySnapshot) {
|
||||||
toY = (int) y;
|
if (is != null) {
|
||||||
toZ = (int) z;
|
inventory.addItem(is);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a given to value is the same as the stored value
|
* Set the player's to location
|
||||||
*
|
*
|
||||||
* @param x X value
|
* @param x X value
|
||||||
* @param y Y value
|
* @param y Y value
|
||||||
* @param z Z value
|
* @param z Z value
|
||||||
* @return true if coordinates are all equal
|
*/
|
||||||
*/
|
public void setTo(double x, double y, double z) {
|
||||||
public boolean checkTo(double x, double y, double z) {
|
toX = (int) x;
|
||||||
return (int) x == toX && (int) y == toY && (int) z == toZ;
|
toY = (int) y;
|
||||||
}
|
toZ = (int) z;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a player's chat message
|
* Check if a given to value is the same as the stored value
|
||||||
*
|
*
|
||||||
* @param message Message to log
|
* @param x X value
|
||||||
*/
|
* @param y Y value
|
||||||
public void addMessage(String message) {
|
* @param z Z value
|
||||||
addToSpamLog(message, messages, messageTimes);
|
* @return true if coordinates are all equal
|
||||||
}
|
*/
|
||||||
|
public boolean checkTo(double x, double y, double z) {
|
||||||
|
return (int) x == toX && (int) y == toY && (int) z == toZ;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a player's command
|
* Log a player's chat message
|
||||||
*
|
*
|
||||||
* @param command Command to log
|
* @param message Message to log
|
||||||
*/
|
*/
|
||||||
public void addCommand(String command) {
|
public void addMessage(String message) {
|
||||||
addToSpamLog(command, commands, commandTimes);
|
addToSpamLog(message, messages, messageTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToSpamLog(String string, String[] messages, Long[] times) {
|
/**
|
||||||
messages[1] = messages[0];
|
* Log a player's command
|
||||||
messages[0] = string;
|
*
|
||||||
|
* @param command Command to log
|
||||||
|
*/
|
||||||
|
public void addCommand(String command) {
|
||||||
|
addToSpamLog(command, commands, commandTimes);
|
||||||
|
}
|
||||||
|
|
||||||
times[1] = times[0];
|
private void addToSpamLog(String string, String[] messages, Long[] times) {
|
||||||
times[0] = System.currentTimeMillis();
|
messages[1] = messages[0];
|
||||||
}
|
messages[0] = string;
|
||||||
|
|
||||||
/**
|
times[1] = times[0];
|
||||||
* Get a stored chat message
|
times[0] = System.currentTimeMillis();
|
||||||
*
|
}
|
||||||
* @param index Index of the chat in storage
|
|
||||||
* @return the message
|
|
||||||
*/
|
|
||||||
public String getMessage(int index) {
|
|
||||||
return messages[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a stored command
|
* Get a stored chat message
|
||||||
*
|
*
|
||||||
* @param index Index of the command in storage
|
* @param index Index of the chat in storage
|
||||||
* @return the command
|
* @return the message
|
||||||
*/
|
*/
|
||||||
public String getCommand(int index) {
|
public String getMessage(int index) {
|
||||||
return commands[index];
|
return messages[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time a message in storage was sent
|
* Get a stored command
|
||||||
*
|
*
|
||||||
* @param index Index of the chat in storage
|
* @param index Index of the command in storage
|
||||||
* @return time the message was sent
|
* @return the command
|
||||||
*/
|
*/
|
||||||
public Long getMessageTime(int index) {
|
public String getCommand(int index) {
|
||||||
return messageTimes[index];
|
return commands[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time a command in storage was sent
|
* Get the time a message in storage was sent
|
||||||
*
|
*
|
||||||
* @param index Index of the command in storage
|
* @param index Index of the chat in storage
|
||||||
* @return time the command was sent
|
* @return time the message was sent
|
||||||
*/
|
*/
|
||||||
public Long getCommandTime(int index) {
|
public Long getMessageTime(int index) {
|
||||||
return commandTimes[index];
|
return messageTimes[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all stored messages
|
* Get the time a command in storage was sent
|
||||||
*/
|
*
|
||||||
public void clearMessages() {
|
* @param index Index of the command in storage
|
||||||
messages = new String[2];
|
* @return time the command was sent
|
||||||
messageTimes = new Long[2];
|
*/
|
||||||
}
|
public Long getCommandTime(int index) {
|
||||||
|
return commandTimes[index];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all stored commands
|
* Clear all stored messages
|
||||||
*/
|
*/
|
||||||
public void clearCommands() {
|
public void clearMessages() {
|
||||||
commands = new String[2];
|
messages = new String[2];
|
||||||
commandTimes = new Long[2];
|
messageTimes = new Long[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time the very last stored message was sent
|
* Clear all stored commands
|
||||||
*
|
*/
|
||||||
* @return the last message's time
|
public void clearCommands() {
|
||||||
*/
|
commands = new String[2];
|
||||||
public Long getLastMessageTime() {
|
commandTimes = new Long[2];
|
||||||
return getMessageTime(0) == null ? -1 : getMessageTime(0);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time the very last stored command was sent
|
* Get the time the very last stored message was sent
|
||||||
*
|
*
|
||||||
* @return the last command's time
|
* @return the last message's time
|
||||||
*/
|
*/
|
||||||
public Long getLastCommandTime() {
|
public Long getLastMessageTime() {
|
||||||
return getCommandTime(0) == null ? -1 : getCommandTime(0);
|
return getMessageTime(0) == null ? -1 : getMessageTime(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Group> getLevels() {
|
/**
|
||||||
return config.getGroups().getGroups();
|
* Get the time the very last stored command was sent
|
||||||
}
|
*
|
||||||
|
* @return the last command's time
|
||||||
|
*/
|
||||||
|
public Long getLastCommandTime() {
|
||||||
|
return getCommandTime(0) == null ? -1 : getCommandTime(0);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean silentMode() {
|
private List<Group> getLevels() {
|
||||||
return config.getConfig().silentMode.getValue();
|
return config.getGroups().getGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsWaitingOnLevelSync(boolean b) {
|
private boolean silentMode() {
|
||||||
this.isWaitingOnLevelSync = b;
|
return config.getConfig().silentMode.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWaitingOnLevelSync() {
|
public void setIsWaitingOnLevelSync(boolean b) {
|
||||||
return isWaitingOnLevelSync;
|
this.isWaitingOnLevelSync = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLevelSyncTimestamp(Timestamp timestamp) {
|
public boolean isWaitingOnLevelSync() {
|
||||||
levelSyncTimestamp = timestamp;
|
return isWaitingOnLevelSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Timestamp getLevelSyncTimestamp() {
|
public void setLevelSyncTimestamp(Timestamp timestamp) {
|
||||||
return levelSyncTimestamp;
|
levelSyncTimestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public Timestamp getLevelSyncTimestamp() {
|
||||||
public String toString() {
|
return levelSyncTimestamp;
|
||||||
return "User {name = " + getName() + ", level = " + level + "}";
|
}
|
||||||
}
|
|
||||||
|
public void onServerPing() {
|
||||||
|
this.lastServerPing = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClientPong() {
|
||||||
|
this.lastClientPong = System.currentTimeMillis();
|
||||||
|
this.lastPing = this.ping;
|
||||||
|
this.ping = (int) (this.lastClientPong - this.lastServerPing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPing() {
|
||||||
|
int ping = this.ping;
|
||||||
|
if (ping < 0) {
|
||||||
|
return VersionUtil.getPlayerPing(this.getPlayer());
|
||||||
|
}
|
||||||
|
return ping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastPing() {
|
||||||
|
int lastPing = this.lastPing;
|
||||||
|
if (lastPing < 0) {
|
||||||
|
return this.getPing();
|
||||||
|
}
|
||||||
|
return lastPing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLagging() {
|
||||||
|
return Math.abs(this.ping - this.lastPing) > 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "User {name = " + getName() + ", level = " + level + "}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,25 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class VersionUtil {
|
public class VersionUtil {
|
||||||
|
|
||||||
private static final List<String> SUPPORTED_VERSIONS = Arrays.asList(new String[] {
|
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
||||||
"v1_8",
|
.asList(new String[] { "v1_15", "v1_14", "v1_13", "v1_8_R3" });
|
||||||
"v1_9",
|
|
||||||
"v1_10",
|
|
||||||
"v1_11",
|
|
||||||
"v1_12"
|
|
||||||
});
|
|
||||||
|
|
||||||
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSupported() {
|
public static boolean isSupported() {
|
||||||
@@ -31,53 +49,57 @@ public class VersionUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final EnumSet<Material> MOVE_UP_BLOCKS_1_8 = EnumSet.of(Material.ACACIA_STAIRS,
|
public static boolean isOfVersion(String versionId) {
|
||||||
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
|
if (getVersion().startsWith(versionId)) {
|
||||||
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
|
return true;
|
||||||
Material.RED_SANDSTONE_STAIRS, Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS,
|
}
|
||||||
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the if server is running Bountiful Update (1.8)
|
||||||
|
*/
|
||||||
|
public static boolean isBountifulUpdate() {
|
||||||
|
return isOfVersion("v1_8");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isFlying(Player p) {
|
public static boolean isFlying(Player p) {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (isBountifulUpdate()) {
|
||||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
|
|
||||||
} else {
|
|
||||||
return p.isFlying();
|
return p.isFlying();
|
||||||
}
|
}
|
||||||
}
|
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
||||||
|
|
||||||
public static EnumSet<Material> getMoveUpBlocks() {
|
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
|
||||||
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
|
|
||||||
} else {
|
|
||||||
return MOVE_UP_BLOCKS_1_8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isNewYSpeed() {
|
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getHealTime() {
|
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
|
||||||
return 495;
|
|
||||||
} else {
|
|
||||||
return 1995;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFrostWalk(Player player) {
|
public static boolean isFrostWalk(Player player) {
|
||||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
if (player.getInventory().getBoots() == null || isBountifulUpdate()) {
|
||||||
if (player.getInventory().getBoots() == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static ItemStack getItemInHand(Player player) {
|
||||||
|
if (isBountifulUpdate()) {
|
||||||
|
return player.getItemInHand();
|
||||||
|
}
|
||||||
|
return player.getInventory().getItemInMainHand();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPlayerPing(Player player) {
|
||||||
|
try {
|
||||||
|
Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
||||||
|
int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
|
||||||
|
return ping;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block getTargetBlock(Player player, int distance) {
|
||||||
|
if (isBountifulUpdate()) {
|
||||||
|
return player.getTargetBlock((Set<Material>) null, distance);
|
||||||
|
}
|
||||||
|
return player.getTargetBlockExact(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* AntiCheat for Bukkit.
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -71,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/>
|
||||||
@@ -81,13 +82,13 @@ 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 {
|
||||||
CONDITIONAL(".*[?]*.*:.*", "net.gravitydevelopment.anticheat.util.rule.ConditionalRule");
|
CONDITIONAL(".*[?]*.*:.*", "com.rammelkast.anticheatreloaded.util.rule.ConditionalRule");
|
||||||
|
|
||||||
private String regex;
|
private String regex;
|
||||||
private String c;
|
private String c;
|
||||||
@@ -128,7 +129,8 @@ 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
|
||||||
*/
|
*/
|
||||||
public static Rule load(String string) {
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public static Rule load(String string) {
|
||||||
for (Type type : Type.values()) {
|
for (Type type : Type.values()) {
|
||||||
if (type.matches(string)) {
|
if (type.matches(string)) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ spam:
|
|||||||
action-one: KICK
|
action-one: KICK
|
||||||
action-two: BAN
|
action-two: BAN
|
||||||
system:
|
system:
|
||||||
# Turning auto-update off is a _BAD_ idea. You will no longer be protected by the latest hacks/cheats if you do so, and will have to update manually.
|
|
||||||
auto-update: true
|
|
||||||
# Should AntiCheatReloaded log ALL failed checks to console?
|
# Should AntiCheatReloaded log ALL failed checks to console?
|
||||||
log-to-console: false
|
log-to-console: false
|
||||||
# Should AntiCheatReloaded log to file?
|
# Should AntiCheatReloaded log to file?
|
||||||
@@ -32,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 and enable debug logging
|
||||||
|
# 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,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
|
||||||
@@ -17,7 +16,7 @@ database:
|
|||||||
# Password for the user
|
# Password for the user
|
||||||
password: ''
|
password: ''
|
||||||
# Prefix for the tables
|
# Prefix for the tables
|
||||||
prefix: 'ac_'
|
prefix: 'acr_'
|
||||||
# Database/Schema to use
|
# Database/Schema to use
|
||||||
database: 'anticheat'
|
database: 'anticheat'
|
||||||
# Logging settings
|
# Logging settings
|
||||||
|
|||||||
@@ -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
@@ -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'
|
||||||
+205
-25
@@ -1,88 +1,268 @@
|
|||||||
# AntiCheatReloaded configuration file
|
# Maximum times a player can interact between animations
|
||||||
|
# Changing this value of almost never required
|
||||||
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
|
||||||
TELEPORT_TIME: 1000
|
# Time to exempt a player from moving because of teleporting
|
||||||
TIMER_STEP_CHECK: 50
|
# Increase in case of false positives
|
||||||
TIMER_TIMEMIN: 2000
|
TELEPORT_TIME: 800
|
||||||
|
# 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: 8
|
||||||
|
# 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
|
||||||
WATER_SPEED_VIOLATION_MAX: 4
|
# 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: 6
|
||||||
|
# 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
|
||||||
Y_SPEED_MAX: 0.5125
|
# 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
|
||||||
|
# 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
|
||||||
GLIDE_LIMIT: 10
|
# Amount of suspicious mid-air movements before a player is suspected of glide
|
||||||
KILLAURA_BOTHITS: 4
|
# Increase this in case of false positives
|
||||||
BLINK_PACKET: 74
|
GLIDE_LIMIT: 5
|
||||||
VELOCITY_AMT: 5
|
# Maximum amount of movement packets allowed per second
|
||||||
|
# Increase this in case of false positives
|
||||||
|
MOREPACKETS_LIMIT: 30
|
||||||
|
# If the MorePackets check gives false positives replace this with the average user ping on your server
|
||||||
|
# Not a good idea to use a value lower than 75 or higher than 250
|
||||||
|
MOREPACKETS_AVERAGE_PING: 80
|
||||||
|
# Maximum amount zero-velocity moments before a player is suspected
|
||||||
|
# Increase this in case of false positives
|
||||||
|
VELOCITY_MAX_FLAGS: 3
|
||||||
|
# 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
|
||||||
|
# The minimum time it takes to regenerate health
|
||||||
|
# Decrease this in case of false positives
|
||||||
|
MIN_HEAL_TIME: 490
|
||||||
|
# Maximum distance allowed between two movement packets
|
||||||
|
# Increase this in case of false positives
|
||||||
|
BADPACKETS_MAX_DISTANCE: 25.0
|
||||||
@@ -2,14 +2,15 @@ name: AntiCheatReloaded
|
|||||||
author: Rammelkast
|
author: Rammelkast
|
||||||
description: AntiCheatReloaded helps easily identify and block malicious users on your server.
|
description: AntiCheatReloaded helps easily identify and block malicious users on your server.
|
||||||
main: com.rammelkast.anticheatreloaded.AntiCheatReloaded
|
main: com.rammelkast.anticheatreloaded.AntiCheatReloaded
|
||||||
|
api-version: 1.13
|
||||||
depend: [ProtocolLib]
|
depend: [ProtocolLib]
|
||||||
startup: postworld
|
startup: postworld
|
||||||
version: ${project.build.version}
|
version: ${project.build.version}
|
||||||
commands:
|
commands:
|
||||||
anticheat:
|
anticheat:
|
||||||
description: Control and view info about AntiCheat
|
description: Control and view info about AntiCheatReloaded
|
||||||
usage: /anticheat help
|
usage: /anticheat help
|
||||||
aliases: anti
|
aliases: acr
|
||||||
permissions:
|
permissions:
|
||||||
anticheat.system.notice:
|
anticheat.system.notice:
|
||||||
description: See broadcasts when a player is kicked or banned for hacking
|
description: See broadcasts when a player is kicked or banned for hacking
|
||||||
@@ -17,10 +18,10 @@ permissions:
|
|||||||
description: See alerts when a player might be cheating
|
description: See alerts when a player might be cheating
|
||||||
anticheat.system.help:
|
anticheat.system.help:
|
||||||
description: Access the help message
|
description: Access the help message
|
||||||
|
anticheat.system.mute:
|
||||||
|
description: Access the mute function
|
||||||
anticheat.system.report:
|
anticheat.system.report:
|
||||||
description: Access cheat reports
|
description: Access cheat reports
|
||||||
anticheat.system.spy:
|
|
||||||
description: Access the spy system
|
|
||||||
anticheat.mod:
|
anticheat.mod:
|
||||||
description: Mod helper perm
|
description: Mod helper perm
|
||||||
children:
|
children:
|
||||||
@@ -28,19 +29,15 @@ permissions:
|
|||||||
anticheat.system.alert: true
|
anticheat.system.alert: true
|
||||||
anticheat.system.help: true
|
anticheat.system.help: true
|
||||||
anticheat.system.report: true
|
anticheat.system.report: true
|
||||||
anticheat.system.spy: true
|
anticheat.system.mute: true
|
||||||
anticheat.system.log:
|
anticheat.system.log:
|
||||||
description: Access turning console logging on or off
|
description: Access turning console logging on or off
|
||||||
anticheat.system.reload:
|
anticheat.system.reload:
|
||||||
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:
|
|
||||||
description: Access the calibration system
|
|
||||||
anticheat.system.debug:
|
|
||||||
description: Access debug reports
|
|
||||||
anticheat.admin:
|
anticheat.admin:
|
||||||
description: Admin helper perm
|
description: Admin helper perm
|
||||||
children:
|
children:
|
||||||
@@ -48,20 +45,12 @@ permissions:
|
|||||||
anticheat.system.log: true
|
anticheat.system.log: true
|
||||||
anticheat.system.reload: true
|
anticheat.system.reload: true
|
||||||
anticheat.system.reset: true
|
anticheat.system.reset: true
|
||||||
anticheat.system.update: true
|
anticheat.system.mute: true
|
||||||
anticheat.system.calibrate: true
|
anticheat.check.flight:
|
||||||
anticheat.system.debug: true
|
description: Allow players to use fly cheats
|
||||||
anticheat.check.zombe.fly:
|
|
||||||
description: Allow players to use zombe flymod
|
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.zombe.noclip:
|
anticheat.check.elytra:
|
||||||
description: Allow players to use zombe noclip hack
|
description: Allow players to use ElytraFly cheats
|
||||||
default: false
|
|
||||||
anticheat.check.zombe.cheat:
|
|
||||||
description: Allow players to use zombe cheat hack
|
|
||||||
default: false
|
|
||||||
anticheat.check.fly:
|
|
||||||
description: Allow players to fly
|
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.waterwalk:
|
anticheat.check.waterwalk:
|
||||||
description: Allow players to walk on water
|
description: Allow players to walk on water
|
||||||
@@ -102,8 +91,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
|
||||||
@@ -126,16 +115,25 @@ permissions:
|
|||||||
anticheat.check.autotool:
|
anticheat.check.autotool:
|
||||||
description: Allow players to use autotool to switch tools quickly
|
description: Allow players to use autotool to switch tools quickly
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.fastanimation:
|
anticheat.check.morepackets:
|
||||||
description: Allow players to attack or interact very quickly
|
description: Allow players to send lots of movement packets
|
||||||
|
default: false
|
||||||
|
anticheat.check.velocity:
|
||||||
|
description: Allow players to use knockback prevention
|
||||||
|
default: false
|
||||||
|
anticheat.check.criticals:
|
||||||
|
description: Allow players to use criticals
|
||||||
|
default: false
|
||||||
|
anticheat.check.unicode:
|
||||||
|
description: Allow players to use unicode in chat
|
||||||
|
default: false
|
||||||
|
anticheat.check.illegalinteract:
|
||||||
|
description: Allow players to place blocks in illegal places
|
||||||
default: false
|
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
|
||||||
@@ -150,7 +148,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
|
||||||
@@ -159,3 +157,8 @@ permissions:
|
|||||||
anticheat.check.fastinventory: true
|
anticheat.check.fastinventory: true
|
||||||
anticheat.check.autotool: true
|
anticheat.check.autotool: true
|
||||||
anticheat.check.fastanimation: true
|
anticheat.check.fastanimation: true
|
||||||
|
anticheat.check.morepackets: true
|
||||||
|
anticheat.check.velocity: true
|
||||||
|
anticheat.check.criticals: true
|
||||||
|
anticheat.check.unicode: true
|
||||||
|
anticheat.check.illegalinteract: true
|
||||||
Reference in new issue
Block a user