mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
992c67d894 | ||
|
|
12c85b3939 | ||
|
|
37d580a4ba | ||
|
|
f94a430d41 | ||
|
|
918549bc11 | ||
|
|
c6e4ce091a | ||
|
|
7d13aae057 | ||
|
|
3538b8934c | ||
|
|
b2701fa057 | ||
|
|
8cf2702708 | ||
|
|
cd3184f17b | ||
|
|
9078846511 | ||
|
|
50247f28c9 | ||
|
|
cc51e9307f | ||
|
|
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 |
No files matched your search
@@ -1,10 +1,11 @@
|
||||
AntiCheatReloaded
|
||||
=============
|
||||
AntiCheatReloaded helps server admins easily identify and block malicious users by monitoring and analyzing the behaviour of their players. It is based on one of the oldest anti-cheats in the community, AntiCheat.
|
||||
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.
|
||||
|
||||
+ BTC donations: bc1q5qgmzq9e63h7ptf3kneg78uf0mghtwsmvwxt8m
|
||||
+ LTC donations: LYZLe6AGRQZTey5UHe7CCF3e9HAyQooSmh
|
||||
+ ETH donations: 0x2a2171fB3600fc67951734c2872E0Ad742741Cf2
|
||||
Installation
|
||||
------------
|
||||
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
|
||||
------------
|
||||
@@ -12,21 +13,17 @@ 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.
|
||||
|
||||
Please include the following information with your issue, this allows me to fix it quicker;
|
||||
* The `/anticheat debug` log
|
||||
* Your AntiCheatReloaded 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.)
|
||||
|
||||
Usage
|
||||
-------
|
||||
Simply drag and drop the plugin file and the ProtocolLib jar into your Plugins folder.
|
||||
* Any logs relating to the issue
|
||||
|
||||
Hacks blocked
|
||||
-------
|
||||
* Blink
|
||||
* Flight
|
||||
* Glide
|
||||
* FastLadder
|
||||
* Jesus
|
||||
* Step
|
||||
* Criticals
|
||||
@@ -39,8 +36,14 @@ Hacks blocked
|
||||
* NoFall
|
||||
* Sneak
|
||||
* vClip
|
||||
* Timer
|
||||
* FastBreak
|
||||
* FastPlace
|
||||
* Spam
|
||||
* FastEat
|
||||
* FastEat
|
||||
* ElytraFly
|
||||
* Unicode chat
|
||||
* GhostHand
|
||||
* KillAura
|
||||
* Scaffold
|
||||
* MorePackets
|
||||
* BadPackets
|
||||
@@ -3,9 +3,9 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.7.1-ALPHA</version>
|
||||
<version>1.8.2-PRE</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://rammelkast.com</url>
|
||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||
<properties>
|
||||
<project.build.version>${project.version}</project.build.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -44,6 +44,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.rammelkast.*</include>
|
||||
<include>com.cryptomorin.*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
@@ -64,24 +65,17 @@
|
||||
</resource>
|
||||
</resources>
|
||||
</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>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.5.0</version>
|
||||
<version>4.5.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
||||
@@ -30,10 +30,11 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||
@@ -43,20 +44,27 @@ import com.rammelkast.anticheatreloaded.event.PlayerListener;
|
||||
import com.rammelkast.anticheatreloaded.event.VehicleListener;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
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.VersionUtil;
|
||||
|
||||
public class AntiCheatReloaded extends JavaPlugin {
|
||||
|
||||
public static final List<UUID> MUTE_ENABLED_MODS = new ArrayList<UUID>();
|
||||
|
||||
private static AntiCheatManager manager;
|
||||
private static AntiCheatReloaded plugin;
|
||||
private static List<Listener> eventList = new ArrayList<Listener>();
|
||||
private static Configuration config;
|
||||
private static boolean verbose;
|
||||
private static boolean developer;
|
||||
private static ProtocolManager protocolManager;
|
||||
private static SecureRandom random;
|
||||
private static Long loadTime;
|
||||
private static UpdateManager updateManager;
|
||||
|
||||
private double tps = -1;
|
||||
private String symbiosisMetric = "None";
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -81,108 +89,83 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||
this.setupProtocol();
|
||||
} else {
|
||||
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + "Shutting down, ProtocolLib not found!");
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "Shutting down, ProtocolLib not found!");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
getLogger().info("NMS version is " + VersionUtil.getVersion());
|
||||
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
|
||||
BlinkCheck.startTimer();
|
||||
BlinkCheck.listenPackets();
|
||||
|
||||
// Check if other AC's are installed
|
||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||
public void run() {
|
||||
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running NoCheatPlus!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable NoCheatPlus to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Matrix") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running Matrix!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable NoCheatPlus to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running AAC!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable AAC to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running Spartan!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable AAC to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("NoAura") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running NoAura!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable AAC to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("AntiCheat") != null || Bukkit.getPluginManager().getPlugin("AntiCheatPlus") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running AntiCheat!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable AntiCheat to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
}
|
||||
}, 90L);
|
||||
getLogger().info("Enabling packet listeners");
|
||||
PacketListener.listenKeepAlivePackets();
|
||||
PacketListener.listenMovementPackets();
|
||||
|
||||
updateManager = new UpdateManager();
|
||||
|
||||
// End tests
|
||||
verboseLog("Finished loading.");
|
||||
|
||||
// Metrics
|
||||
try {
|
||||
Metrics metrics = new Metrics(this, 202);
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
int kicked = playersKicked;
|
||||
// Reset so we don't keep sending the same value
|
||||
playersKicked = 0;
|
||||
return kicked;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations", new Callable<Integer>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
int violations = glideViolations;
|
||||
// Reset so we don't keep sending the same value
|
||||
glideViolations = 0;
|
||||
return violations;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return VersionUtil.getVersion();
|
||||
getServer().getScheduler().runTaskLater(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
checkForSymbiosis();
|
||||
try {
|
||||
Metrics metrics = new Metrics(AntiCheatReloaded.this, 202);
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked", new Callable<Integer>() {
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
int kicked = playersKicked;
|
||||
// Reset so we don't keep sending the same value
|
||||
playersKicked = 0;
|
||||
return kicked;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return VersionUtil.getVersion();
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("symbiosis", new Callable<String>() {
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
return symbiosisMetric;
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 90L);
|
||||
|
||||
// Launch TPS check
|
||||
new BukkitRunnable() {
|
||||
long sec;
|
||||
long currentSec;
|
||||
int ticks;
|
||||
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,19 +242,11 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
manager = null;
|
||||
config = null;
|
||||
}
|
||||
|
||||
public static boolean developerMode() {
|
||||
return developer;
|
||||
}
|
||||
|
||||
public static void setDeveloperMode(boolean b) {
|
||||
developer = b;
|
||||
}
|
||||
|
||||
|
||||
public static void debugLog(final String string) {
|
||||
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
||||
public void run() {
|
||||
if (developer) {
|
||||
if (getManager().getConfiguration().getConfig().debugMode.getValue()) {
|
||||
manager.debugLog("[DEBUG] " + string);
|
||||
}
|
||||
}
|
||||
@@ -300,21 +275,77 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
* Amount of players kicked since start
|
||||
*/
|
||||
private int playersKicked = 0;
|
||||
/**
|
||||
* Amount of glide violations since start
|
||||
*/
|
||||
private int glideViolations = 0;
|
||||
|
||||
public void onPlayerKicked() {
|
||||
this.playersKicked++;
|
||||
}
|
||||
|
||||
public void onGlideViolation() {
|
||||
this.glideViolations++;
|
||||
/**
|
||||
* Creates metric that checks for anti-cheat symbiosis
|
||||
* I use this to see if AntiCheatReloaded is actively being used
|
||||
* together with other anti-cheats, so I can account for that.
|
||||
*/
|
||||
protected void checkForSymbiosis() {
|
||||
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "NoCheatPlus";
|
||||
} else {
|
||||
this.symbiosisMetric += ", NoCheatPlus";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Matrix") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "Matrix";
|
||||
} else {
|
||||
this.symbiosisMetric += ", Matrix";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "AAC";
|
||||
} else {
|
||||
this.symbiosisMetric += ", AAC";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "Spartan";
|
||||
} else {
|
||||
this.symbiosisMetric += ", Spartan";
|
||||
}
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("Negativity") != null) {
|
||||
if (this.symbiosisMetric.equals("None")) {
|
||||
this.symbiosisMetric = "Negativity";
|
||||
} else {
|
||||
this.symbiosisMetric += ", Negativity";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendToMainThread(Runnable runnable) {
|
||||
Bukkit.getServer().getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
||||
Bukkit.getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
||||
}
|
||||
|
||||
public void sendToStaff(String message) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
if (player.hasPermission("anticheat.system.alert")) {
|
||||
if (!MUTE_ENABLED_MODS.contains(player.getUniqueId())) {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static UpdateManager getUpdateManager() {
|
||||
return updateManager;
|
||||
}
|
||||
|
||||
public double getTPS() {
|
||||
if (this.tps < 0 || this.tps > 20) {
|
||||
return 20;
|
||||
}
|
||||
return this.tps;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,5 +62,9 @@ public class CheckFailEvent extends Event {
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -36,11 +36,8 @@ import java.util.UUID;
|
||||
*/
|
||||
|
||||
public enum CheckType {
|
||||
ZOMBE_FLY(Permission.CHECK_ZOMBE_FLY),
|
||||
ZOMBE_NOCLIP(Permission.CHECK_ZOMBE_NOCLIP),
|
||||
ZOMBE_CHEAT(Permission.CHECK_ZOMBE_CHEAT),
|
||||
FLIGHT(Permission.CHECK_FLIGHT),
|
||||
ELYTRA(Permission.CHECK_FLIGHT),
|
||||
ELYTRAFLY(Permission.CHECK_FLIGHT),
|
||||
WATER_WALK(Permission.CHECK_WATERWALK),
|
||||
NO_SWING(Permission.CHECK_NOSWING),
|
||||
FAST_BREAK(Permission.CHECK_FASTBREAK),
|
||||
@@ -56,17 +53,21 @@ public enum CheckType {
|
||||
FAST_BOW(Permission.CHECK_FASTBOW),
|
||||
FAST_EAT(Permission.CHECK_FASTEAT),
|
||||
FAST_HEAL(Permission.CHECK_FASTHEAL),
|
||||
FORCEFIELD(Permission.CHECK_FORCEFIELD),
|
||||
KILLAURA(Permission.CHECK_KILLAURA),
|
||||
LONG_REACH(Permission.CHECK_LONGREACH),
|
||||
FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE),
|
||||
ITEM_SPAM(Permission.CHECK_ITEMSPAM),
|
||||
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
|
||||
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
||||
BLINK(Permission.CHECK_BLINK),
|
||||
MOREPACKETS(Permission.CHECK_MOREPACKETS),
|
||||
BADPACKETS(Permission.CHECK_BADPACKETS),
|
||||
VELOCITY(Permission.CHECK_VELOCITY),
|
||||
CRITICALS(Permission.CHECK_CRITICALS),
|
||||
CHAT_UNICODE(Permission.CHECK_UNICODE);
|
||||
|
||||
CHAT_UNICODE(Permission.CHECK_UNICODE),
|
||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGAL_INTERACT),
|
||||
FASTLADDER(Permission.CHECK_FASTLADDER),
|
||||
AIMBOT(Permission.CHECK_AIMBOT);
|
||||
|
||||
private final Permission permission;
|
||||
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
|
||||
|
||||
@@ -126,8 +127,19 @@ public enum CheckType {
|
||||
* @return reference name
|
||||
*/
|
||||
public static String getName(CheckType type) {
|
||||
char[] chars = type.toString().replaceAll("_", " ").toLowerCase().toCharArray();
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
return new String(chars);
|
||||
if (type.name().contains("_")) {
|
||||
String[] split = type.name().toLowerCase().split("_");
|
||||
String name = "";
|
||||
for (String part : split) {
|
||||
char[] chars = part.toCharArray();
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
name += new String(chars);
|
||||
}
|
||||
return name;
|
||||
} else {
|
||||
char[] chars = type.name().toLowerCase().toCharArray();
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
return new String(chars);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,7 @@ public class CriticalsCheck {
|
||||
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);
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
p.getName() + " failed Criticals, tried to do a critical without needed conditions")
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||
.getMessage(),
|
||||
p, CheckType.CRITICALS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
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.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
|
||||
public class KillAuraCheck {
|
||||
|
||||
// Angle check
|
||||
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity living = (LivingEntity) entity;
|
||||
Location eyeLocation = player.getEyeLocation();
|
||||
|
||||
double yawDifference = calculateYawDifference(eyeLocation, living.getLocation());
|
||||
double playerYaw = player.getEyeLocation().getYaw();
|
||||
|
||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_DIFFERENCE()) {
|
||||
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
||||
ANGLE_FLAGS.put(uuid, 1);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
int flags = ANGLE_FLAGS.get(uuid);
|
||||
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
||||
ANGLE_FLAGS.remove(uuid);
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||
}
|
||||
|
||||
ANGLE_FLAGS.put(uuid, flags + 1);
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -33,42 +33,41 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
/*
|
||||
* TODO improve
|
||||
*/
|
||||
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) {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
|
||||
public static void runCheck(EntityDamageByEntityEvent e, final Player p) {
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
|
||||
|| AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
||||
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
|
||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
|
||||
return;
|
||||
final Location then = p.getLocation();
|
||||
final Location then = player.getLocation();
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!p.isOnline())
|
||||
if (!player.isOnline())
|
||||
return;
|
||||
if (then.distance(p.getLocation()) < 0.125) {
|
||||
if (!VL_COUNT.containsKey(p.getUniqueId()))
|
||||
VL_COUNT.put(p.getUniqueId(), 1);
|
||||
if (then.distance(player.getLocation()) < 0.125) {
|
||||
if (!VIOLATIONS.containsKey(player.getUniqueId()))
|
||||
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||
else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_AMT()) {
|
||||
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);
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||
if (VIOLATIONS.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_MAX_FLAGS()) {
|
||||
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 {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
VIOLATIONS.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
|
||||
public class AimbotCheck {
|
||||
|
||||
public static final Map<UUID, Float> LAST_DELTA_YAW = new HashMap<UUID, Float>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (backend.isMovingExempt(player)) {
|
||||
return PASS;
|
||||
}
|
||||
UUID uuid = player.getUniqueId();
|
||||
float dYaw = Math.abs(event.getTo().getYaw() - event.getFrom().getYaw());
|
||||
float dPitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
||||
// Not interesting
|
||||
if (dYaw < 0.05 && dPitch < 0.05) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
final float lastDeltaYaw = LAST_DELTA_YAW.getOrDefault(uuid, -1F);
|
||||
if (lastDeltaYaw == -1F) {
|
||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
||||
return PASS;
|
||||
}
|
||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
||||
|
||||
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
||||
if (absoluteYawDifference < 1E-8 && dYaw > 30 && dYaw < 355) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @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)) {
|
||||
int ping = VersionUtil.getPlayerPing(p);
|
||||
int blinkMagic = AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().BLINK_PACKET();
|
||||
float pingLeniency = (float) ((ping / 120));
|
||||
if (pingLeniency < 1) pingLeniency = 1;
|
||||
if (pingLeniency > 3) pingLeniency = 3;
|
||||
blinkMagic = Math.round(pingLeniency * blinkMagic);
|
||||
final float finalPingLeniency = pingLeniency;
|
||||
try {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > blinkMagic) {
|
||||
final int packets = MOVE_COUNT.get(p.getUniqueId());
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED, p.getName()
|
||||
+ " failed Blink, sent " + packets
|
||||
+ " packets in one second (max=" + AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().BLINK_PACKET()
|
||||
+ ", leniency=" + finalPingLeniency + ", ping=" + ping + ")").getMessage(),
|
||||
p, CheckType.BLINK);
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (NullPointerException nullPointer) {
|
||||
// TODO this is thrown sometimes, might have something to do with line 83
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,39 +19,73 @@
|
||||
|
||||
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.block.BlockFace;
|
||||
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.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
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 (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
&& Utilities.cantStandAtExp(player.getLocation())
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||
Material.fence, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARS })) {
|
||||
|
||||
}*/
|
||||
//TODO 1.15 update
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class FastLadderCheck {
|
||||
|
||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, double y) {
|
||||
Magic magic = AntiCheatReloaded.getManager().getBackend().getMagic();
|
||||
// Only check if fully on ladder
|
||||
// Liquids are climbable blocks, so we have to add a seperate check
|
||||
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||
|| !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||
|| player.getLocation().getBlock().isLiquid()) {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
int vlCount = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||
if (y > 0) {
|
||||
// Check moving up
|
||||
double max = magic.LADDER_Y_MAX();
|
||||
// Check if going faster than max Y climbing speed
|
||||
if (y - max > 0) {
|
||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
||||
vlCount = 0;
|
||||
return new CheckResult(Result.FAILED,
|
||||
"tried to climb up too fast (speed=" + y + ", max=" + max + ")");
|
||||
}
|
||||
} else {
|
||||
if (vlCount > 0)
|
||||
vlCount--;
|
||||
}
|
||||
} else if (y < 0) {
|
||||
// Check moving down
|
||||
if (Math.abs(y) > magic.LADDER_DOWN_MAX() + 6E-9) {
|
||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
||||
vlCount = 0;
|
||||
return new CheckResult(Result.FAILED, "tried to climb down too fast (speed=" + Math.abs(y)
|
||||
+ ", max=" + magic.LADDER_DOWN_MAX() + ")");
|
||||
}
|
||||
} else {
|
||||
if (vlCount > 0)
|
||||
vlCount--;
|
||||
}
|
||||
} else {
|
||||
if (vlCount > 0)
|
||||
vlCount--;
|
||||
}
|
||||
|
||||
VIOLATIONS.put(player.getUniqueId(), vlCount);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -24,10 +23,13 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
@@ -40,6 +42,7 @@ 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);
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
@@ -55,12 +58,9 @@ public class FlightCheck {
|
||||
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
&& Utilities.cantStandAtExp(player.getLocation())
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Material.IRON_BARS })
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN), new String[] {
|
||||
"FENCE",
|
||||
"FENCE_GATE"
|
||||
})) {
|
||||
|
||||
new Material[] { Utilities.IRON_BARS })
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new String[] { "FENCE", "FENCE_GATE" })) {
|
||||
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
|
||||
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
||||
}
|
||||
@@ -72,21 +72,55 @@ public class FlightCheck {
|
||||
BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) - distance.getYDifference()));
|
||||
}
|
||||
|
||||
if (BLOCKS_OVER_FLIGHT.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT()
|
||||
&& (y1 <= y2)) {
|
||||
if (BLOCKS_OVER_FLIGHT.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.FLIGHT_BLOCK_LIMIT() && (y1 <= y2)) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
|
||||
"flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
|
||||
}
|
||||
} else {
|
||||
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.isNearWater(player) && !VersionUtil.isFlying(player)
|
||||
&& !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
|
||||
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
|
||||
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
|
||||
// TODO isMoveUpBlock does not seem to be a success with stairs
|
||||
// I suddenly could not replicate this, man this check is a mess
|
||||
if (y1 < y2) {
|
||||
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
|
||||
&& !block.getRelative(BlockFace.EAST).isLiquid()
|
||||
&& !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;
|
||||
}
|
||||
|
||||
public static boolean isMovingExempt(Player player) {
|
||||
return isDoing(player, MOVING_EXEMPT, -1);
|
||||
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
|
||||
}
|
||||
|
||||
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
||||
|
||||
@@ -36,63 +36,68 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class GlideCheck {
|
||||
|
||||
public static final Map<UUID, Double> LAST_DIFFERENCE = new HashMap<UUID, Double>();
|
||||
public static final Map<UUID, Double> LAST_MOTION_Y = new HashMap<UUID, Double>();
|
||||
public static final Map<UUID, Float> LAST_FALL_DISTANCE = new HashMap<UUID, Float>();
|
||||
public static final Map<UUID, Integer> AIR_TICKS = new HashMap<UUID, Integer>();
|
||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (player.getLocation().getBlock().getType() == Material.LADDER
|
||||
|| player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
||||
return PASS;
|
||||
}
|
||||
if (!LAST_DIFFERENCE.containsKey(player.getUniqueId())) {
|
||||
LAST_DIFFERENCE.put(player.getUniqueId(), distance.getYDifference());
|
||||
|
||||
if (!LAST_MOTION_Y.containsKey(player.getUniqueId())) {
|
||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
||||
return PASS;
|
||||
}
|
||||
|
||||
if (!LAST_FALL_DISTANCE.containsKey(player.getUniqueId())) {
|
||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
||||
return PASS;
|
||||
}
|
||||
double yDiff = distance.getYDifference();
|
||||
|
||||
int violations = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||
double motionY = distance.getYDifference();
|
||||
float fallDistance = player.getFallDistance();
|
||||
if (yDiff == LAST_DIFFERENCE.get(player.getUniqueId())
|
||||
if (motionY == LAST_MOTION_Y.get(player.getUniqueId())
|
||||
&& fallDistance > LAST_FALL_DISTANCE.get(player.getUniqueId())) {
|
||||
if (!VIOLATIONS.containsKey(player.getUniqueId())) {
|
||||
VIOLATIONS.put(player.getUniqueId(), 1);
|
||||
} else {
|
||||
if (VIOLATIONS.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.GLIDE_LIMIT()) {
|
||||
VIOLATIONS.remove(player.getUniqueId());
|
||||
Location to = player.getLocation();
|
||||
to.setY(to.getY() - distanceToFall(to));
|
||||
player.teleport(to);
|
||||
// Report glide violation to statistics, just for the lulz jk
|
||||
AntiCheatReloaded.getPlugin().onGlideViolation();
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " was set back for gliding (yDiff="
|
||||
+ new BigDecimal(yDiff).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||
} else {
|
||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(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 {
|
||||
VIOLATIONS.put(player.getUniqueId(), violations + 1);
|
||||
return PASS;
|
||||
}
|
||||
} else {
|
||||
// TODO more sophisticated check
|
||||
// TODO redo this
|
||||
}
|
||||
LAST_DIFFERENCE.put(player.getUniqueId(), distance.getYDifference());
|
||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
||||
if (violations > Math.round(AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT() / 2)) {
|
||||
VIOLATIONS.put(player.getUniqueId(), violations - 1);
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private static double distanceToFall(Location location) {
|
||||
location = location.clone();
|
||||
double firstY = location.getY();
|
||||
while (location.clone().add(0, -0.1, 0).getBlock().getType() == Material.AIR)
|
||||
location.add(0, -0.1, 0);
|
||||
return firstY - location.getY();
|
||||
double highestY = location.getWorld().getHighestBlockYAt(location) + 1.02D;
|
||||
return location.getY() - highestY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,65 +23,86 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* This check is an outdated mess which needs to be replaced
|
||||
*/
|
||||
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);
|
||||
|
||||
public static boolean isSpeedExempt(Player player) {
|
||||
return AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)
|
||||
|| AntiCheatReloaded.getManager().getBackend().justVelocity(player) || VersionUtil.isFlying(player);
|
||||
public static boolean isSpeedExempt(Player player, Backend backend) {
|
||||
return backend.isMovingExempt(player) || backend.justVelocity(player) || VersionUtil.isFlying(player);
|
||||
}
|
||||
|
||||
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 = "";
|
||||
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.isSprinting()) {
|
||||
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)) {
|
||||
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 {
|
||||
reason = "on soulsand ";
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
|
||||
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND();
|
||||
}
|
||||
} else if (VersionUtil.isFlying(player)) {
|
||||
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)) {
|
||||
if (player.isSprinting()) {
|
||||
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 {
|
||||
reason = "with speed potion ";
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION();
|
||||
max = backend.getMagic().XZ_SPEED_MAX_POTION();
|
||||
}
|
||||
} else if (player.isSprinting()) {
|
||||
reason = "while sprinting ";
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
|
||||
String blockDownName = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().name();
|
||||
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();
|
||||
max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;
|
||||
|
||||
if (x > max || z > max) {
|
||||
int num = AntiCheatReloaded.getManager().getBackend().increment(player, SPEED_VIOLATIONS,
|
||||
AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX());
|
||||
if (num >= AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX()) {
|
||||
int num = backend.increment(player, SPEED_VIOLATIONS, backend.getMagic().SPEED_MAX());
|
||||
if (num >= backend.getMagic().SPEED_MAX()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + "'s speed was too high " + reason + num + " times in a row (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX() + ", speed="
|
||||
+ (x > z ? x : z) + ", max speed=" + max + ")");
|
||||
"speed was too high " + reason + num + " times in a row (max="
|
||||
+ backend.getMagic().SPEED_MAX() + ", speed=" + (x > z ? x : z) + ", max speed="
|
||||
+ max + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -94,4 +115,21 @@ public class SpeedCheck {
|
||||
}
|
||||
}
|
||||
|
||||
public static CheckResult checkYSpeed(Player player, Distance distance) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
if (!backend.isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping()
|
||||
&& (distance.getYDifference() > backend.getMagic().Y_SPEED_MAX())
|
||||
&& !backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_TIME())
|
||||
&& !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)
|
||||
&& !VersionUtil.isRiptiding(player)
|
||||
&& !Utilities.isNearBed(distance.getTo())
|
||||
&& !Utilities.isSlime(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||
.getGoodLocation(player.getLocation()).getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"y speed was too high (speed=" + distance.getYDifference() + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,18 +25,18 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
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 {
|
||||
|
||||
@@ -47,6 +47,7 @@ public class WaterWalkCheck {
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
Block block = player.getLocation().getBlock();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
@@ -55,32 +56,27 @@ public class WaterWalkCheck {
|
||||
if (IS_IN_WATER.contains(uuid)) {
|
||||
if (IS_IN_WATER_CACHE.contains(uuid)) {
|
||||
if (player.getNearbyEntities(1, 1, 1).isEmpty()) {
|
||||
boolean b;
|
||||
boolean violation;
|
||||
if (!Utilities.sprintFly(player)) {
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER()
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER();
|
||||
violation = x > backend.getMagic().XZ_SPEED_MAX_WATER()
|
||||
|| z > backend.getMagic().XZ_SPEED_MAX_WATER();
|
||||
} else {
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER_SPRINT()
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER_SPRINT();
|
||||
violation = x > backend.getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
||||
|| z > backend.getMagic().XZ_SPEED_MAX_WATER_SPRINT();
|
||||
}
|
||||
if (!b && !Utilities.isFullyInWater(player.getLocation())
|
||||
if (!violation && !Utilities.isFullyInWater(player.getLocation())
|
||||
&& Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D
|
||||
&& !block.getType().equals(Material.LILY_PAD)) {
|
||||
b = true;
|
||||
&& !block.getType().equals(Utilities.LILY_PAD)) {
|
||||
violation = true;
|
||||
}
|
||||
if (b) {
|
||||
if (violation) {
|
||||
if (WATER_SPEED_VIOLATIONS.containsKey(uuid)) {
|
||||
int v = WATER_SPEED_VIOLATIONS.get(uuid);
|
||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.WATER_SPEED_VIOLATION_MAX()) {
|
||||
if (v >= backend.getMagic().WATER_SPEED_VIOLATION_MAX()) {
|
||||
WATER_SPEED_VIOLATIONS.put(uuid, 0);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " stood on water " + v + " times (can't stand on "
|
||||
+ block.getType() + " or "
|
||||
+ block.getRelative(BlockFace.DOWN).getType() + ")");
|
||||
"stood on water " + v + " times (can't stand on " + block.getType()
|
||||
+ " or " + block.getRelative(BlockFace.DOWN).getType() + ")");
|
||||
} else {
|
||||
WATER_SPEED_VIOLATIONS.put(uuid, v + 1);
|
||||
}
|
||||
@@ -97,16 +93,17 @@ public class WaterWalkCheck {
|
||||
IS_IN_WATER.add(uuid);
|
||||
return PASS;
|
||||
}
|
||||
} else if (block.getRelative(BlockFace.DOWN).isLiquid()
|
||||
&& !AntiCheatReloaded.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block)
|
||||
&& Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))) {
|
||||
} else if (block.getRelative(BlockFace.DOWN).isLiquid() && !backend.isAscending(player)
|
||||
&& Utilities.cantStandAt(block) && Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))
|
||||
&& (y < 0.025 || y == 0.09999999999999964 || y == 0.14999999999999947
|
||||
|| y == 0.04999999999999982)) {
|
||||
if (WATER_ASCENSION_VIOLATIONS.containsKey(uuid)) {
|
||||
int v = WATER_ASCENSION_VIOLATIONS.get(uuid);
|
||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
||||
if (v >= backend.getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
||||
WATER_ASCENSION_VIOLATIONS.put(uuid, 0);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " stood on water " + v + " times (can't stand on " + block.getType()
|
||||
+ " or " + block.getRelative(BlockFace.DOWN).getType() + ")");
|
||||
"stood on water " + v + " times (can't stand on " + block.getType() + " or "
|
||||
+ block.getRelative(BlockFace.DOWN).getType() + ")");
|
||||
} else {
|
||||
WATER_ASCENSION_VIOLATIONS.put(uuid, v + 1);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ public class YAxisCheck {
|
||||
if (y1 > LAST_Y_COORD_CACHE.get(uuid)
|
||||
&& Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) < AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) < AntiCheatReloaded
|
||||
.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||
Location g = player.getLocation();
|
||||
Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1);
|
||||
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
|
||||
@@ -82,7 +82,7 @@ public class YAxisCheck {
|
||||
}
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max ="
|
||||
"tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
|
||||
} else {
|
||||
if (Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
@@ -95,7 +95,7 @@ public class YAxisCheck {
|
||||
}
|
||||
long i = System.currentTimeMillis() - LAST_Y_TIME.get(uuid);
|
||||
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 - LAST_Y_COORD_CACHE.get(uuid)) > diff
|
||||
&& i < AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME()) {
|
||||
Location g = player.getLocation();
|
||||
@@ -107,11 +107,11 @@ public class YAxisCheck {
|
||||
player.teleport(g);
|
||||
}
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis in "
|
||||
+ i + " ms (min =" + AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to fly on y-axis in " + i + " ms (min="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")");
|
||||
} else {
|
||||
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
||||
+ 1
|
||||
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.Y_MAXDIFF() + 1
|
||||
|| (System.currentTimeMillis() - LAST_Y_TIME.get(uuid)) > AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().Y_TIME()) {
|
||||
LAST_Y_TIME.put(uuid, System.currentTimeMillis());
|
||||
@@ -125,8 +125,7 @@ public class YAxisCheck {
|
||||
}
|
||||
|
||||
public static boolean isMoveUpBlock(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("STAIRS"); // TODO slabs/others?
|
||||
return Utilities.isStair(block);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
public class BadPacketsCheck {
|
||||
|
||||
public static void runCheck(Player player, PacketEvent event) {
|
||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||
// Confirm if we should even check for BadPackets
|
||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS) || backend.isMovingExempt(player)) {
|
||||
return;
|
||||
}
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
PacketContainer packet = event.getPacket();
|
||||
float pitch = packet.getFloat().read(1);
|
||||
// Check for derp
|
||||
if (Math.abs(pitch) > 90) {
|
||||
flag(player, event, "had an illegal pitch");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO more precise checking for this
|
||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||
if (user.isLagging() || tps < 18) {
|
||||
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,97 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.packet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
*/
|
||||
public class MorePacketsCheck {
|
||||
|
||||
public static final Map<UUID, Long> LAST_PACKET_TIME = new HashMap<UUID, Long>();
|
||||
public static final Map<UUID, Long> EXEMPT_TIMINGS = new HashMap<UUID, Long>();
|
||||
public static final Map<UUID, Double> PACKET_BALANCE = new HashMap<UUID, Double>();
|
||||
|
||||
public static void runCheck(Player player, PacketEvent event) {
|
||||
// Confirm if we should even check for MorePackets
|
||||
// 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;
|
||||
}
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)) {
|
||||
return;
|
||||
}
|
||||
long packetTimeNow = System.currentTimeMillis();
|
||||
long lastPacketTime = LAST_PACKET_TIME.getOrDefault(uuid, packetTimeNow - 50L);
|
||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||
|
||||
long rate = packetTimeNow - lastPacketTime;
|
||||
packetBalance += 50;
|
||||
packetBalance -= rate;
|
||||
if (packetBalance >= magic.MOREPACKETS_TRIGGER_BALANCE()) {
|
||||
int ticks = (int) Math.round(packetBalance / 50);
|
||||
packetBalance = -1 * (magic.MOREPACKETS_TRIGGER_BALANCE() / 2);
|
||||
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
||||
} else if (packetBalance < -1 * (magic.MOREPACKETS_MINIMUM_CLAMP())) {
|
||||
// Clamp minimum, 50ms=1tick of lag leniency
|
||||
packetBalance = -1 * (magic.MOREPACKETS_MINIMUM_CLAMP());
|
||||
}
|
||||
|
||||
LAST_PACKET_TIME.put(uuid, packetTimeNow);
|
||||
PACKET_BALANCE.put(uuid, packetBalance);
|
||||
}
|
||||
|
||||
private static void flag(Player player, PacketEvent event, String message) {
|
||||
event.setCancelled(true);
|
||||
// We are currently not in the main server thread, so switch
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||
CheckType.MOREPACKETS);
|
||||
player.teleport(player.getLocation());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void compensate(Player player) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||
PACKET_BALANCE.put(uuid, packetBalance - magic.MOREPACKETS_TELEPORT_COMPENSATION());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class CommandBase {
|
||||
public static final ChatColor AQUA = ChatColor.AQUA;
|
||||
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 MENU_END = "-----------------------------------------------------";
|
||||
public static final String MENU_END = GOLD + "-----------------------------------------------------";
|
||||
|
||||
private final String name;
|
||||
private final String command;
|
||||
@@ -65,7 +65,11 @@ public class CommandBase {
|
||||
if (permission.get(cs)) {
|
||||
execute(cs, args);
|
||||
} 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 + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,9 +78,9 @@ public class CommandBase {
|
||||
}
|
||||
|
||||
public void sendHelp(CommandSender cs) {
|
||||
cs.sendMessage(RED + "== " + GRAY + getName() + RED + " ==");
|
||||
cs.sendMessage(RED + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage());
|
||||
cs.sendMessage(RED + "Permission: " + GRAY + getPermission().toString());
|
||||
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + ChatColor.GRAY + "Help Menu");
|
||||
cs.sendMessage(GOLD + "Usage: " + GRAY + (cs instanceof Player ? "/" : "") + getUsage());
|
||||
cs.sendMessage(GOLD + "Permission: " + GRAY + getPermission().toString());
|
||||
for (String string : getHelp()) {
|
||||
cs.sendMessage(string);
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandDeveloper;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
||||
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.CommandReport;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandReset;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandVersion;
|
||||
|
||||
public class CommandHandler implements CommandExecutor {
|
||||
|
||||
@@ -41,11 +42,12 @@ public class CommandHandler implements CommandExecutor {
|
||||
public CommandHandler() {
|
||||
commands.add(new CommandHelp());
|
||||
commands.add(new CommandCheck());
|
||||
commands.add(new CommandDeveloper());
|
||||
commands.add(new CommandLog());
|
||||
commands.add(new CommandReload());
|
||||
commands.add(new CommandReport());
|
||||
commands.add(new CommandMute());
|
||||
commands.add(new CommandReset());
|
||||
commands.add(new CommandVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.List;
|
||||
|
||||
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 USAGE = "anticheat check [check] [on/off]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.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"));
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,14 @@ public class CommandHelp extends CommandBase {
|
||||
private static final String USAGE = "anticheat help";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_HELP;
|
||||
private static final String[] HELP = {
|
||||
RED + "/acr " + GRAY + "help",
|
||||
RED + "/acr " + GRAY + "reload",
|
||||
RED + "/acr " + GRAY + "update",
|
||||
RED + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
||||
RED + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
||||
RED + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
||||
RED + "/acr " + GRAY + "reset " + WHITE + "[user]",
|
||||
GOLD + "/acr " + GRAY + "help",
|
||||
GOLD + "/acr " + GRAY + "reload",
|
||||
GOLD + "/acr " + GRAY + "version",
|
||||
GOLD + "/acr " + GRAY + "mute",
|
||||
GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
||||
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
||||
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
||||
GOLD + "/acr " + GRAY + "reset " + WHITE + "[user]",
|
||||
};
|
||||
|
||||
public CommandHelp() {
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
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 USAGE = "anticheat log [file/console] [on/off]";
|
||||
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 mute";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_MUTE;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
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 USAGE = "anticheat reload";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_RELOAD;
|
||||
|
||||
+25
-29
@@ -19,6 +19,10 @@
|
||||
|
||||
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.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -27,23 +31,21 @@ import org.bukkit.entity.Player;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
import com.rammelkast.anticheatreloaded.util.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import com.rammelkast.anticheatreloaded.util.Group;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
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 USAGE = "anticheat report [group/user]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
|
||||
private static final String[] HELP = {
|
||||
GRAY + "Use: " + AQUA + "/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: " + AQUA + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
|
||||
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
||||
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
||||
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
|
||||
};
|
||||
|
||||
public CommandReport() {
|
||||
@@ -71,7 +73,7 @@ public class CommandReport extends CommandBase {
|
||||
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
||||
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 {
|
||||
// Test groups
|
||||
for (Group group : CONFIG.getGroups().getGroups()) {
|
||||
@@ -80,6 +82,12 @@ public class CommandReport extends CommandBase {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Player targetPlayer = Bukkit.getPlayer(args[0]);
|
||||
if (targetPlayer == null) {
|
||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
// Test users
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
@@ -104,7 +112,7 @@ public class CommandReport extends CommandBase {
|
||||
String groupName = group == null ? "Low" : group.getName();
|
||||
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
||||
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);
|
||||
for (int x = 0; x < 7; x++) {
|
||||
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
||||
@@ -116,7 +124,7 @@ public class CommandReport extends CommandBase {
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
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 + "There are no users in this group.");
|
||||
cs.sendMessage(MENU_END);
|
||||
@@ -147,8 +155,9 @@ public class CommandReport extends CommandBase {
|
||||
groupString += " (" + user.getLevel() + ")";
|
||||
|
||||
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 + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
for (int x = 0; x < 6; x++) {
|
||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||
@@ -167,8 +176,9 @@ public class CommandReport extends CommandBase {
|
||||
cs.sendMessage(MENU_END);
|
||||
} else {
|
||||
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 + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||
cs.sendMessage(MENU_END);
|
||||
@@ -176,19 +186,5 @@ public class CommandReport extends CommandBase {
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ package com.rammelkast.anticheatreloaded.command.executors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
@@ -30,7 +29,7 @@ import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
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 USAGE = "anticheat reset [user]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_RESET;
|
||||
@@ -42,6 +41,7 @@ public class CommandReset extends CommandBase {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
User user;
|
||||
@@ -55,7 +55,7 @@ public class CommandReset extends CommandBase {
|
||||
user.resetLevel();
|
||||
user.clearMessages();
|
||||
AntiCheatReloaded.getManager().getBackend().resetChatLevel(user);
|
||||
cs.sendMessage(args[0] + GREEN + " has been reset.");
|
||||
cs.sendMessage(GOLD + args[0] + GRAY + " has been reset.");
|
||||
} else {
|
||||
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 + ".");
|
||||
}
|
||||
}
|
||||
@@ -57,10 +57,13 @@ public class Configuration {
|
||||
// Now load others
|
||||
enterprise = new Enterprise(plugin, this);
|
||||
|
||||
flatfiles = new ArrayList<ConfigurationFile>() {{
|
||||
add(config);
|
||||
add(enterprise);
|
||||
}};
|
||||
flatfiles = new ArrayList<ConfigurationFile>() {
|
||||
private static final long serialVersionUID = 4497798966909062852L;
|
||||
{
|
||||
add(config);
|
||||
add(enterprise);
|
||||
}
|
||||
};
|
||||
|
||||
dbfiles = new ArrayList<ConfigurationTable>();
|
||||
|
||||
|
||||
@@ -170,7 +170,8 @@ public class ConfigurationFile {
|
||||
return path;
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getValue() {
|
||||
return (T) value;
|
||||
}
|
||||
|
||||
@@ -180,7 +181,8 @@ public class ConfigurationFile {
|
||||
return value;
|
||||
}
|
||||
|
||||
public T getDefaultValue() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public T getDefaultValue() {
|
||||
return (T) getDefaultConfigFile().get(path);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ public class ConfigurationTable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void convertToUUID(String colName) {
|
||||
String sqlSelect = "SELECT " + colName + " FROM " + getFullTable();
|
||||
String sqlUpdate = "UPDATE " + getFullTable() + " SET " + colName + " = ? WHERE " + colName + " = ?";
|
||||
|
||||
@@ -33,9 +33,9 @@ public class Config extends ConfigurationFile {
|
||||
public ConfigValue<Boolean> verboseStartup;
|
||||
public ConfigValue<Boolean> silentMode;
|
||||
public ConfigValue<Boolean> exemptOp;
|
||||
|
||||
public ConfigValue<Boolean> eventChains;
|
||||
public ConfigValue<Boolean> enterprise;
|
||||
public ConfigValue<Boolean> debugMode;
|
||||
|
||||
public ConfigValue<Boolean> blockChatSpamSpeed;
|
||||
public ConfigValue<Boolean> blockCommandSpamSpeed;
|
||||
@@ -50,6 +50,8 @@ public class Config extends ConfigurationFile {
|
||||
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
public ConfigValue<List<String>> disabledChecks;
|
||||
|
||||
public ConfigValue<Integer> notifyEveryVl;
|
||||
|
||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
@@ -64,6 +66,7 @@ public class Config extends ConfigurationFile {
|
||||
exemptOp = new ConfigValue<Boolean>("system.exempt-op");
|
||||
eventChains = new ConfigValue<Boolean>("system.event-chains");
|
||||
enterprise = new ConfigValue<Boolean>("system.enterprise");
|
||||
debugMode = new ConfigValue<Boolean>("system.debug-mode");
|
||||
|
||||
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
|
||||
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
|
||||
@@ -79,5 +82,10 @@ public class Config extends ConfigurationFile {
|
||||
|
||||
disabledWorlds = new ConfigValue<List<String>>("disable-in");
|
||||
disabledChecks = new ConfigValue<List<String>>("disabled-checks");
|
||||
|
||||
notifyEveryVl = new ConfigValue<Integer>("system.notify-every-vl");
|
||||
if (notifyEveryVl.getValue() < 1) {
|
||||
notifyEveryVl.setValue(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -74,6 +74,6 @@ public class YamlLevelsHolder extends ConfigurationFile implements Levels {
|
||||
}
|
||||
|
||||
private void saveLevel(UUID uuid, int level) {
|
||||
new ConfigValue<Integer>(uuid.toString(), false).setValue(new Integer(level));
|
||||
new ConfigValue<Integer>(uuid.toString(), false).setValue(level);
|
||||
}
|
||||
}
|
||||
@@ -154,10 +154,6 @@ public interface Magic {
|
||||
* Number of chat spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -235,7 +231,7 @@ public interface Magic {
|
||||
*/
|
||||
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();
|
||||
/**
|
||||
@@ -245,7 +241,7 @@ public interface Magic {
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@@ -263,7 +259,7 @@ public interface Magic {
|
||||
*/
|
||||
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();
|
||||
/**
|
||||
@@ -271,11 +267,11 @@ public interface Magic {
|
||||
*/
|
||||
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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
@@ -286,6 +282,10 @@ public interface Magic {
|
||||
* Minimum speed a player on a ladder can travel; Type=DOUBLE, Leniency=DECREASE.
|
||||
*/
|
||||
public double LADDER_Y_MIN();
|
||||
/**
|
||||
* Maximum speed a player on a ladder can travel downwards
|
||||
*/
|
||||
public double LADDER_DOWN_MAX();
|
||||
/**
|
||||
* Maximum speed a player can travel up; Type=DOUBLE, Leniency=INCREASE.
|
||||
*/
|
||||
@@ -354,28 +354,52 @@ public interface Magic {
|
||||
* The minimum time it should have taken for the player to click X times; Type=INTEGER; Leniency=INCREASE.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
public int TELEPORT_MIN();
|
||||
/**
|
||||
* Maximum amount of times a player can hit a killaura bot; Type=INTEGER, Leniency=INCREASE.
|
||||
* The amount of milliseconds to compensate for a teleport; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int KILLAURA_BOTHITS();
|
||||
public int MOREPACKETS_TELEPORT_COMPENSATION();
|
||||
/**
|
||||
* Maximum amount of packets a player can send in a second; Type=INTEGER, Leniency=INCREASE.
|
||||
* The amount of milliseconds that were offset to flag for MorePackets; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int BLINK_PACKET();
|
||||
public int MOREPACKETS_TRIGGER_BALANCE();
|
||||
/**
|
||||
* Maximum amount of low/zero velocity before flagging; Type=INTEGER, Leniency=INCREASE.
|
||||
* The maximum amount of overall lag compensating in milliseconds; Type=INTEGER, Leniency=INCREASE.
|
||||
*/
|
||||
public int VELOCITY_AMT();
|
||||
public int MOREPACKETS_MINIMUM_CLAMP();
|
||||
/**
|
||||
* 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 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();
|
||||
/**
|
||||
* Maximum amount of fastladder movements before flagging; TYPE=INTEGER, Leniency=INCREASE
|
||||
*/
|
||||
public int FASTLADDER_MAX_FLAGS();
|
||||
/**
|
||||
* The change milliseconds between two keepalives before considering a player to be lagging; TYPE=INTEGER, Leniency=DECREASE
|
||||
*/
|
||||
public int LAG_DETERMINATION();
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
@@ -55,17 +56,28 @@ public class BlockListener extends EventListener {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
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);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_PLACE);
|
||||
} else {
|
||||
decrease(player);
|
||||
getBackend().logBlockPlace(player);
|
||||
}
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -74,32 +86,38 @@ public class BlockListener extends EventListener {
|
||||
final Player player = event.getPlayer();
|
||||
final Block block = event.getBlock();
|
||||
boolean noHack = true;
|
||||
if (player != null) {
|
||||
CheckResult result;
|
||||
if (getCheckManager().willCheck(player, CheckType.FAST_BREAK)) {
|
||||
result = getBackend().checkFastBreak(player, block);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_BREAK);
|
||||
noHack = false;
|
||||
}
|
||||
CheckResult result;
|
||||
if (getCheckManager().willCheck(player, CheckType.FAST_BREAK)) {
|
||||
result = getBackend().checkFastBreak(player, block);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FAST_BREAK);
|
||||
noHack = false;
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.NO_SWING)) {
|
||||
result = getBackend().checkSwing(player, block);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.NO_SWING);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.NO_SWING)) {
|
||||
result = getBackend().checkSwing(player, block);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.NO_SWING);
|
||||
noHack = false;
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.LONG_REACH)) {
|
||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
||||
result = getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.LONG_REACH);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.LONG_REACH)) {
|
||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
||||
result = getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
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) {
|
||||
|
||||
@@ -36,8 +36,10 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class EntityListener extends EventListener {
|
||||
|
||||
@@ -113,7 +115,7 @@ public class EntityListener extends EventListener {
|
||||
if (e.getDamager() instanceof Player) {
|
||||
Player p = (Player) e.getDamager();
|
||||
getBackend().logDamage(p, 1);
|
||||
int value = p.getInventory().getItemInMainHand().containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
||||
int value = VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
||||
getBackend().logDamage(player, value);
|
||||
if (getCheckManager().willCheck(p, CheckType.LONG_REACH)) {
|
||||
Distance distance = new Distance(player.getLocation(), p.getLocation());
|
||||
@@ -143,19 +145,19 @@ public class EntityListener extends EventListener {
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.FORCEFIELD)) {
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = getBackend().checkSprintDamage(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FORCEFIELD);
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.FORCEFIELD)) {
|
||||
CheckResult result = getBackend().checkSight(player, e.getEntity());
|
||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.FORCEFIELD);
|
||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
|
||||
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.event.Listener;
|
||||
|
||||
@@ -26,117 +33,149 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
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 java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class EventListener implements Listener {
|
||||
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 CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
||||
private static final Backend BACKEND = AntiCheatReloaded.getManager().getBackend();
|
||||
private static final AntiCheatReloaded PLUGIN = AntiCheatReloaded.getManager().getPlugin();
|
||||
private static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||
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 CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
||||
private static final Backend BACKEND = AntiCheatReloaded.getManager().getBackend();
|
||||
private static final AntiCheatReloaded PLUGIN = AntiCheatReloaded.getManager().getPlugin();
|
||||
private static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
||||
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) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
if (user == null)
|
||||
return;
|
||||
|
||||
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
|
||||
int vlForType = type.getUses(player.getUniqueId()) + 1;
|
||||
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
|
||||
if (message == null || message.equals("")) {
|
||||
if (debugMode) {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type);
|
||||
} else {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.GOLD + " (x" + vlForType + ")";
|
||||
}
|
||||
} else {
|
||||
if (debugMode) {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
} else {
|
||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
||||
+ CheckType.getName(type) + ChatColor.GOLD + " (x" + vlForType + ")" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||
}
|
||||
}
|
||||
|
||||
logCheat(type, user);
|
||||
if (user.increaseLevel(type) && (!debugMode && vlForType % notifyEveryVl == 0)) {
|
||||
AntiCheatReloaded.getManager().log(message);
|
||||
}
|
||||
removeDecrease(user);
|
||||
|
||||
public static void log(String message, Player player, CheckType type) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
if (user != null) { // npc
|
||||
logCheat(type, user);
|
||||
if (user.increaseLevel(type) && message != null) {
|
||||
AntiCheatReloaded.getManager().log(message);
|
||||
}
|
||||
removeDecrease(user);
|
||||
}
|
||||
}
|
||||
if (debugMode) {
|
||||
player.sendMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (vlForType % notifyEveryVl == 0) {
|
||||
AntiCheatReloaded.getPlugin().sendToStaff(message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void logCheat(CheckType type, User user) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void logCheat(CheckType type, User user) {
|
||||
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 void resetCheck(CheckType type) {
|
||||
USAGE_LIST.put(type, 0);
|
||||
}
|
||||
public void resetCheck(CheckType type) {
|
||||
USAGE_LIST.put(type, 0);
|
||||
}
|
||||
|
||||
public static int getCheats(CheckType type) {
|
||||
int x = 0;
|
||||
if (USAGE_LIST.get(type) != null) {
|
||||
x = USAGE_LIST.get(type);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
public static int getCheats(CheckType type) {
|
||||
int x = 0;
|
||||
if (USAGE_LIST.get(type) != null) {
|
||||
x = USAGE_LIST.get(type);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
private static void removeDecrease(User user) {
|
||||
int x = 0;
|
||||
// Ignore plugins that are creating NPCs with no names
|
||||
if (user.getUUID() != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
private static void removeDecrease(User user) {
|
||||
int x = 0;
|
||||
// Ignore plugins that are creating NPCs with no names
|
||||
if (user.getUUID() != null) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public static void decrease(Player player) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
// Ignore plugins that are creating NPCs with no names
|
||||
if (user.getUUID() != null) {
|
||||
int x = 0;
|
||||
public static void decrease(Player player) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
// Ignore plugins that are creating NPCs with no names
|
||||
if (user.getUUID() != null) {
|
||||
int x = 0;
|
||||
|
||||
if (DECREASE_LIST.get(user.getUUID()) != null) {
|
||||
x = DECREASE_LIST.get(user.getUUID());
|
||||
}
|
||||
if (DECREASE_LIST.get(user.getUUID()) != null) {
|
||||
x = DECREASE_LIST.get(user.getUUID());
|
||||
}
|
||||
|
||||
x += 1;
|
||||
DECREASE_LIST.put(user.getUUID(), x);
|
||||
x += 1;
|
||||
DECREASE_LIST.put(user.getUUID(), x);
|
||||
|
||||
if (x >= 10) {
|
||||
user.decreaseLevel();
|
||||
DECREASE_LIST.put(user.getUUID(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (x >= 10) {
|
||||
user.decreaseLevel();
|
||||
DECREASE_LIST.put(user.getUUID(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static CheckManager getCheckManager() {
|
||||
return CHECK_MANAGER;
|
||||
}
|
||||
public static CheckManager getCheckManager() {
|
||||
return CHECK_MANAGER;
|
||||
}
|
||||
|
||||
public static AntiCheatManager getManager() {
|
||||
return AntiCheatReloaded.getManager();
|
||||
}
|
||||
public static AntiCheatManager getManager() {
|
||||
return AntiCheatReloaded.getManager();
|
||||
}
|
||||
|
||||
public static Backend getBackend() {
|
||||
return BACKEND;
|
||||
}
|
||||
public static Backend getBackend() {
|
||||
return BACKEND;
|
||||
}
|
||||
|
||||
public static UserManager getUserManager() {
|
||||
return USER_MANAGER;
|
||||
}
|
||||
public static UserManager getUserManager() {
|
||||
return USER_MANAGER;
|
||||
}
|
||||
|
||||
public static AntiCheatReloaded getPlugin() {
|
||||
return PLUGIN;
|
||||
}
|
||||
public static AntiCheatReloaded getPlugin() {
|
||||
return PLUGIN;
|
||||
}
|
||||
|
||||
public static Configuration getConfig() {
|
||||
return CONFIG;
|
||||
}
|
||||
public static Configuration getConfig() {
|
||||
return CONFIG;
|
||||
}
|
||||
|
||||
public static boolean silentMode() {
|
||||
return CONFIG.getConfig().silentMode.getValue();
|
||||
}
|
||||
public static boolean silentMode() {
|
||||
return CONFIG.getConfig().silentMode.getValue();
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
@@ -44,18 +43,24 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||
@@ -76,7 +81,8 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
if (!silentMode()) player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
if (!silentMode())
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||
getBackend().processCommandSpammer(player);
|
||||
log(null, player, CheckType.COMMAND_SPAM);
|
||||
}
|
||||
@@ -142,8 +148,16 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.isSneaking()) {
|
||||
getBackend().logToggleSneak(event.getPlayer());
|
||||
if (getCheckManager().willCheck(player, CheckType.SNEAK)) {
|
||||
CheckResult result = getBackend().checkSneakToggle(player);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.SNEAK);
|
||||
}
|
||||
}
|
||||
// getBackend().logToggleSneak(event.getPlayer());
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
@@ -172,7 +186,7 @@ public class PlayerListener extends EventListener {
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
if (!result.getMessage().equals("") && !silentMode()) {
|
||||
player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||
}
|
||||
getBackend().processChatSpammer(player);
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@@ -188,7 +202,7 @@ public class PlayerListener extends EventListener {
|
||||
CheckResult result = getBackend().checkChatUnicode(player, event.getMessage());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -243,11 +257,28 @@ public class PlayerListener extends EventListener {
|
||||
Player player = event.getPlayer();
|
||||
PlayerInventory inv = player.getInventory();
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if (inv.getItemInMainHand().getType() == Material.BOW) {
|
||||
ItemStack itemInHand;
|
||||
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);
|
||||
} else if (Utilities.isFood(inv.getItemInMainHand().getType()) || Utilities.isFood(inv.getItemInOffHand().getType())) {
|
||||
} else if (Utilities.isFood(itemInHand.getType()) || Utilities.isFood(itemInHand.getType())) {
|
||||
getBackend().logEatingStart(player);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -297,17 +328,6 @@ public class PlayerListener extends EventListener {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
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);
|
||||
|
||||
User user = new User(player.getUniqueId());
|
||||
@@ -315,15 +335,11 @@ public class PlayerListener extends EventListener {
|
||||
getConfig().getLevels().loadLevelToUser(user);
|
||||
getUserManager().addUser(user);
|
||||
|
||||
if (player.hasMetadata(Utilities.SPY_METADATA)) {
|
||||
for (Player p : player.getServer().getOnlinePlayers()) {
|
||||
if (!Permission.SYSTEM_SPY.get(p)) {
|
||||
p.hidePlayer(AntiCheatReloaded.getPlugin(), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -340,16 +356,6 @@ public class PlayerListener extends EventListener {
|
||||
final User user = getUserManager().getUser(player.getUniqueId());
|
||||
user.setTo(to.getX(), to.getY(), to.getZ());
|
||||
|
||||
//KillAuraCheck.doMove(event);
|
||||
//TODO
|
||||
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPRINT)) {
|
||||
CheckResult result = getBackend().checkSprintStill(player, from, to);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.SPRINT);
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||
CheckResult result = FlightCheck.runCheck(player, distance);
|
||||
if (result.failed()) {
|
||||
@@ -362,14 +368,13 @@ public class PlayerListener extends EventListener {
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||
CheckResult result = GlideCheck.runCheck(player, distance);
|
||||
if (result.failed()) {
|
||||
// NO TELEPORT NEEDED HERE, HANDLED BY CHECK ITSELF
|
||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRA)) {
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
||||
CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||
if (result.failed()) {
|
||||
log(result.getMessage(), player, CheckType.ELYTRA);
|
||||
log(result.getMessage(), player, CheckType.ELYTRAFLY);
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) {
|
||||
@@ -393,7 +398,7 @@ public class PlayerListener extends EventListener {
|
||||
if (result.failed()) {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
/*TODO: player.damage(1); better system for this, too exploitable*/
|
||||
// TODO better handling of this
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.NOFALL);
|
||||
}
|
||||
@@ -405,7 +410,7 @@ public class PlayerListener extends EventListener {
|
||||
double z = distance.getZDifference();
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||
if (event.getFrom().getY() < event.getTo().getY()) {
|
||||
CheckResult result = getBackend().checkYSpeed(player, y);
|
||||
CheckResult result = SpeedCheck.checkYSpeed(player, distance);
|
||||
if (result.failed()) {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
@@ -434,7 +439,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
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 (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
@@ -454,18 +459,35 @@ public class PlayerListener extends EventListener {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||
// Does not use y value created before because that value is absolute
|
||||
CheckResult result = FastLadderCheck.runCheck(player, event.getTo().getY() - event.getFrom().getY());
|
||||
if (result.failed()) {
|
||||
if (!silentMode()) {
|
||||
event.setTo(user.getGoodLocation(from.clone()));
|
||||
}
|
||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (!changed) {
|
||||
user.setGoodLocation(event.getFrom());
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||
if (result.failed()) {
|
||||
log(result.getMessage(), player, CheckType.AIMBOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
public void onDeath(PlayerDeathEvent e) {
|
||||
//KillAuraCheck.cleanPlayer(e.getEntity()); // Remove bots on death to reduce lag
|
||||
//TODO
|
||||
public void onRespawn(PlayerRespawnEvent event) {
|
||||
getBackend().logTeleport(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
@@ -483,7 +505,7 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
if (getCheckManager().willCheck(player, CheckType.FLIGHT) && !player.isFlying()) {
|
||||
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() : "";
|
||||
if (!log.equals("")) {
|
||||
if (!silentMode()) {
|
||||
|
||||
@@ -27,44 +27,48 @@ import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class VehicleListener extends EventListener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleEnter(VehicleEnterEvent event) {
|
||||
if (event.getEntered() instanceof Player) {
|
||||
getBackend().logEnterExit((Player) event.getEntered());
|
||||
}
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleEnter(VehicleEnterEvent event) {
|
||||
if (event.getEntered() instanceof Player) {
|
||||
getBackend().logEnterExit((Player) event.getEntered());
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleExit(VehicleExitEvent event) {
|
||||
if (event.getExited() instanceof Player) {
|
||||
getBackend().logEnterExit((Player) event.getExited());
|
||||
}
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onVehicleExit(VehicleExitEvent event) {
|
||||
if (event.getExited() instanceof Player) {
|
||||
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)
|
||||
public void onVehicleDestroy(VehicleDestroyEvent event) {
|
||||
// TODO fix deprecations
|
||||
//if (event.getVehicle().getPassenger() != null && event.getVehicle().getPassenger() instanceof Player) {
|
||||
// getBackend().logEnterExit((Player) event.getVehicle().getPassenger());
|
||||
//}
|
||||
|
||||
// TODO this should work, untested though.
|
||||
if (!event.getVehicle().getPassengers().isEmpty()) {
|
||||
for (Entity entity: event.getVehicle().getPassengers()) {
|
||||
if (entity instanceof Player) {
|
||||
getBackend().logEnterExit((Player) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,11 @@
|
||||
* 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.
|
||||
* 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.manage;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -33,7 +32,6 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
/**
|
||||
* The internal hub for all managers.
|
||||
*/
|
||||
|
||||
public class AntiCheatManager {
|
||||
private static AntiCheatReloaded plugin = null;
|
||||
private static Configuration configuration;
|
||||
|
||||
@@ -19,20 +19,19 @@
|
||||
|
||||
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 com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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/>
|
||||
* The manager that AntiCheat will check with to see if it should watch certain checks and certain players.
|
||||
@@ -177,7 +176,6 @@ public class CheckManager {
|
||||
&& !isExempt(player, type)
|
||||
&& !type.checkPermission(player)
|
||||
&& !isOpExempt(player);
|
||||
AntiCheatReloaded.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
||||
if ((type == CheckType.FLIGHT || type == CheckType.SPEED) && VersionUtil.isFlying(player))
|
||||
return false;
|
||||
return check;
|
||||
|
||||
@@ -71,12 +71,12 @@ public class LoggingManager {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void logToConsole(String message) {
|
||||
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + message);
|
||||
Bukkit.getConsoleSender().sendMessage(message);
|
||||
}
|
||||
|
||||
public void logToFile(String message) {
|
||||
|
||||
@@ -36,12 +36,8 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class UserManager {
|
||||
private List<User> users = new ArrayList<User>();
|
||||
private static AntiCheatManager manager;
|
||||
private static Configuration config;
|
||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||
private static final ChatColor GOLD = ChatColor.GOLD;
|
||||
private static final ChatColor RED = ChatColor.RED;
|
||||
|
||||
private AntiCheatManager manager;
|
||||
private Configuration config;
|
||||
/**
|
||||
* Initialize the user manager
|
||||
*
|
||||
@@ -162,15 +158,6 @@ public class UserManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the alert to use for a check being failed
|
||||
*
|
||||
* @return check fail alert message
|
||||
*/
|
||||
public List<String> getAlert() {
|
||||
return config.getLang().ALERT();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire an alert
|
||||
*
|
||||
@@ -179,19 +166,6 @@ public class UserManager {
|
||||
* @param type The CheckType that triggered the alert
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -226,16 +200,16 @@ public class UserManager {
|
||||
}
|
||||
final String name = user.getName();
|
||||
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[")) {
|
||||
for (String cmd : Utilities.getCommands(event)) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);
|
||||
}
|
||||
} else if (event.equalsIgnoreCase("KICK")) {
|
||||
user.getPlayer().kickPlayer(RED + kickReason);
|
||||
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', kickReason));
|
||||
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("")) {
|
||||
manager.log(msg);
|
||||
manager.playerLog(msg);
|
||||
@@ -244,13 +218,13 @@ public class UserManager {
|
||||
List<String> message = warning;
|
||||
for (String string : message) {
|
||||
if (!string.equals("")) {
|
||||
user.getPlayer().sendMessage(RED + string);
|
||||
user.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', string));
|
||||
}
|
||||
}
|
||||
} else if (event.equalsIgnoreCase("BAN")) {
|
||||
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), RED + banReason, null, null);
|
||||
user.getPlayer().kickPlayer(RED + banReason);
|
||||
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
|
||||
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), ChatColor.translateAlternateColorCodes('&', banReason), null, null);
|
||||
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', banReason));
|
||||
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().BAN_BROADCAST().replaceAll("%player%", name) + " (" + CheckType.getName(type) + ")");
|
||||
if (!msg.equals("")) {
|
||||
manager.log(msg);
|
||||
manager.playerLog(msg);
|
||||
|
||||
@@ -59,7 +59,6 @@ import com.google.gson.JsonPrimitive;
|
||||
* <p>
|
||||
* Check out https://bStats.org/ to learn more about bStats!
|
||||
*/
|
||||
@SuppressWarnings({ "WeakerAccess", "unused" })
|
||||
public class Metrics {
|
||||
|
||||
static {
|
||||
|
||||
@@ -28,6 +28,9 @@ public class Distance {
|
||||
private final double XDiff;
|
||||
private final double YDiff;
|
||||
private final double ZDiff;
|
||||
|
||||
private final Location from;
|
||||
private final Location to;
|
||||
|
||||
public Distance(Location from, Location to) {
|
||||
l1Y = to.getY();
|
||||
@@ -36,6 +39,9 @@ public class Distance {
|
||||
XDiff = Math.abs(to.getX() - from.getX());
|
||||
ZDiff = Math.abs(to.getZ() - from.getZ());
|
||||
YDiff = Math.abs(l1Y - l2Y);
|
||||
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public double fromY() {
|
||||
@@ -57,4 +63,12 @@ public class Distance {
|
||||
public double getYDifference() {
|
||||
return YDiff;
|
||||
}
|
||||
|
||||
public Location getFrom() {
|
||||
return this.from;
|
||||
}
|
||||
|
||||
public Location getTo() {
|
||||
return this.to;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class NameGenerator {
|
||||
|
||||
private static final List<String> BEGIN = Arrays.asList(new String[] { "Pixel", "Pro", "NoHax", "Just", "That",
|
||||
"New", "Ultra", "Killer", "Swift", "Anarchy", "Yolo", "Rammel" });
|
||||
|
||||
private static final List<String> END = Arrays.asList(new String[] { "Gamer", "PvP", "JustYolo", "Gaming",
|
||||
"Minecraft", "Games", "Bawz", "Tech", "Noob", "Extra", "kast", "" + new Random().nextInt(100) });
|
||||
|
||||
public static String generateName() {
|
||||
Random r = new Random();
|
||||
String begin = BEGIN.get(r.nextInt(BEGIN.size() - 1));
|
||||
String end = END.get(r.nextInt(END.size() - 1));
|
||||
if (r.nextBoolean())
|
||||
return begin + end + r.nextInt(9);
|
||||
else
|
||||
return begin + end;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Compensate for teleport
|
||||
MorePacketsCheck.compensate(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,14 +23,13 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
public enum Permission {
|
||||
/* Check Nodes */
|
||||
CHECK_ZOMBE_FLY, CHECK_ZOMBE_NOCLIP, CHECK_ZOMBE_CHEAT, CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||
CHECK_FLIGHT, CHECK_ELYTRAFLY, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_FORCEFIELD, CHECK_LONGREACH,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_UNICODE,
|
||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT, CHECK_FASTLADDER, CHECK_AIMBOT,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_SPY, SYSTEM_HELP, SYSTEM_UPDATE, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD;
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD, SYSTEM_MUTE;
|
||||
|
||||
private static final String PERMISSION_ALL = "anticheat.*";
|
||||
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.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);
|
||||
} else if (version.endsWith("-PRE")) {
|
||||
version = version.substring(0, version.length() - 4);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,10 +48,14 @@ public class User {
|
||||
private Long[] messageTimes = new Long[2];
|
||||
private String[] commands = new String[2];
|
||||
private Long[] commandTimes = new Long[2];
|
||||
|
||||
|
||||
private boolean isWaitingOnLevelSync;
|
||||
private Timestamp levelSyncTimestamp;
|
||||
|
||||
private long lastServerPing, lastClientPong;
|
||||
private int ping = -1;
|
||||
private int lastPing = -1;
|
||||
|
||||
/**
|
||||
* Initialize an AntiCheat user
|
||||
*
|
||||
@@ -63,16 +67,6 @@ public class User {
|
||||
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize an AntiCheat user
|
||||
*
|
||||
* @param name Player's name
|
||||
*/
|
||||
/*
|
||||
* public User(String name) { this.uuid = Bukkit.getPlayer(name).getUniqueId();
|
||||
* this.name = name; this.id = getPlayer() != null && getPlayer().isOnline() ?
|
||||
* getPlayer().getEntityId() : -1; }
|
||||
*/
|
||||
/**
|
||||
* Get the player's UUID
|
||||
*
|
||||
@@ -429,8 +423,39 @@ public class User {
|
||||
return levelSyncTimestamp;
|
||||
}
|
||||
|
||||
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) > config.getMagic().LAG_DETERMINATION();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User {name = " + getName() + ", level = " + level + "}";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,13 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -29,39 +35,15 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class Utilities {
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
|
||||
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
||||
|
||||
public static final String SPY_METADATA = "ac-spydata";
|
||||
|
||||
/**
|
||||
* Send a hack level alert to players and console
|
||||
*
|
||||
* @param message List of strings to send as the alert
|
||||
*/
|
||||
public static void alert(List<String> message) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (Permission.SYSTEM_ALERT.get(player)) {
|
||||
for (String msg : message) {
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String msg : message) {
|
||||
AntiCheatReloaded.getManager().log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public static final Material LILY_PAD;
|
||||
public static final Material COB_WEB;
|
||||
public static final Material IRON_BARS;
|
||||
|
||||
/**
|
||||
* Check if only the block beneath them is standable (includes water + lava)
|
||||
@@ -70,7 +52,6 @@ public final class Utilities {
|
||||
* @return true if they cannot stand there
|
||||
*/
|
||||
public static boolean cantStandAtSingle(Block block) {
|
||||
// TODO: Implement Better to reduce false positives (done? lets test...)
|
||||
Block otherBlock = block.getLocation().add(0, -0.5, 0).getBlock();
|
||||
boolean center = otherBlock.getType() == Material.AIR;
|
||||
return center;
|
||||
@@ -131,6 +112,15 @@ public final class Utilities {
|
||||
return !(block.isLiquid() || block.getType() == Material.AIR);
|
||||
}
|
||||
|
||||
public static boolean isSlime(Block block) {
|
||||
return block.getType() == Material.SLIME_BLOCK;
|
||||
}
|
||||
|
||||
public static boolean isNotNearSlime(Block block) {
|
||||
return !isSlime(block.getRelative(BlockFace.NORTH)) && !isSlime(block.getRelative(BlockFace.EAST))
|
||||
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST)) && !isSlime(block.getRelative(BlockFace.DOWN));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is fully submerged in water
|
||||
*
|
||||
@@ -228,7 +218,29 @@ public final class Utilities {
|
||||
public static boolean isSlab(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("SLAB");
|
||||
// TODO does this even work?
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is a bed
|
||||
*
|
||||
* @param block block to bed
|
||||
* @return true if bed
|
||||
*/
|
||||
public static boolean isBed(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("BED");
|
||||
}
|
||||
|
||||
public static boolean isNearBed(Location location) {
|
||||
return isBed(location.getBlock())
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.WEST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +252,6 @@ public final class Utilities {
|
||||
public static boolean isStair(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("STAIRS");
|
||||
// TODO does this even work?
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,12 +272,10 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isOnLilyPad(Player player) {
|
||||
Block block = player.getLocation().getBlock();
|
||||
Material lily = Material.LILY_PAD;
|
||||
// TODO: Can we fix X this?
|
||||
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily
|
||||
|| block.getRelative(BlockFace.SOUTH).getType() == lily
|
||||
|| block.getRelative(BlockFace.EAST).getType() == lily
|
||||
|| block.getRelative(BlockFace.WEST).getType() == lily;
|
||||
return block.getType() == LILY_PAD || block.getRelative(BlockFace.NORTH).getType() == LILY_PAD
|
||||
|| block.getRelative(BlockFace.SOUTH).getType() == LILY_PAD
|
||||
|| block.getRelative(BlockFace.EAST).getType() == LILY_PAD
|
||||
|| block.getRelative(BlockFace.WEST).getType() == LILY_PAD;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,6 +300,26 @@ public final class Utilities {
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is near a liquid block
|
||||
*
|
||||
* @param player player to check
|
||||
* @return true if near liquid block
|
||||
*/
|
||||
public static boolean isNearWater(Player player) {
|
||||
return player.getLocation().getBlock().isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.WEST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH_EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH_WEST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is in a web
|
||||
@@ -299,9 +328,25 @@ public final class Utilities {
|
||||
* @return true if in web
|
||||
*/
|
||||
public static boolean isInWeb(Player player) {
|
||||
return player.getLocation().getBlock().getType() == Material.COBWEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COBWEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.COBWEB;
|
||||
return player.getLocation().getBlock().getType() == COB_WEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == COB_WEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == COB_WEB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is near a climbable block
|
||||
*
|
||||
* @param player player to check
|
||||
* @return true if near climbable block
|
||||
*/
|
||||
public static boolean isNearClimbable(Player player) {
|
||||
return isClimbableBlock(player.getLocation().getBlock())
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.DOWN))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.UP))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.EAST))
|
||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,8 +356,7 @@ public final class Utilities {
|
||||
* @return true if climbable
|
||||
*/
|
||||
public static boolean isClimbableBlock(Block block) {
|
||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER
|
||||
|| block.getType() == Material.WATER;
|
||||
return CLIMBABLE.contains(block.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,14 +461,14 @@ public final class Utilities {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if a block ISN'T one of the specified types
|
||||
*
|
||||
* @param block block to check
|
||||
* @param endTypes array of possible name endings
|
||||
* @param block block to check
|
||||
* @param endTypes array of possible name endings
|
||||
* @return true if the block isn't any of the materials
|
||||
*/
|
||||
public static boolean blockIsnt(Block block, String[] endTypes) {
|
||||
@@ -434,7 +478,7 @@ public final class Utilities {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -481,6 +525,7 @@ public final class Utilities {
|
||||
*/
|
||||
public static ArrayList<String> stringToList(final String string) {
|
||||
return new ArrayList<String>() {
|
||||
private static final long serialVersionUID = 364115444874638230L;
|
||||
{
|
||||
add(string);
|
||||
}
|
||||
@@ -527,121 +572,294 @@ public final class Utilities {
|
||||
return seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code by Hawk Anticheat
|
||||
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
||||
*
|
||||
* @param a
|
||||
* @param b
|
||||
* @return the greatest common divisor between two floats
|
||||
*/
|
||||
public static float gcdRational(float a, float b) {
|
||||
if (a == 0) {
|
||||
return b;
|
||||
}
|
||||
int quotient = getIntQuotient(b, a);
|
||||
float remainder = ((b / a) - quotient) * a;
|
||||
if (Math.abs(remainder) < Math.max(a, b) * 1E-3F)
|
||||
remainder = 0;
|
||||
return gcdRational(remainder, a);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code by Hawk Anticheat
|
||||
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
||||
*
|
||||
* @param numbers
|
||||
* @return the greatest common divisor between a list of floats
|
||||
*/
|
||||
public static float gcdRational(List<Float> numbers) {
|
||||
float result = numbers.get(0);
|
||||
for (int i = 1; i < numbers.size(); i++) {
|
||||
result = gcdRational(numbers.get(i), result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code by Hawk Anticheat
|
||||
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
||||
*
|
||||
* @param dividend
|
||||
* @param divisor
|
||||
*/
|
||||
public static int getIntQuotient(float dividend, float divisor) {
|
||||
float ans = dividend / divisor;
|
||||
float error = Math.max(dividend, divisor) * 1E-3F;
|
||||
return (int) (ans + error);
|
||||
}
|
||||
|
||||
public static boolean isHoneyBlock(Block block) {
|
||||
if (!VersionUtil.isOfVersion("v1_15")) {
|
||||
return false;
|
||||
}
|
||||
return block.getType() == Material.HONEY_BLOCK;
|
||||
}
|
||||
|
||||
static {
|
||||
// START INSTANT BREAK MATERIALS
|
||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||
INSTANT_BREAK.add(Material.REPEATER);
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE_HOOK);
|
||||
INSTANT_BREAK.add(Material.FIRE);
|
||||
INSTANT_BREAK.add(Material.FLOWER_POT);
|
||||
INSTANT_BREAK.add(Material.INFESTED_CHISELED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_COBBLESTONE);
|
||||
INSTANT_BREAK.add(Material.INFESTED_CRACKED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_MOSSY_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_STONE);
|
||||
INSTANT_BREAK.add(Material.INFESTED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
INSTANT_BREAK.add(Material.SLIME_BLOCK);
|
||||
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
||||
INSTANT_BREAK.add(Material.CARROTS);
|
||||
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
||||
INSTANT_BREAK.add(Material.FERN);
|
||||
INSTANT_BREAK.add(Material.LARGE_FERN);
|
||||
INSTANT_BREAK.add(Material.CHORUS_FLOWER);
|
||||
INSTANT_BREAK.add(Material.CORNFLOWER);
|
||||
INSTANT_BREAK.add(Material.SUNFLOWER);
|
||||
INSTANT_BREAK.add(Material.LILY_PAD);
|
||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.ATTACHED_MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.NETHER_WART);
|
||||
INSTANT_BREAK.add(Material.POTATOES);
|
||||
INSTANT_BREAK.add(Material.PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.ATTACHED_PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.ACACIA_SAPLING);
|
||||
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
||||
INSTANT_BREAK.add(Material.BIRCH_SAPLING);
|
||||
INSTANT_BREAK.add(Material.DARK_OAK_SAPLING);
|
||||
INSTANT_BREAK.add(Material.JUNGLE_SAPLING);
|
||||
INSTANT_BREAK.add(Material.OAK_SAPLING);
|
||||
INSTANT_BREAK.add(Material.SPRUCE_SAPLING);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.TALL_GRASS);
|
||||
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
// END INSTANT BREAK MATERIALS
|
||||
// Start 1.8.8
|
||||
if (VersionUtil.isBountifulUpdate()) {
|
||||
LILY_PAD = XMaterial.LILY_PAD.parseMaterial();
|
||||
COB_WEB = XMaterial.COBWEB.parseMaterial();
|
||||
IRON_BARS = XMaterial.IRON_BARS.parseMaterial();
|
||||
|
||||
// START FOOD
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.BAKED_POTATO);
|
||||
FOOD.add(Material.BEETROOT);
|
||||
FOOD.add(Material.BEETROOT_SOUP);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.CAKE);
|
||||
FOOD.add(Material.CARROT);
|
||||
FOOD.add(Material.CHORUS_FRUIT);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_COD);
|
||||
FOOD.add(Material.COOKED_MUTTON);
|
||||
FOOD.add(Material.COOKED_PORKCHOP);
|
||||
FOOD.add(Material.COOKED_RABBIT);
|
||||
FOOD.add(Material.COOKED_SALMON);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.DRIED_KELP);
|
||||
FOOD.add(Material.ENCHANTED_GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_CARROT);
|
||||
FOOD.add(Material.HONEY_BOTTLE);
|
||||
FOOD.add(Material.MELON_SLICE);
|
||||
FOOD.add(Material.MUSHROOM_STEW);
|
||||
FOOD.add(Material.POISONOUS_POTATO);
|
||||
FOOD.add(Material.POTATO);
|
||||
FOOD.add(Material.PUFFERFISH);
|
||||
FOOD.add(Material.PUMPKIN_PIE);
|
||||
FOOD.add(Material.RABBIT_STEW);
|
||||
FOOD.add(Material.BEEF);
|
||||
FOOD.add(Material.CHICKEN);
|
||||
FOOD.add(Material.COD);
|
||||
FOOD.add(Material.MUTTON);
|
||||
FOOD.add(Material.PORKCHOP);
|
||||
FOOD.add(Material.RABBIT);
|
||||
FOOD.add(Material.SALMON);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.SUSPICIOUS_STEW);
|
||||
FOOD.add(Material.SWEET_BERRIES);
|
||||
FOOD.add(Material.TROPICAL_FISH);
|
||||
// END FOOD
|
||||
// Start instant break materials
|
||||
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
|
||||
INSTANT_BREAK.add(XMaterial.REPEATER.parseMaterial());
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(XMaterial.REDSTONE_TORCH.parseMaterial());
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE_HOOK);
|
||||
INSTANT_BREAK.add(Material.FIRE);
|
||||
INSTANT_BREAK.add(Material.FLOWER_POT);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
INSTANT_BREAK.add(Material.SLIME_BLOCK);
|
||||
INSTANT_BREAK.add(Material.CARROT);
|
||||
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
||||
INSTANT_BREAK.add(Material.GRASS);
|
||||
INSTANT_BREAK.add(XMaterial.TALL_GRASS.parseMaterial());
|
||||
INSTANT_BREAK.add(LILY_PAD);
|
||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(XMaterial.NETHER_WART.parseMaterial());
|
||||
INSTANT_BREAK.add(Material.POTATO);
|
||||
INSTANT_BREAK.add(Material.PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(XMaterial.OAK_SAPLING.parseMaterial());
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
// End instant break materials
|
||||
|
||||
// START COMBOS
|
||||
COMBO.put(Material.SHEARS, Material.BLACK_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.BLUE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.BROWN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.CYAN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.GRAY_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.GREEN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIGHT_BLUE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIGHT_GRAY_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIME_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.MAGENTA_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.MAGENTA_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.ORANGE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.PINK_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.PURPLE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.RED_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.WHITE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.YELLOW_WOOL);
|
||||
|
||||
COMBO.put(Material.IRON_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.DIAMOND_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.STONE_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
|
||||
// END COMBOS
|
||||
// Start food
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.BAKED_POTATO);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.CAKE);
|
||||
FOOD.add(Material.CARROT);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(XMaterial.COOKED_COD.parseMaterial());
|
||||
FOOD.add(XMaterial.COD.parseMaterial());
|
||||
FOOD.add(Material.COOKED_MUTTON);
|
||||
FOOD.add(XMaterial.COOKED_PORKCHOP.parseMaterial());
|
||||
FOOD.add(Material.COOKED_RABBIT);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_CARROT);
|
||||
FOOD.add(XMaterial.GLISTERING_MELON_SLICE.parseMaterial());
|
||||
FOOD.add(XMaterial.MUSHROOM_STEM.parseMaterial());
|
||||
FOOD.add(Material.POISONOUS_POTATO);
|
||||
FOOD.add(Material.POTATO);
|
||||
FOOD.add(Material.PUMPKIN_PIE);
|
||||
FOOD.add(Material.RABBIT_STEW);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(XMaterial.BEEF.parseMaterial());
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(XMaterial.CHICKEN.parseMaterial());
|
||||
FOOD.add(Material.MUTTON);
|
||||
FOOD.add(XMaterial.PORKCHOP.parseMaterial());
|
||||
FOOD.add(Material.RABBIT);
|
||||
FOOD.add(Material.COOKED_RABBIT);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
|
||||
// Start combos
|
||||
COMBO.put(Material.SHEARS, XMaterial.WHITE_WOOL.parseMaterial());
|
||||
|
||||
COMBO.put(Material.IRON_SWORD, COB_WEB);
|
||||
COMBO.put(Material.DIAMOND_SWORD, COB_WEB);
|
||||
COMBO.put(Material.STONE_SWORD, COB_WEB);
|
||||
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), COB_WEB);
|
||||
// End combos
|
||||
|
||||
// Start climbable
|
||||
CLIMBABLE.add(Material.VINE);
|
||||
CLIMBABLE.add(Material.LADDER);
|
||||
CLIMBABLE.add(Material.WATER);
|
||||
// End climbable
|
||||
}
|
||||
// End 1.8.8
|
||||
// Start other version
|
||||
else {
|
||||
LILY_PAD = Material.LILY_PAD;
|
||||
COB_WEB = Material.COBWEB;
|
||||
IRON_BARS = Material.IRON_BARS;
|
||||
|
||||
// Start instant break materials
|
||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||
INSTANT_BREAK.add(Material.REPEATER);
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE_HOOK);
|
||||
INSTANT_BREAK.add(Material.FIRE);
|
||||
INSTANT_BREAK.add(Material.FLOWER_POT);
|
||||
INSTANT_BREAK.add(Material.INFESTED_CHISELED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_COBBLESTONE);
|
||||
INSTANT_BREAK.add(Material.INFESTED_CRACKED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_MOSSY_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_STONE);
|
||||
INSTANT_BREAK.add(Material.INFESTED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
INSTANT_BREAK.add(Material.SLIME_BLOCK);
|
||||
INSTANT_BREAK.add(Material.CARROTS);
|
||||
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
||||
INSTANT_BREAK.add(Material.FERN);
|
||||
INSTANT_BREAK.add(Material.LARGE_FERN);
|
||||
INSTANT_BREAK.add(Material.CHORUS_FLOWER);
|
||||
INSTANT_BREAK.add(Material.SUNFLOWER);
|
||||
INSTANT_BREAK.add(Material.LILY_PAD);
|
||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.ATTACHED_MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.NETHER_WART);
|
||||
INSTANT_BREAK.add(Material.POTATOES);
|
||||
INSTANT_BREAK.add(Material.PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.ATTACHED_PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.ACACIA_SAPLING);
|
||||
INSTANT_BREAK.add(Material.BIRCH_SAPLING);
|
||||
INSTANT_BREAK.add(Material.DARK_OAK_SAPLING);
|
||||
INSTANT_BREAK.add(Material.JUNGLE_SAPLING);
|
||||
INSTANT_BREAK.add(Material.OAK_SAPLING);
|
||||
INSTANT_BREAK.add(Material.SPRUCE_SAPLING);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.TALL_GRASS);
|
||||
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
// Start 1.14 objects
|
||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
||||
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
||||
INSTANT_BREAK.add(Material.CORNFLOWER);
|
||||
}
|
||||
// End 1.14 objects
|
||||
// Start 1.15 objects
|
||||
if (VersionUtil.isOfVersion("v1_15")) {
|
||||
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
||||
}
|
||||
// End 1.15 objects
|
||||
// End instant break materials
|
||||
|
||||
// Start food
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.BAKED_POTATO);
|
||||
FOOD.add(Material.BEETROOT);
|
||||
FOOD.add(Material.BEETROOT_SOUP);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.CAKE);
|
||||
FOOD.add(Material.CARROT);
|
||||
FOOD.add(Material.CHORUS_FRUIT);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_COD);
|
||||
FOOD.add(Material.COOKED_MUTTON);
|
||||
FOOD.add(Material.COOKED_PORKCHOP);
|
||||
FOOD.add(Material.COOKED_RABBIT);
|
||||
FOOD.add(Material.COOKED_SALMON);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.DRIED_KELP);
|
||||
FOOD.add(Material.ENCHANTED_GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_CARROT);
|
||||
FOOD.add(Material.MELON_SLICE);
|
||||
FOOD.add(Material.MUSHROOM_STEW);
|
||||
FOOD.add(Material.POISONOUS_POTATO);
|
||||
FOOD.add(Material.POTATO);
|
||||
FOOD.add(Material.PUFFERFISH);
|
||||
FOOD.add(Material.PUMPKIN_PIE);
|
||||
FOOD.add(Material.RABBIT_STEW);
|
||||
FOOD.add(Material.BEEF);
|
||||
FOOD.add(Material.CHICKEN);
|
||||
FOOD.add(Material.COD);
|
||||
FOOD.add(Material.MUTTON);
|
||||
FOOD.add(Material.PORKCHOP);
|
||||
FOOD.add(Material.RABBIT);
|
||||
FOOD.add(Material.SALMON);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.TROPICAL_FISH);
|
||||
// Start 1.14 objects
|
||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
||||
FOOD.add(Material.SUSPICIOUS_STEW);
|
||||
FOOD.add(Material.SWEET_BERRIES);
|
||||
}
|
||||
// End 1.14 objects
|
||||
// Start 1.15 objects
|
||||
if (VersionUtil.isOfVersion("v1_15")) {
|
||||
FOOD.add(Material.HONEY_BOTTLE);
|
||||
}
|
||||
// End 1.15 objects
|
||||
// End food
|
||||
|
||||
// Start combos
|
||||
COMBO.put(Material.SHEARS, Material.BLACK_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.BLUE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.BROWN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.CYAN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.GRAY_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.GREEN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIGHT_BLUE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIGHT_GRAY_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIME_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.MAGENTA_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.MAGENTA_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.ORANGE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.PINK_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.PURPLE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.RED_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.WHITE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.YELLOW_WOOL);
|
||||
|
||||
COMBO.put(Material.IRON_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.DIAMOND_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.STONE_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
|
||||
// End combos
|
||||
|
||||
// Start climbable
|
||||
CLIMBABLE.add(Material.VINE);
|
||||
CLIMBABLE.add(Material.LADDER);
|
||||
CLIMBABLE.add(Material.WATER);
|
||||
// Start 1.14 objects
|
||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
||||
CLIMBABLE.add(Material.SCAFFOLDING);
|
||||
}
|
||||
// End 1.14 objects
|
||||
// End climbable
|
||||
}
|
||||
// End other versions
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,11 @@ package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -31,7 +34,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
public class VersionUtil {
|
||||
|
||||
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
||||
.asList(new String[] { "v1_15" });
|
||||
.asList(new String[] { "v1_15", "v1_14", "v1_13", "v1_8_R3" });
|
||||
|
||||
public static String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
@@ -46,22 +49,53 @@ public class VersionUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isOfVersion(String versionId) {
|
||||
if (getVersion().startsWith(versionId)) {
|
||||
return true;
|
||||
}
|
||||
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) {
|
||||
if (isBountifulUpdate()) {
|
||||
return p.isFlying();
|
||||
}
|
||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
||||
}
|
||||
|
||||
public static long getHealTime() {
|
||||
return 495;
|
||||
|
||||
public static boolean isRiptiding(Player player) {
|
||||
if (isBountifulUpdate()) {
|
||||
return false;
|
||||
}
|
||||
return player.isRiptiding();
|
||||
}
|
||||
|
||||
public static boolean isSlowFalling(Player player) {
|
||||
if (isBountifulUpdate()) {
|
||||
return false;
|
||||
}
|
||||
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
||||
}
|
||||
|
||||
public static boolean isFrostWalk(Player player) {
|
||||
if (player.getInventory().getBoots() == null) {
|
||||
if (player.getInventory().getBoots() == null || isBountifulUpdate()) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -75,4 +109,11 @@ public class VersionUtil {
|
||||
}
|
||||
}
|
||||
|
||||
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
@@ -72,7 +72,7 @@ import java.util.TreeMap;
|
||||
* <p/>
|
||||
* <b>Types of functions:</b><br />
|
||||
* - 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 />
|
||||
* <br /><br />
|
||||
* <p/>
|
||||
@@ -82,9 +82,9 @@ import java.util.TreeMap;
|
||||
*/
|
||||
public class Rule {
|
||||
|
||||
private static String string;
|
||||
private static final String VARIABLE_SET_REGEX = ".*(_).*=.*";
|
||||
private static final String FUNCTION_REGEX = ".*\\..*";
|
||||
private String string;
|
||||
private Type type;
|
||||
|
||||
public enum Type {
|
||||
@@ -129,7 +129,8 @@ public class Rule {
|
||||
* @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
|
||||
*/
|
||||
public static Rule load(String string) {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static Rule load(String string) {
|
||||
for (Type type : Type.values()) {
|
||||
if (type.matches(string)) {
|
||||
try {
|
||||
|
||||
@@ -30,6 +30,14 @@ system:
|
||||
event-chains: true
|
||||
# Should Enterprise options be enabled? Only set this to true if you're an advanced user.
|
||||
enterprise: false
|
||||
# Running AntiCheatReloaded in debug mode will send alerts to the cheating players and enable debug logging
|
||||
# Use this when locating and/or reporting false positives or when testing AntiCheatReloaded
|
||||
# Do NOT enable this in a production environment!
|
||||
debug-mode: false
|
||||
# To prevent spamming, staff and the console will only be notified every x violations
|
||||
# Minimum value is 1, default is 5
|
||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||
notify-every-vl: 5
|
||||
# Use /AntiCheatReloaded check for a list of valid checks
|
||||
disabled-checks:
|
||||
- EXAMPLE_CHECK
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# AntiCheat configuration file
|
||||
# Please report any bugs: https://github.com/gravitylow/AntiCheat/issues
|
||||
# AntiCheatReloaded configuration file
|
||||
# Server-specific settings
|
||||
server:
|
||||
# An identifiable name for this server
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
groups:
|
||||
- 'Medium : 20 : YELLOW : WARN'
|
||||
- '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
|
||||
ALERT:
|
||||
- '&player has just entered the &group hack group.'
|
||||
- '&player''s last failed check was: &check.'
|
||||
- 'Type ''/anticheat report &player'' for more information.'
|
||||
- '&c%player% has just entered the %group% hack group.'
|
||||
- '&c%player%''s last failed check was: %check%.'
|
||||
- '&cType ''/acr report %player%'' for more information.'
|
||||
WARNING:
|
||||
- '[AntiCheatReloaded] Hacking is not permitted.'
|
||||
- '[AntiCheatReloaded] If you continue to hack, action will be taken.'
|
||||
BAN_REASON: 'Banned by AntiCheatReloaded'
|
||||
BAN_BROADCAST: '&player was banned for hacking.'
|
||||
KICK_REASON: 'Kicked by AntiCheatReloaded'
|
||||
KICK_BROADCAST: '&player was kicked for hacking.'
|
||||
SPAM_WARNING: 'Stop spamming the server or you will be kicked!'
|
||||
SPAM_KICK_REASON: 'Kicked for spamming'
|
||||
SPAM_KICK_BROADCAST: '&player was kicked for spamming'
|
||||
SPAM_BAN_REASON: 'Banned for spamming'
|
||||
SPAM_BAN_BROADCAST: '&player was banned for spamming'
|
||||
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
||||
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
||||
BAN_REASON: '&6&lACR &8> &7Banned by AntiCheatReloaded'
|
||||
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
||||
KICK_REASON: '&6&lACR &8> &7Kicked for cheating'
|
||||
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
||||
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
||||
SPAM_KICK_REASON: '&cKicked for spamming'
|
||||
SPAM_KICK_BROADCAST: '&c%player% was kicked for spamming'
|
||||
SPAM_BAN_REASON: '&cBanned for spamming'
|
||||
SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
|
||||
+210
-28
@@ -1,98 +1,280 @@
|
||||
# AntiCheatReloaded configuration file
|
||||
#
|
||||
# This file is not yet fully documented
|
||||
# For more information on the undocumented values visit:
|
||||
# https://github.com/Rammelkast/AntiCheatReloaded/blob/master/src/main/java/com/rammelkast/anticheatreloaded/config/providers/Magic.java#L39-L380
|
||||
#
|
||||
# Maximum times a player can interact between animations
|
||||
# Changing this value of almost never required
|
||||
ANIMATION_INTERACT_MAX: 3
|
||||
# Minimum time between animations
|
||||
# Changing this value is almost never required
|
||||
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
|
||||
# Minimum time in between block breaks
|
||||
# Decrease in case of false positives
|
||||
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
|
||||
# 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
|
||||
# Minimum time in between block placing
|
||||
# Decrease in case of false positives
|
||||
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
|
||||
# Maximum percent error between predicted bow force and actual bow force
|
||||
# Increase in case of false positives
|
||||
BOW_ERROR: 0.25
|
||||
CHAT_ACTION_ONE_LEVEL: 3
|
||||
CHAT_ACTION_TWO_LEVEL: 5
|
||||
CHAT_MIN: 100
|
||||
CHAT_REPEAT_MIN: 260
|
||||
CHAT_WARN_LEVEL: 7
|
||||
COMMAND_ACTION_ONE_LEVEL: 3
|
||||
COMMAND_ACTION_TWO_LEVEL: 5
|
||||
COMMAND_MIN: 100
|
||||
COMMAND_REPEAT_MIN: 260
|
||||
# Number of chat spam violations before action one is executed
|
||||
# Should be changed to personal preference
|
||||
CHAT_ACTION_ONE_LEVEL: 5
|
||||
# Number of chat spam violations before action two is executed
|
||||
# Should be changed to personal preference
|
||||
CHAT_ACTION_TWO_LEVEL: 10
|
||||
# Minimum time between chats in milliseconds
|
||||
# Should be changed to personal preference
|
||||
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
|
||||
# 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
|
||||
# Minimum time it takes to drop X items
|
||||
# Changing this value is almost never required
|
||||
DROP_TIME_MIN: 800
|
||||
DROPPED_ITEM_TIME: 100
|
||||
# Minimum time in between eating
|
||||
# Decrease in case of false positives
|
||||
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
|
||||
# Maximum distance a player can damage an entity from
|
||||
# Changing this value is almost never required
|
||||
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
|
||||
# Time to exempt a player from moving because of exiting fly mode
|
||||
# Changing this value is almost never required
|
||||
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
|
||||
# Max number of blocks that can be broken in a given time
|
||||
# Increase in case of false positives
|
||||
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
|
||||
# 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
|
||||
# Time a player is forced to wait after fastbreak has been detected
|
||||
# Should be changed to personal preference
|
||||
FASTBREAK_MAXVIOLATIONTIME: 10000
|
||||
# Time to wait before checking block breaks
|
||||
# Increase in case of false positives
|
||||
FASTBREAK_TIMEMAX: 1000
|
||||
# Time to wait before checking block breaks for creative mode users
|
||||
# Increase in case of false positives
|
||||
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
|
||||
# Number of times fastplace can be observed before considering a creative player a cheater
|
||||
# Increase in case of false positives
|
||||
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
|
||||
# Minimum time in between block places
|
||||
# Decrease in case of false positives, but shouldn't be required
|
||||
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
|
||||
FLIGHT_BLOCK_LIMIT: 15.0
|
||||
FLIGHT_LIMIT: 150
|
||||
# How many blocks you can travel before being considered a cheater
|
||||
# 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
|
||||
# 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
|
||||
# The minimum time it should have taken for the player to click X times
|
||||
# Increase in case of false positives
|
||||
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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
NOFALL_LIMIT: 9
|
||||
# Maximum speed a player on a ladder can travel downwards
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
LADDER_DOWN_MAX: 0.15
|
||||
# Number of times a player can fail the nofall check before being considered a cheater
|
||||
# Can be decreased to improve detenction with the risk of false positives
|
||||
# Increase in case of false positives
|
||||
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
|
||||
# Minimum time it takes to fire X projectiles
|
||||
# Decrease in case of false positives
|
||||
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
|
||||
# Maximum times a player can fail the speed check before being considered a cheater
|
||||
# Increase in case of false positives
|
||||
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_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
|
||||
# Time to exempt a player from moving because of teleporting
|
||||
# Increase in case of false positives
|
||||
TELEPORT_TIME: 1000
|
||||
TIMER_STEP_CHECK: 50
|
||||
TIMER_TIMEMIN: 2000
|
||||
# Maximum time a player is considered to have a change in velocity
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_CHECKTIME: 2100
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_MAXTIMES: 2
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_PREVENT: 5000
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
VELOCITY_SCHETIME: 2
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
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_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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# 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
|
||||
# Time a player is forced to wait after flyhacking on the y-axis
|
||||
# Should be changed to personal preference
|
||||
Y_MAXVIOTIME: 5500
|
||||
# Maximum speed a player can travel up
|
||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||
Y_SPEED_MAX: 0.5175
|
||||
# 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
|
||||
# Amount of suspicious mid-air movements before a player is suspected of glide
|
||||
# Increase this in case of false positives
|
||||
GLIDE_LIMIT: 10
|
||||
# Maximum amount of movement packets allowed per second
|
||||
GLIDE_LIMIT: 5
|
||||
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||
# Increase this in case of false positives
|
||||
BLINK_PACKET: 25
|
||||
# Can be decreased in to tighten check
|
||||
MOREPACKETS_TELEPORT_COMPENSATION: 200
|
||||
# The amount of milliseconds that were offset to flag for MorePackets (50ms = 1 tick)
|
||||
# Increase this in case of false positives
|
||||
# Can be decreased in to tighten check
|
||||
MOREPACKETS_TRIGGER_BALANCE: 50
|
||||
# The maximum amount of overall lag compensating in milliseconds (50ms = 1 tick)
|
||||
# Increase this in case of false positives
|
||||
# Can be decreased in to tighten check
|
||||
MOREPACKETS_MINIMUM_CLAMP: 200
|
||||
# Maximum amount zero-velocity moments before a player is suspected
|
||||
# Increase this in case of false positives
|
||||
VELOCITY_AMT: 5
|
||||
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 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
|
||||
# Maximum amount of fastladder movements before flagging
|
||||
# Increase this in case of false positives
|
||||
FASTLADDER_MAX_FLAGS: 3
|
||||
# The change milliseconds between two keepalives before considering a player to be lagging
|
||||
# Decrease this in case of clientside lag-related false positives
|
||||
# Do not lower below 50 or increase above 75
|
||||
LAG_DETERMINATION: 60
|
||||
@@ -18,10 +18,10 @@ permissions:
|
||||
description: See alerts when a player might be cheating
|
||||
anticheat.system.help:
|
||||
description: Access the help message
|
||||
anticheat.system.mute:
|
||||
description: Access the mute function
|
||||
anticheat.system.report:
|
||||
description: Access cheat reports
|
||||
anticheat.system.spy:
|
||||
description: Access the spy system
|
||||
anticheat.mod:
|
||||
description: Mod helper perm
|
||||
children:
|
||||
@@ -29,19 +29,15 @@ permissions:
|
||||
anticheat.system.alert: true
|
||||
anticheat.system.help: true
|
||||
anticheat.system.report: true
|
||||
anticheat.system.spy: true
|
||||
anticheat.system.mute: true
|
||||
anticheat.system.log:
|
||||
description: Access turning console logging on or off
|
||||
anticheat.system.reload:
|
||||
description: Access reloading the system
|
||||
anticheat.system.reset:
|
||||
description: Access resetting a player's cheat level
|
||||
anticheat.system.update:
|
||||
anticheat.system.version:
|
||||
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:
|
||||
description: Admin helper perm
|
||||
children:
|
||||
@@ -49,23 +45,12 @@ permissions:
|
||||
anticheat.system.log: true
|
||||
anticheat.system.reload: true
|
||||
anticheat.system.reset: true
|
||||
anticheat.system.update: true
|
||||
anticheat.system.calibrate: true
|
||||
anticheat.system.debug: true
|
||||
anticheat.check.zombe.fly:
|
||||
description: Allow players to use zombe flymod
|
||||
default: false
|
||||
anticheat.check.zombe.noclip:
|
||||
description: Allow players to use zombe noclip hack
|
||||
default: false
|
||||
anticheat.check.zombe.cheat:
|
||||
description: Allow players to use zombe cheat hack
|
||||
default: false
|
||||
anticheat.system.mute: true
|
||||
anticheat.check.flight:
|
||||
description: Allow players to fly
|
||||
description: Allow players to use fly cheats
|
||||
default: false
|
||||
anticheat.check.elytra:
|
||||
description: Allow players to fly when using elytra
|
||||
anticheat.check.elytrafly:
|
||||
description: Allow players to use ElytraFly cheats
|
||||
default: false
|
||||
anticheat.check.waterwalk:
|
||||
description: Allow players to walk on water
|
||||
@@ -79,17 +64,23 @@ permissions:
|
||||
anticheat.check.fastplace:
|
||||
description: Allow players to use build hacks and fastplace
|
||||
default: false
|
||||
anticheat.check.spam:
|
||||
description: Allow players to spam the server
|
||||
anticheat.check.chatspam:
|
||||
description: Allow players to spam chat messages
|
||||
default: false
|
||||
anticheat.check.commandspam:
|
||||
description: Allow players to spam chat messages
|
||||
default: false
|
||||
anticheat.check.sprint:
|
||||
description: Allow players to sprint when hungry
|
||||
default: false
|
||||
anticheat.check.sneak:
|
||||
description: Allow players to use auto-sneak
|
||||
description: Allow players to use sneak hacks
|
||||
default: false
|
||||
anticheat.check.speed:
|
||||
description: Allow players to speed
|
||||
description: Allow players to use speed hacks
|
||||
default: false
|
||||
anticheat.check.vclip:
|
||||
description: Allow players clip through walls
|
||||
default: false
|
||||
anticheat.check.spider:
|
||||
description: Allow players to climb non-climbable surfaces
|
||||
@@ -106,32 +97,32 @@ permissions:
|
||||
anticheat.check.fastheal:
|
||||
description: Allow players to heal up instantly
|
||||
default: false
|
||||
anticheat.check.forcefield:
|
||||
description: Allow players to use a forcefield
|
||||
anticheat.check.killaura:
|
||||
description: Allow players to use killaura
|
||||
default: false
|
||||
anticheat.check.longreach:
|
||||
description: Allow players to use longreaching hacks
|
||||
default: false
|
||||
anticheat.check.projectile:
|
||||
description: Allow players to quickly launch projectiles
|
||||
anticheat.check.unicode:
|
||||
description: Allow players to use unicode in chat
|
||||
default: false
|
||||
anticheat.check.fastprojectile:
|
||||
description: Allow players to spam projectiles (fastbow etc.)
|
||||
default: false
|
||||
anticheat.check.itemspam:
|
||||
description: Allow players to use inventory drop spam hacks
|
||||
default: false
|
||||
anticheat.check.visual:
|
||||
description: Allow players to interact with objects out of their view
|
||||
default: false
|
||||
anticheat.check.vclip:
|
||||
description: Allow players to become slimeballs and clip down through blocks
|
||||
default: false
|
||||
anticheat.check.fastinventory:
|
||||
description: Allow players to use fastloot and similar inventory hacks
|
||||
default: false
|
||||
anticheat.check.autotool:
|
||||
description: Allow players to use autotool to switch tools quickly
|
||||
default: false
|
||||
anticheat.check.blink:
|
||||
description: Allow players to send lots of movement packets
|
||||
anticheat.check.morepackets:
|
||||
description: Allow players to send lots of movement packets or modify their timer
|
||||
default: false
|
||||
anticheat.check.badpackets:
|
||||
description: Allow players to send invalid movement packets
|
||||
default: false
|
||||
anticheat.check.velocity:
|
||||
description: Allow players to use knockback prevention
|
||||
@@ -139,40 +130,47 @@ permissions:
|
||||
anticheat.check.criticals:
|
||||
description: Allow players to use criticals
|
||||
default: false
|
||||
anticheat.check.unicode:
|
||||
description: Allow players to use unicode in chat
|
||||
anticheat.check.illegalinteract:
|
||||
description: Allow players to place blocks in illegal places
|
||||
default: false
|
||||
anticheat.check.fastladder:
|
||||
description: Allow players to climb ladders faster
|
||||
default: false
|
||||
anticheat.check.aimbot:
|
||||
description: Allow players to use aimbot
|
||||
default: false
|
||||
anticheat.check.exempt:
|
||||
description: Total exemption from checks
|
||||
default: false
|
||||
children:
|
||||
anticheat.check.zombe.fly: true
|
||||
anticheat.check.zombe.noclip: true
|
||||
anticheat.check.zombe.cheat: true
|
||||
anticheat.check.fly: true
|
||||
anticheat.check.flight: true
|
||||
anticheat.check.elytrafly: true
|
||||
anticheat.check.waterwalk: true
|
||||
anticheat.check.noswing: true
|
||||
anticheat.check.fastbreak: true
|
||||
anticheat.check.fastplace: true
|
||||
anticheat.check.spam: true
|
||||
anticheat.check.chatspam: true
|
||||
anticheat.check.commandspam: true
|
||||
anticheat.check.sprint: true
|
||||
anticheat.check.sneak: true
|
||||
anticheat.check.speed: true
|
||||
anticheat.check.vclip: true
|
||||
anticheat.check.spider: true
|
||||
anticheat.check.nofall: true
|
||||
anticheat.check.fastbow: true
|
||||
anticheat.check.fasteat: true
|
||||
anticheat.check.fastheal: true
|
||||
anticheat.check.forcefield: true
|
||||
anticheat.check.killaura: true
|
||||
anticheat.check.longreach: true
|
||||
anticheat.check.projectile: true
|
||||
anticheat.check.unicode: true
|
||||
anticheat.check.fastprojectile: true
|
||||
anticheat.check.itemspam: true
|
||||
anticheat.check.visual: true
|
||||
anticheat.check.vclip: true
|
||||
anticheat.check.fastinventory: true
|
||||
anticheat.check.autotool: true
|
||||
anticheat.check.fastanimation: true
|
||||
anticheat.check.blink: true
|
||||
anticheat.check.morepackets: true
|
||||
anticheat.check.badpackets: true
|
||||
anticheat.check.velocity: true
|
||||
anticheat.check.criticals: true
|
||||
anticheat.check.unicode: true
|
||||
anticheat.check.illegalinteract: true
|
||||
anticheat.check.fastladder: true
|
||||
anticheat.check.aimbot: true
|
||||
Reference in new issue
Block a user