Compare commits

..
30 Commits
Author SHA1 Message Date
Rammelkast f609758d28 Ready for Minecraft 1.12 2017-11-20 19:34:51 +01:00
Rammelkast 2d064ee849 1.12 fixes 2017-11-18 17:04:03 +01:00
Rammelkast 717b7acb67 Quick metrics fix 2017-11-18 16:55:20 +01:00
Rammelkast 2617aa1225 Cleanup 2017-05-06 16:00:08 +02:00
Rammelkast dd8c495ee6 Modify Metrics data & fix 2017-03-03 12:40:30 +01:00
Rammelkast 09ddbfba8f Fixed stuff, added new metrics graphs 2017-03-02 15:08:45 +01:00
Rammelkast 7f13a0ad4c Renamed package and groupId 2017-02-05 13:47:13 +01:00
Rammelkast 21d0108c16 Added extra strings to NameGenerator for more randomization 2017-02-05 13:42:31 +01:00
Rammelkast 15181ab6ad Cleanup 2017-02-05 13:34:51 +01:00
Rammelkast 347eec8ff0 Added glide check 2017-02-05 13:34:26 +01:00
Rammelkast 518e4c32e7 Fix #32 2017-02-04 20:45:55 +01:00
Rammelkast 583d2de244 Fix #33 2017-02-04 20:44:34 +01:00
Rammelkast 792a4ae0a5 Replace mcstats metrics with bStats metrics 2017-02-04 20:43:28 +01:00
Rammelkast 406ba01523 Fix #27 2017-01-15 16:44:42 +01:00
Rammelkast b2571a32f1 Fix #29 2017-01-15 16:27:24 +01:00
Rammelkast 52b96bedc4 Add metrics 2017-01-15 16:12:41 +01:00
Rammelkast 01602e187c Update Readme 2017-01-03 16:23:27 +01:00
Rammelkast db13527498 Fix #26 2017-01-03 16:14:29 +01:00
Rammelkast 1e4aaab2c0 Fix #21 2016-12-01 15:30:24 +01:00
Rammelkast 3baa074b6f Remove debug messages 2016-11-22 17:57:17 +01:00
Rammelkast b264bb1e43 Fix #18 2016-11-22 17:56:18 +01:00
Rammelkast 57d7ee9b62 Fix #17 and #19 2016-11-22 17:32:31 +01:00
Rammelkast 24125e9195 YAxis is now REALLY fixed in 1.8 :3 2016-11-18 16:48:40 +01:00
Rammelkast eca5a60d22 Fixed YAxis check for 1.8, removed messages 2016-11-18 16:48:00 +01:00
Rammelkast 8e4cef9a7d Changed magic, stronger default blink check 2016-11-18 16:44:15 +01:00
Rammelkast db821e4809 Plugin should now work on 1.7.10, started on Glide v2 2016-11-18 16:42:21 +01:00
Rammelkast c229252f7a Glide is just broken. 2016-11-18 16:38:57 +01:00
Rammelkast 93a5595bb1 Change version and remember that the Glide check is broken af 2016-11-18 16:38:15 +01:00
Rammelkast 92f5f30188 Fixed #6 a while ago, forgot to mark it as fixed. 2016-11-18 16:34:28 +01:00
Rammelkast 8773c05000 1.11 update 2016-11-17 19:03:05 +01:00
87 changed files with 2293 additions and 1028 deletions

No files matched your search

+16 -11
View File
@@ -7,6 +7,22 @@ AntiCheat helps server admins easily identify and block malicious users by monit
First of all, i've put a lot of time and work in this project, so donations (especially in (m)BTC) are appreciated! First of all, i've put a lot of time and work in this project, so donations (especially in (m)BTC) are appreciated!
My BTC address is 1JfyX6hvGUazHTtKVLaNcYaUxnyjR5HtMY My BTC address is 1JfyX6hvGUazHTtKVLaNcYaUxnyjR5HtMY
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/Paper/Taco) and it's version
* When using protocollib, your protocollib version
* If you use protocolhacks (ViaVersion etc.)
Usage
-------
Simply drag and drop the plugin and the ProtoclLib into your Plugins folder.
###Hacks blocked ###Hacks blocked
------- -------
* Blink * Blink
@@ -30,14 +46,3 @@ My BTC address is 1JfyX6hvGUazHTtKVLaNcYaUxnyjR5HtMY
* FastPlace * FastPlace
* Spam * Spam
* FastEat * FastEat
Usage
-------
Simply drag and drop the plugin and the ProtoclLib into your Plugins folder.
Bug Reporting/Support/Questions
------------
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.
All opened tickets that are bug reports require a debug log that includes logs of the issue in question. To obtain this, type `/anticheat debug` on your server. Note that for the debug output to contain valid information and help us diagnose your issue, you need to issue this command AFTER the issue occurs at least once and BEFORE you reload or restart it.
+10 -20
View File
@@ -1,9 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.gravitydevelopment.anticheat</groupId> <groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheat</artifactId> <artifactId>AntiCheatReloaded</artifactId>
<version>1.5.1-ALPHA</version> <version>1.6.2-ALPHA</version>
<name>AntiCheatReloaded</name> <name>AntiCheatReloaded</name>
<url>https://rammelkast.com</url> <url>https://rammelkast.com</url>
<properties> <properties>
@@ -11,13 +11,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>
<repository>
<id>dmulloy2-repo</id>
<url>http://repo.dmulloy2.net/content/groups/public/</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>dmulloy2-repo</id>
<url>http://maven.elmakers.com/repository/</url> <url>http://repo.dmulloy2.net/content/groups/public/</url>
</repository> </repository>
</repositories> </repositories>
<build> <build>
@@ -28,8 +24,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.7</source>
<target>1.6</target> <target>1.7</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@@ -47,7 +43,7 @@
<configuration> <configuration>
<artifactSet> <artifactSet>
<includes> <includes>
<include>net.gravitydevelopment.*</include> <include>com.rammelkast.*</include>
</includes> </includes>
</artifactSet> </artifactSet>
</configuration> </configuration>
@@ -85,7 +81,7 @@
<dependency> <dependency>
<groupId>com.comphenix.protocol</groupId> <groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>4.1.0-SNAPSHOT</version> <version>4.2.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@@ -97,14 +93,8 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.10-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<distributionManagement>
<repository>
<id>anticheat-repo</id>
<url>file:///var/lib/jenkins/repo</url>
</repository>
</distributionManagement>
</project> </project>
@@ -0,0 +1,294 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
import com.rammelkast.anticheatreloaded.command.CommandHandler;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.event.BlockListener;
import com.rammelkast.anticheatreloaded.event.EntityListener;
import com.rammelkast.anticheatreloaded.event.InventoryListener;
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.User;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class AntiCheat extends JavaPlugin {
private static AntiCheatManager manager;
private static AntiCheat 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 Long loadTime;
@Override
public void onEnable() {
plugin = this;
loadTime = System.currentTimeMillis();
manager = new AntiCheatManager(this, getLogger());
eventList.add(new PlayerListener());
eventList.add(new BlockListener());
eventList.add(new EntityListener());
eventList.add(new VehicleListener());
eventList.add(new InventoryListener());
// Order is important in some cases, don't screw with these unless
// needed, especially config
setupConfig();
setupEvents();
setupCommands();
// Enterprise must come before levels
setupEnterprise();
restoreLevels();
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
setupProtocol();
} else {
getLogger().severe("Shutting down, ProtocolLib not found!");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
// Enable packetlisteners
KillAuraCheck.listenPackets();
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("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("AntiCheat") != 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("*----------------------------------------------*");
}
}
}, 60L);
// End tests
verboseLog("Finished loading.");
getLogger().info("Running NMS version " + VersionUtil.getVersion() + "...");
// Metrics
try {
Metrics metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked") {
@Override
public int getValue() {
int kicked = playersKicked;
// Reset so we don't keep sending the same value
playersKicked = 0;
return kicked;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("killaura_violations") {
@Override
public int getValue() {
int violations = killauraViolations;
// Reset so we don't keep sending the same value
killauraViolations = 0;
return violations;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations") {
@Override
public int getValue() {
int violations = glideViolations;
// Reset so we don't keep sending the same value
glideViolations = 0;
return violations;
}
});
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version") {
@Override
public String getValue() {
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onDisable() {
verboseLog("Saving user levels...");
config.getLevels().saveLevelsFromUsers(getManager().getUserManager().getUsers());
AntiCheatManager.close();
getServer().getScheduler().cancelTasks(this);
cleanup();
}
private void setupProtocol() {
protocolManager = ProtocolLibrary.getProtocolManager();
verboseLog("Hooked into ProtocolLib");
}
private void setupEvents() {
for (Listener listener : eventList) {
getServer().getPluginManager().registerEvents(listener, this);
verboseLog("Registered events for ".concat(listener.toString().split("@")[0].split(".anticheat.")[1]));
}
}
private void setupCommands() {
getCommand("anticheat").setExecutor(new CommandHandler());
verboseLog("Registered commands.");
}
private void setupConfig() {
config = manager.getConfiguration();
verboseLog("Setup the config.");
}
private void setupEnterprise() {
if (config.getConfig().enterprise.getValue()) {
if (config.getEnterprise().loggingEnabled.getValue()) {
config.getEnterprise().database.cleanEvents();
}
}
}
private void restoreLevels() {
for (Player player : getServer().getOnlinePlayers()) {
UUID uuid = player.getUniqueId();
User user = new User(uuid);
user.setIsWaitingOnLevelSync(true);
config.getLevels().loadLevelToUser(user);
manager.getUserManager().addUser(user);
verboseLog("Data for " + uuid + " loaded");
}
}
public static AntiCheat getPlugin() {
return plugin;
}
public static AntiCheatManager getManager() {
return manager;
}
public static String getVersion() {
return manager.getPlugin().getDescription().getVersion();
}
private void cleanup() {
eventList = null;
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) {
manager.debugLog("[DEBUG] " + string);
}
}
});
}
public void verboseLog(final String string) {
if (verbose) {
getLogger().info(string);
}
}
public void setVerbose(boolean b) {
verbose = b;
}
public Long getLoadTime() {
return loadTime;
}
public static ProtocolManager getProtocolManager() {
return protocolManager;
}
/**
* Amount of players kicked since start
*/
private int playersKicked = 0;
/**
* Amount of killaura violations since start
*/
private int killauraViolations = 0;
/**
* Amount of glide violations since start
*/
private int glideViolations = 0;
public void onPlayerKicked() {
this.playersKicked++;
}
public void onKillAuraViolation() {
this.killauraViolations++;
}
public void onGlideViolation() {
this.glideViolations++;
}
}
@@ -16,18 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.api; package com.rammelkast.anticheatreloaded.api;
import java.util.List; import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import net.gravitydevelopment.anticheat.manage.AntiCheatManager; import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import net.gravitydevelopment.anticheat.manage.CheckManager; import com.rammelkast.anticheatreloaded.manage.CheckManager;
import net.gravitydevelopment.anticheat.manage.UserManager; import com.rammelkast.anticheatreloaded.manage.UserManager;
import net.gravitydevelopment.anticheat.util.Group; import com.rammelkast.anticheatreloaded.util.Group;
/** /**
* Developer's interface for all things AntiCheat. * Developer's interface for all things AntiCheat.
@@ -146,7 +146,7 @@ public class AntiCheatAPI {
} }
/** /**
* Get a user's {@link net.gravitydevelopment.anticheat.util.Group} * Get a user's {@link com.rammelkast.anticheatreloaded.util.Group}
* *
* @param player Player whose group to find * @param player Player whose group to find
* @return The player's group * @return The player's group
@@ -159,7 +159,7 @@ public class AntiCheatAPI {
* Get all configured Groups * Get all configured Groups
* *
* @return List of all groups * @return List of all groups
* @see net.gravitydevelopment.anticheat.util.Group * @see com.rammelkast.anticheatreloaded.util.Group
*/ */
public static List<Group> getGroups() { public static List<Group> getGroups() {
return getManager().getConfiguration().getGroups().getGroups(); return getManager().getConfiguration().getGroups().getGroups();
@@ -16,13 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.api; package com.rammelkast.anticheatreloaded.api;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.util.User;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.util.User;
/** /**
* Fired when a player fails an AntiCheat check * Fired when a player fails an AntiCheat check
*/ */
@@ -40,18 +41,18 @@ public class CheckFailEvent extends Event {
} }
/** /**
* Get the {@link net.gravitydevelopment.anticheat.util.User} who failed the check * Get the {@link com.rammelkast.anticheatreloaded.util.User} who failed the check
* *
* @return a {@link net.gravitydevelopment.anticheat.util.User} * @return a {@link com.rammelkast.anticheatreloaded.util.User}
*/ */
public User getUser() { public User getUser() {
return user; return user;
} }
/** /**
* Get the {@link net.gravitydevelopment.anticheat.check.CheckType} failed * Get the {@link com.rammelkast.anticheatreloaded.check.CheckType} failed
* *
* @return a {@link net.gravitydevelopment.anticheat.check.CheckType} * @return a {@link com.rammelkast.anticheatreloaded.check.CheckType}
*/ */
public CheckType getCheck() { public CheckType getCheck() {
return type; return type;
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.check; package com.rammelkast.anticheatreloaded.check;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@@ -37,23 +36,23 @@ import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.check.combat.KillAuraCheck; import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import net.gravitydevelopment.anticheat.check.combat.VelocityCheck; import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
import net.gravitydevelopment.anticheat.check.movement.BlinkCheck; import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
import net.gravitydevelopment.anticheat.check.movement.FlightCheck; import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import net.gravitydevelopment.anticheat.check.movement.GlideCheck; import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
import net.gravitydevelopment.anticheat.check.movement.SpeedCheck; import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
import net.gravitydevelopment.anticheat.check.movement.WaterWalkCheck; import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
import net.gravitydevelopment.anticheat.check.movement.YAxisCheck; import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
import net.gravitydevelopment.anticheat.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
import net.gravitydevelopment.anticheat.config.providers.Lang; import com.rammelkast.anticheatreloaded.config.providers.Lang;
import net.gravitydevelopment.anticheat.config.providers.Magic; import com.rammelkast.anticheatreloaded.config.providers.Magic;
import net.gravitydevelopment.anticheat.manage.AntiCheatManager; import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import net.gravitydevelopment.anticheat.util.Distance; import com.rammelkast.anticheatreloaded.util.Distance;
import net.gravitydevelopment.anticheat.util.User; import com.rammelkast.anticheatreloaded.util.User;
import net.gravitydevelopment.anticheat.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import net.gravitydevelopment.anticheat.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class Backend { public class Backend {
private List<UUID> isAscending = new ArrayList<UUID>(); private List<UUID> isAscending = new ArrayList<UUID>();
@@ -170,13 +169,17 @@ public class Backend {
inventoryTime.remove(pU); inventoryTime.remove(pU);
inventoryClicks.remove(pU); inventoryClicks.remove(pU);
lastFallPacket.remove(pU); lastFallPacket.remove(pU);
GlideCheck.lastYDelta.remove(pU); GlideCheck.lastDiff.remove(pU);
GlideCheck.glideBuffer.remove(pU); GlideCheck.lastFallDistance.remove(pU);
GlideCheck.violations.remove(pU);
SpeedCheck.speedViolation.remove(player.getUniqueId()); SpeedCheck.speedViolation.remove(player.getUniqueId());
} }
public CheckResult checkFastBow(Player player, float force) { public CheckResult checkFastBow(Player player, float force) {
// Ignore magic numbers here, they are minecrafty vanilla stuff. // Ignore magic numbers here, they are minecrafty vanilla stuff.
if (!bowWindUp.containsKey(player.getUniqueId())) {
return PASS;
}
int ticks = (int) ((((System.currentTimeMillis() - bowWindUp.get(player.getUniqueId())) * 20) / 1000) + 3); int ticks = (int) ((((System.currentTimeMillis() - bowWindUp.get(player.getUniqueId())) * 20) / 1000) + 3);
bowWindUp.remove(player.getUniqueId()); bowWindUp.remove(player.getUniqueId());
float f = (float) ticks / 20.0F; float f = (float) ticks / 20.0F;
@@ -258,7 +261,7 @@ public class Backend {
} }
public CheckResult checkYSpeed(Player player, double y) { public CheckResult checkYSpeed(Player player, double y) {
if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && y > magic.Y_SPEED_MAX() && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP)) { if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && (y > (VersionUtil.isNewYSpeed() ? magic.Y_SPEED_MAX() + 0.05 : magic.Y_SPEED_MAX())) && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + "'s y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")"); return new CheckResult(CheckResult.Result.FAILED, player.getName() + "'s y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
} else { } else {
return PASS; return PASS;
@@ -291,7 +294,7 @@ public class Backend {
} }
public CheckResult checkSneak(Player player, double x, double z) { public CheckResult checkSneak(Player player, double x, double z) {
if (player.isSneaking() && !player.isFlying() && !isMovingExempt(player) && !player.isInsideVehicle()) { if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()) {
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1; double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
if (i != -1) { if (i != -1) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")"); return new CheckResult(CheckResult.Result.FAILED, player.getName() + " was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
@@ -410,7 +413,7 @@ public class Backend {
string = " with jump potion"; string = " with jump potion";
} }
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) { if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player) && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) {
if (y1 < y2) { if (y1 < y2) {
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) { if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) {
increment(player, ascensionCount, max); increment(player, ascensionCount, max);
@@ -457,9 +460,6 @@ public class Backend {
int i = fastBreakViolation.get(uuid); int i = fastBreakViolation.get(uuid);
if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) { if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) {
lastBlockBroken.put(uuid, System.currentTimeMillis()); lastBlockBroken.put(uuid, System.currentTimeMillis());
if (!silentMode()) {
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastbreaking detected. Please wait 10 seconds before breaking blocks.");
}
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " broke blocks too fast " + i + " times in a row (max=" + violations + ")"); return new CheckResult(CheckResult.Result.FAILED, player.getName() + " broke blocks too fast " + i + " times in a row (max=" + violations + ")");
} else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) { } else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) {
fastBreakViolation.put(uuid, 0); fastBreakViolation.put(uuid, 0);
@@ -521,9 +521,6 @@ public class Backend {
AntiCheat.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math); AntiCheat.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) { if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
lastBlockPlaced.put(uuid, time); lastBlockPlaced.put(uuid, time);
if (!silentMode()) {
player.sendMessage(ChatColor.RED + "[AntiCheat] Fastplacing detected. Please wait 10 seconds before placing blocks.");
}
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")"); return new CheckResult(CheckResult.Result.FAILED, player.getName() + " placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) { } else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
AntiCheat.debugLog("Reset facePlaceViolation for " + uuid); AntiCheat.debugLog("Reset facePlaceViolation for " + uuid);
@@ -655,10 +652,11 @@ public class Backend {
public CheckResult checkFastHeal(Player player) { public CheckResult checkFastHeal(Player player) {
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it. if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
{ {
long healTime = VersionUtil.getHealTime();
long l = lastHeal.get(player.getUniqueId()); long l = lastHeal.get(player.getUniqueId());
lastHeal.remove(player.getUniqueId()); lastHeal.remove(player.getUniqueId());
if ((System.currentTimeMillis() - l) < magic.HEAL_TIME_MIN()) { if ((System.currentTimeMillis() - l) < healTime) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + magic.HEAL_TIME_MIN() + " ms)"); return new CheckResult(CheckResult.Result.FAILED, player.getName() + " healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
} }
} }
return PASS; return PASS;
@@ -779,8 +777,9 @@ public class Backend {
YAxisCheck.yAxisLastViolation.remove(player.getUniqueId()); YAxisCheck.yAxisLastViolation.remove(player.getUniqueId());
YAxisCheck.lastYcoord.remove(player.getUniqueId()); YAxisCheck.lastYcoord.remove(player.getUniqueId());
YAxisCheck.lastYtime.remove(player.getUniqueId()); YAxisCheck.lastYtime.remove(player.getUniqueId());
GlideCheck.lastYDelta.remove(player.getUniqueId()); GlideCheck.lastFallDistance.remove(player.getUniqueId());
GlideCheck.glideBuffer.remove(player.getUniqueId()); GlideCheck.lastDiff.remove(player.getUniqueId());
GlideCheck.violations.remove(player.getUniqueId());
} }
public void logExitFly(final Player player) { public void logExitFly(final Player player) {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.check; package com.rammelkast.anticheatreloaded.check;
public class CheckResult { public class CheckResult {
@@ -16,14 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.check; package com.rammelkast.anticheatreloaded.check;
import net.gravitydevelopment.anticheat.api.CheckFailEvent;
import net.gravitydevelopment.anticheat.util.User;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.api.CheckFailEvent;
import com.rammelkast.anticheatreloaded.util.Permission;
import com.rammelkast.anticheatreloaded.util.User;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@@ -1,4 +1,4 @@
package net.gravitydevelopment.anticheat.check.combat; package com.rammelkast.anticheatreloaded.check.combat;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -6,10 +6,10 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import net.gravitydevelopment.anticheat.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import net.gravitydevelopment.anticheat.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import net.gravitydevelopment.anticheat.event.EventListener; import com.rammelkast.anticheatreloaded.event.EventListener;
import net.gravitydevelopment.anticheat.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
public class CriticalsCheck { public class CriticalsCheck {
@@ -1,10 +1,9 @@
package net.gravitydevelopment.anticheat.check.combat; package com.rammelkast.anticheatreloaded.check.combat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
@@ -13,31 +12,30 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority; import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.check.CheckResult;
import net.gravitydevelopment.anticheat.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckType;
import net.gravitydevelopment.anticheat.check.CheckType; import com.rammelkast.anticheatreloaded.event.EventListener;
import net.gravitydevelopment.anticheat.event.EventListener; import com.rammelkast.anticheatreloaded.util.NPC_1_12;
import net.gravitydevelopment.anticheat.util.NPC_1_10; import com.rammelkast.anticheatreloaded.util.VersionUtil;
import net.gravitydevelopment.anticheat.util.VersionUtil;
/** /**
* @author Rammelkast * @author Rammelkast
*/ */
public class KillAuraCheck { public class KillAuraCheck {
private static final Map<UUID, NPC_1_10> NPC_LIST = new HashMap<UUID, NPC_1_10>(); private static final Map<UUID, NPC_1_12> NPC_LIST = new HashMap<UUID, NPC_1_12>();
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>(); private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
public static void cleanPlayer(Player p) { public static void cleanPlayer(Player p) {
if (!VersionUtil.getVersion().equals("v1_10_R1")) { if (!VersionUtil.getVersion().equals("v1_11_R1")) {
return; return;
} }
NPC_LIST.remove(p.getUniqueId()); NPC_LIST.remove(p.getUniqueId());
} }
public static void listenPackets() { public static void listenPackets() {
if (!VersionUtil.getVersion().equals("v1_10_R1")) { if (!VersionUtil.getVersion().equals("v1_11_R1")) {
return; return;
} }
AntiCheat.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheat.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) { AntiCheat.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheat.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
@@ -58,7 +56,8 @@ public class KillAuraCheck {
}else { }else {
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1); VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
if (VL_COUNT.get(p.getUniqueId()) >= 5) { if (VL_COUNT.get(p.getUniqueId()) >= 5) {
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=5)").getMessage(), p, CheckType.BLINK); EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=5)").getMessage(), p, CheckType.KILLAURA);
AntiCheat.getPlugin().onKillAuraViolation();
VL_COUNT.remove(p.getUniqueId()); VL_COUNT.remove(p.getUniqueId());
} }
} }
@@ -67,24 +66,25 @@ public class KillAuraCheck {
} }
public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) { public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) {
if (!VersionUtil.getVersion().equals("v1_10_R1")) { if (!VersionUtil.getVersion().equals("v1_11_R1")) {
return; return;
} }
if (NPC_LIST.containsKey(p.getUniqueId())) if (NPC_LIST.containsKey(p.getUniqueId()))
NPC_LIST.get(p.getUniqueId()).damage(e, p); NPC_LIST.get(p.getUniqueId()).damage(e, p);
else { else {
NPC_1_10 npc = new NPC_1_10(p); NPC_1_12 npc = new NPC_1_12(p);
NPC_LIST.put(p.getUniqueId(), npc); NPC_LIST.put(p.getUniqueId(), npc);
npc.spawn(); npc.spawn();
} }
} }
public static void doMove(PlayerMoveEvent e) { public static void doMove(PlayerMoveEvent e) {
if (!VersionUtil.getVersion().equals("v1_10_R1")) { if (!VersionUtil.getVersion().equals("v1_11_R1")) {
return; return;
} }
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) {
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e); NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
}
} }
} }
@@ -1,4 +1,4 @@
package net.gravitydevelopment.anticheat.check.combat; package com.rammelkast.anticheatreloaded.check.combat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -9,10 +9,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import net.gravitydevelopment.anticheat.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import net.gravitydevelopment.anticheat.event.EventListener; import com.rammelkast.anticheatreloaded.event.EventListener;
public class VelocityCheck { public class VelocityCheck {
@@ -37,7 +37,7 @@ public class VelocityCheck {
else { else {
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1); VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
if (VL_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().VELOCITY_AMT()) { if (VL_COUNT.get(p.getUniqueId()) > AntiCheat.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=" + AntiCheat.getManager().getBackend().getMagic().VELOCITY_AMT() + ")").getMessage(), p, CheckType.VELOCITY); EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Velocity, had zero/low velocity " + VL_COUNT.get(p.getUniqueId()) + " times (max=" + AntiCheat.getManager().getBackend().getMagic().VELOCITY_AMT() + ", dist=" + then.distance(p.getLocation()) + ")").getMessage(), p, CheckType.VELOCITY);
VL_COUNT.remove(p.getUniqueId()); VL_COUNT.remove(p.getUniqueId());
} }
} }
@@ -1,10 +1,9 @@
package net.gravitydevelopment.anticheat.check.movement; package com.rammelkast.anticheatreloaded.check.movement;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@@ -13,11 +12,10 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority; import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketEvent;
import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.check.CheckResult;
import net.gravitydevelopment.anticheat.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckType;
import net.gravitydevelopment.anticheat.check.CheckType; import com.rammelkast.anticheatreloaded.event.EventListener;
import net.gravitydevelopment.anticheat.event.EventListener;
/** /**
* @author Rammelkast * @author Rammelkast
@@ -32,7 +30,7 @@ public class BlinkCheck {
public void run() { public void run() {
MOVE_COUNT.clear(); MOVE_COUNT.clear();
} }
}.runTaskTimer(AntiCheat.getPlugin(), 0, 20); }.runTaskTimer(AntiCheat.getPlugin(), 20, 20);
} }
public static void listenPackets() { public static void listenPackets() {
@@ -41,17 +39,18 @@ public class BlinkCheck {
public void onPacketReceiving(PacketEvent e) { public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
Location cur = e.getPlayer().getLocation(); Location cur = e.getPlayer().getLocation();
if (!MOVE_COUNT.containsKey(p.getUniqueId())) if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
MOVE_COUNT.put(p.getUniqueId(), 1); MOVE_COUNT.put(p.getUniqueId(), 1);
else { } else {
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1); MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
if (AntiCheat.getManager().getCheckManager().checkInWorld(p) && !AntiCheat.getManager().getCheckManager().isOpExempt(p) && !AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) if (AntiCheat.getManager().getCheckManager().checkInWorld(p) && !AntiCheat.getManager().getCheckManager().isOpExempt(p) && !AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET()) { if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET()) {
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId()) + " packets in one second (max=" + AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET() + ")").getMessage(), p, CheckType.BLINK); EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId()) + " packets in one second (max=" + AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET() + ")").getMessage(), p, CheckType.BLINK);
MOVE_COUNT.remove(p.getUniqueId()); MOVE_COUNT.remove(p.getUniqueId());
e.setCancelled(true); e.setCancelled(true);
e.getPlayer().teleport(cur); e.getPlayer().teleport(cur);
} }
}
} }
} }
}); });
@@ -0,0 +1,19 @@
package com.rammelkast.anticheatreloaded.check.movement;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.util.Distance;
/**
* TODO
*/
public class ElytraFly {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult runCheck(Player player, Distance distance) {
return PASS;
}
}
@@ -0,0 +1,94 @@
package com.rammelkast.anticheatreloaded.check.movement;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
/**
* @author Rammelkast
* TODO rewrite this check
*/
public class FlightCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> blocksOverFlight = new HashMap<UUID, Double>();
public static Map<UUID, Long> movingExempt = new HashMap<UUID, Long>();
public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|| VersionUtil.isFlying(player)) {
// This was a teleport or user is flying/using elytra, so we don't care
// about it.
return PASS;
}
final UUID uuid = player.getUniqueId();
final double y1 = distance.fromY();
final double y2 = distance.toY();
if (!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 })) {
if (!blocksOverFlight.containsKey(uuid)) {
blocksOverFlight.put(uuid, 0D);
}
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) + distance.getXDifference()
+ distance.getYDifference() + distance.getZDifference()));
if (y1 > y2) {
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) - distance.getYDifference()));
}
if (blocksOverFlight.get(uuid) > AntiCheat.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT()
&& (y1 <= y2)) {
return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " flew over " + blocksOverFlight.get(uuid) + " blocks (max="
+ AntiCheat.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
}
} else {
blocksOverFlight.put(uuid, 0D);
}
return PASS;
}
public static boolean isMovingExempt(Player player) {
return isDoing(player, movingExempt, -1);
}
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
if (map.containsKey(player.getUniqueId())) {
if (max != -1) {
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
map.remove(player.getUniqueId());
return false;
} else {
return true;
}
} else {
// Termination time has already been calculated
if (map.get(player.getUniqueId()) < System.currentTimeMillis()) {
map.remove(player.getUniqueId());
return false;
} else {
return true;
}
}
} else {
return false;
}
}
}
@@ -0,0 +1,74 @@
package com.rammelkast.anticheatreloaded.check.movement;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
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;
public class GlideCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> lastDiff = new HashMap<UUID, Double>();
public static Map<UUID, Float> lastFallDistance = new HashMap<UUID, Float>();
public static Map<UUID, Integer> violations = new HashMap<UUID, Integer>();
public static CheckResult runCheck(Player player, Distance distance) {
if (VersionUtil.isFlying(player)) {
return PASS;
}
if (!lastDiff.containsKey(player.getUniqueId())) {
lastDiff.put(player.getUniqueId(), distance.getYDifference());
return PASS;
}
if (!lastFallDistance.containsKey(player.getUniqueId())) {
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
return PASS;
}
double yDiff = distance.getYDifference();
float fallDistance = player.getFallDistance();
if (yDiff == lastDiff.get(player.getUniqueId()) && fallDistance > lastFallDistance.get(player.getUniqueId())) {
if (!violations.containsKey(player.getUniqueId())) {
violations.put(player.getUniqueId(), 1);
} else {
if (violations.get(player.getUniqueId()) + 1 >= AntiCheat.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
AntiCheat.getPlugin().onGlideViolation();
return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
} else {
violations.put(player.getUniqueId(), violations.get(player.getUniqueId()) + 1);
}
}
}
lastDiff.put(player.getUniqueId(), distance.getYDifference());
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
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();
}
}
@@ -1,4 +1,4 @@
package net.gravitydevelopment.anticheat.check.movement; package com.rammelkast.anticheatreloaded.check.movement;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -8,9 +8,9 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import net.gravitydevelopment.anticheat.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class SpeedCheck { public class SpeedCheck {
@@ -37,7 +37,7 @@ public class SpeedCheck {
reason = "on soulsand "; reason = "on soulsand ";
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND(); max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
} }
} else if (player.isFlying()) { } else if (VersionUtil.isFlying(player)) {
reason = "while flying "; reason = "while flying ";
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY(); max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY();
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) { } else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
@@ -0,0 +1,104 @@
package com.rammelkast.anticheatreloaded.check.movement;
import java.util.ArrayList;
import java.util.HashMap;
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.AntiCheat;
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
*/
public class WaterWalkCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static List<UUID> isInWater = new ArrayList<UUID>();
public static List<UUID> isInWaterCache = new ArrayList<UUID>();
public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>();
public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>();
public static CheckResult runCheck(Player player, double x, double y, double z) {
Block block = player.getLocation().getBlock();
UUID uuid = player.getUniqueId();
if (player.getVehicle() == null && !player.isFlying() && !VersionUtil.isFrostWalk(player)) {
if (block.isLiquid()) {
if (isInWater.contains(uuid)) {
if (isInWaterCache.contains(uuid)) {
if (player.getNearbyEntities(1, 1, 1).isEmpty()) {
boolean b;
if (!Utilities.sprintFly(player)) {
b = x > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER()
|| z > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER();
} else {
b = x > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|| z > AntiCheat.getManager().getBackend().getMagic()
.XZ_SPEED_MAX_WATER_SPRINT();
}
if (!b && !Utilities.isFullyInWater(player.getLocation())
&& Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D
&& !block.getType().equals(Material.WATER_LILY)) {
b = true;
}
if (b) {
if (waterSpeedViolation.containsKey(uuid)) {
int v = waterSpeedViolation.get(uuid);
if (v >= AntiCheat.getManager().getBackend().getMagic()
.WATER_SPEED_VIOLATION_MAX()) {
waterSpeedViolation.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() + ")");
} else {
waterSpeedViolation.put(uuid, v + 1);
}
} else {
waterSpeedViolation.put(uuid, 1);
}
}
}
} else {
isInWaterCache.add(uuid);
return PASS;
}
} else {
isInWater.add(uuid);
return PASS;
}
} else if (block.getRelative(BlockFace.DOWN).isLiquid()
&& !AntiCheat.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block)
&& Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))) {
if (waterAscensionViolation.containsKey(uuid)) {
int v = waterAscensionViolation.get(uuid);
if (v >= AntiCheat.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
waterAscensionViolation.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() + ")");
} else {
waterAscensionViolation.put(uuid, v + 1);
}
} else {
waterAscensionViolation.put(uuid, 1);
}
} else {
isInWater.remove(uuid);
isInWaterCache.remove(uuid);
}
}
return PASS;
}
}
@@ -0,0 +1,111 @@
package com.rammelkast.anticheatreloaded.check.movement;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class YAxisCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> lastYcoord = new HashMap<UUID, Double>();
public static Map<UUID, Long> lastYtime = new HashMap<UUID, Long>();
public static Map<UUID, Integer> yAxisViolations = new HashMap<UUID, Integer>();
public static Map<UUID, Long> yAxisLastViolation = new HashMap<UUID, Long>();
private static boolean hasJumpPotion(Player player) {
return player.hasPotionEffect(PotionEffectType.JUMP);
}
public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|| distance.getYDifference() < 0 || VersionUtil.isFlying(player)) {
return PASS;
}
if (!FlightCheck.isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock())
&& !player.isInsideVehicle() && !Utilities.isInWater(player) && !hasJumpPotion(player)
&& !isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
&& !isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) {
double y1 = player.getLocation().getY();
UUID uuid = player.getUniqueId();
// Fix Y axis spam.
if (!lastYcoord.containsKey(uuid) || !lastYtime.containsKey(uuid)
|| !yAxisLastViolation.containsKey(uuid)) {
lastYcoord.put(uuid, y1);
yAxisViolations.put(uuid, 0);
yAxisLastViolation.put(uuid, 0L);
lastYtime.put(uuid, System.currentTimeMillis());
} else {
if (y1 > lastYcoord.get(uuid)
&& yAxisViolations.get(uuid) > AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) < AntiCheat.getManager()
.getBackend().getMagic().Y_MAXVIOTIME()) {
Location g = player.getLocation();
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
yAxisLastViolation.put(uuid, System.currentTimeMillis());
if (!AntiCheat.getManager().getBackend().silentMode()) {
g.setY(lastYcoord.get(uuid));
if (g.getBlock().getType() == Material.AIR) {
player.teleport(g);
}
}
return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " tried to fly on y-axis " + yAxisViolations.get(uuid) + " times (max ="
+ AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
} else {
if (yAxisViolations.get(uuid) > AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheat.getManager()
.getBackend().getMagic().Y_MAXVIOTIME()) {
yAxisViolations.put(uuid, 0);
yAxisLastViolation.put(uuid, 0L);
}
}
long i = System.currentTimeMillis() - lastYtime.get(uuid);
double diff = AntiCheat.getManager().getBackend().getMagic().Y_MAXDIFF()
+ (Utilities.isStair(player.getLocation().add(0, -1, 0).getBlock()) ? 0.5 : 0.0);
if ((y1 - lastYcoord.get(uuid)) > diff && i < AntiCheat.getManager().getBackend().getMagic().Y_TIME()) {
Location g = player.getLocation();
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
yAxisLastViolation.put(uuid, System.currentTimeMillis());
if (!AntiCheat.getManager().getBackend().silentMode()) {
g.setY(lastYcoord.get(uuid));
if (g.getBlock().getType() == Material.AIR) {
player.teleport(g);
}
}
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis in "
+ i + " ms (min =" + AntiCheat.getManager().getBackend().getMagic().Y_TIME() + ")");
} else {
if ((y1 - lastYcoord.get(uuid)) > AntiCheat.getManager().getBackend().getMagic().Y_MAXDIFF() + 1
|| (System.currentTimeMillis() - lastYtime.get(uuid)) > AntiCheat.getManager().getBackend()
.getMagic().Y_TIME()) {
lastYtime.put(uuid, System.currentTimeMillis());
lastYcoord.put(uuid, y1);
}
}
}
}
// Fix Y axis spam
return PASS;
}
public static boolean isMoveUpBlock(Block block) {
return VersionUtil.getMoveUpBlocks().contains(block.getType());
}
}
@@ -0,0 +1,17 @@
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?
}
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command; package com.rammelkast.anticheatreloaded.command;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@@ -24,11 +24,11 @@ import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
import net.gravitydevelopment.anticheat.manage.CheckManager; import com.rammelkast.anticheatreloaded.manage.CheckManager;
import net.gravitydevelopment.anticheat.manage.UserManager; import com.rammelkast.anticheatreloaded.manage.UserManager;
import net.gravitydevelopment.anticheat.util.Permission; import com.rammelkast.anticheatreloaded.util.Permission;
public class CommandBase { public class CommandBase {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command; package com.rammelkast.anticheatreloaded.command;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -25,14 +25,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import net.gravitydevelopment.anticheat.command.executors.CommandCheck; import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
import net.gravitydevelopment.anticheat.command.executors.CommandDebug; import com.rammelkast.anticheatreloaded.command.executors.CommandDebug;
import net.gravitydevelopment.anticheat.command.executors.CommandDeveloper; import com.rammelkast.anticheatreloaded.command.executors.CommandDeveloper;
import net.gravitydevelopment.anticheat.command.executors.CommandHelp; import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
import net.gravitydevelopment.anticheat.command.executors.CommandLog; import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
import net.gravitydevelopment.anticheat.command.executors.CommandReload; import com.rammelkast.anticheatreloaded.command.executors.CommandReload;
import net.gravitydevelopment.anticheat.command.executors.CommandReport; import com.rammelkast.anticheatreloaded.command.executors.CommandReport;
import net.gravitydevelopment.anticheat.command.executors.CommandReset; import com.rammelkast.anticheatreloaded.command.executors.CommandReset;
public class CommandHandler implements CommandExecutor { public class CommandHandler implements CommandExecutor {
@@ -16,13 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.Permission;
import java.util.List; import java.util.List;
public class CommandCheck extends CommandBase { public class CommandCheck extends CommandBase {
@@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.PastebinReport;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.PastebinReport;
import com.rammelkast.anticheatreloaded.util.Permission;
public class CommandDebug extends CommandBase { public class CommandDebug extends CommandBase {
private static final String NAME = "AntiCheat Debug Reporting"; private static final String NAME = "AntiCheat Debug Reporting";
@@ -16,13 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.Permission;
public class CommandDeveloper extends CommandBase { public class CommandDeveloper extends CommandBase {
private static final String NAME = "AntiCheat Developer Mode"; private static final String NAME = "AntiCheat Developer Mode";
@@ -16,12 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.Permission;
public class CommandHelp extends CommandBase { public class CommandHelp extends CommandBase {
private static final String NAME = "AntiCheatReloaded Help"; private static final String NAME = "AntiCheatReloaded Help";
@@ -16,13 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
import com.rammelkast.anticheatreloaded.util.Permission;
public class CommandLog extends CommandBase { public class CommandLog extends CommandBase {
private static final String NAME = "AntiCheat Logging"; private static final String NAME = "AntiCheat Logging";
@@ -16,12 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.Permission;
public class CommandReload extends CommandBase { public class CommandReload extends CommandBase {
private static final String NAME = "AntiCheat Reload"; private static final String NAME = "AntiCheat Reload";
@@ -16,18 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.manage.CheckManager;
import net.gravitydevelopment.anticheat.util.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
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.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.command.executors; package com.rammelkast.anticheatreloaded.command.executors;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.command.CommandBase;
import net.gravitydevelopment.anticheat.util.Permission;
import net.gravitydevelopment.anticheat.util.User;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.util.Permission;
import com.rammelkast.anticheatreloaded.util.User;
public class CommandReset extends CommandBase { public class CommandReset extends CommandBase {
private static final String NAME = "AntiCheat Resetting"; private static final String NAME = "AntiCheat Resetting";
@@ -16,17 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config; package com.rammelkast.anticheatreloaded.config;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.files.Config;
import net.gravitydevelopment.anticheat.config.files.Enterprise;
import net.gravitydevelopment.anticheat.config.holders.mysql.*;
import net.gravitydevelopment.anticheat.config.holders.yaml.*;
import net.gravitydevelopment.anticheat.config.providers.*;
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.files.Config;
import com.rammelkast.anticheatreloaded.config.files.Enterprise;
import com.rammelkast.anticheatreloaded.config.holders.mysql.*;
import com.rammelkast.anticheatreloaded.config.holders.yaml.*;
import com.rammelkast.anticheatreloaded.config.providers.*;
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import java.io.File; import java.io.File;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
@@ -16,15 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config; package com.rammelkast.anticheatreloaded.config;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.yaml.CommentedConfiguration;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.yaml.CommentedConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
public class ConfigurationFile { public class ConfigurationFile {
@@ -58,7 +60,13 @@ public class ConfigurationFile {
this.saveDefault = saveDefault; this.saveDefault = saveDefault;
if (saveDefault) { if (saveDefault) {
defaultConfigFile = YamlConfiguration.loadConfiguration(plugin.getResource(fileName)); InputStreamReader reader = new InputStreamReader(plugin.getResource(fileName));
defaultConfigFile = YamlConfiguration.loadConfiguration(reader);
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
load(); load();
} }
@@ -16,12 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config; package com.rammelkast.anticheatreloaded.config;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.util.enterprise.Database;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.util.enterprise.Database;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -16,14 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.files; package com.rammelkast.anticheatreloaded.config.files;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
public class Config extends ConfigurationFile { public class Config extends ConfigurationFile {
public static final String FILENAME = "config.yml"; public static final String FILENAME = "config.yml";
@@ -16,12 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.files; package com.rammelkast.anticheatreloaded.config.files;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile; import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
import net.gravitydevelopment.anticheat.util.enterprise.Database; import com.rammelkast.anticheatreloaded.util.enterprise.Database;
public class Enterprise extends ConfigurationFile { public class Enterprise extends ConfigurationFile {
@@ -16,12 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.mysql; package com.rammelkast.anticheatreloaded.config.holders.mysql;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Groups;
import net.gravitydevelopment.anticheat.util.Group;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@@ -29,6 +24,11 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Groups;
import com.rammelkast.anticheatreloaded.util.Group;
public class MySQLGroupsHolder extends ConfigurationTable implements Groups { public class MySQLGroupsHolder extends ConfigurationTable implements Groups {
private static final String TABLE = "groups"; private static final String TABLE = "groups";
@@ -16,15 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.mysql; package com.rammelkast.anticheatreloaded.config.holders.mysql;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Lang;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Lang;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@@ -49,7 +52,13 @@ public class MySQLLangHolder extends ConfigurationTable implements InvocationHan
@Override @Override
public void open() { public void open() {
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("lang.yml")); InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("lang.yml"));
defaults = YamlConfiguration.loadConfiguration(reader);
try {
reader.close();
} catch (IOException e1) {
e1.printStackTrace();
}
stringValues = new HashMap<String, String>(); stringValues = new HashMap<String, String>();
listValues = new HashMap<String, List<String>>(); listValues = new HashMap<String, List<String>>();
@@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.mysql; package com.rammelkast.anticheatreloaded.config.holders.mysql;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Levels;
import net.gravitydevelopment.anticheat.util.User;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Levels;
import com.rammelkast.anticheatreloaded.util.User;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
@@ -16,15 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.mysql; package com.rammelkast.anticheatreloaded.config.holders.mysql;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Magic;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Magic;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -46,7 +49,13 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
@Override @Override
public void open() { public void open() {
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("magic.yml")); InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("magic.yml"));
defaults = YamlConfiguration.loadConfiguration(reader);
try {
reader.close();
} catch (IOException e1) {
e1.printStackTrace();
}
ints = new HashMap<String, Integer>(); ints = new HashMap<String, Integer>();
doubles = new HashMap<String, Double>(); doubles = new HashMap<String, Double>();
@@ -16,19 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.mysql; package com.rammelkast.anticheatreloaded.config.holders.mysql;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationTable;
import net.gravitydevelopment.anticheat.config.providers.Rules;
import net.gravitydevelopment.anticheat.util.rule.Rule;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Rules;
import com.rammelkast.anticheatreloaded.util.rule.Rule;
public class MySQLRulesHolder extends ConfigurationTable implements Rules { public class MySQLRulesHolder extends ConfigurationTable implements Rules {
private static final String TABLE = "rules"; private static final String TABLE = "rules";
@@ -16,16 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.yaml; package com.rammelkast.anticheatreloaded.config.holders.yaml;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import net.gravitydevelopment.anticheat.config.providers.Groups;
import net.gravitydevelopment.anticheat.util.Group;
import java.util.*; import java.util.*;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
import com.rammelkast.anticheatreloaded.config.providers.Groups;
import com.rammelkast.anticheatreloaded.util.Group;
public class YamlGroupsHolder extends ConfigurationFile implements Groups { public class YamlGroupsHolder extends ConfigurationFile implements Groups {
public static final String FILENAME = "groups.yml"; public static final String FILENAME = "groups.yml";
@@ -16,16 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.yaml; package com.rammelkast.anticheatreloaded.config.holders.yaml;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
public class YamlLangHolder extends ConfigurationFile implements InvocationHandler { public class YamlLangHolder extends ConfigurationFile implements InvocationHandler {
public static final String FILENAME = "lang.yml"; public static final String FILENAME = "lang.yml";
@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.yaml; package com.rammelkast.anticheatreloaded.config.holders.yaml;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import net.gravitydevelopment.anticheat.config.providers.Levels;
import net.gravitydevelopment.anticheat.util.User;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
import com.rammelkast.anticheatreloaded.config.providers.Levels;
import com.rammelkast.anticheatreloaded.util.User;
public class YamlLevelsHolder extends ConfigurationFile implements Levels { public class YamlLevelsHolder extends ConfigurationFile implements Levels {
public static final String FILENAME = "data/levels.yml"; public static final String FILENAME = "data/levels.yml";
@@ -16,15 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.yaml; package com.rammelkast.anticheatreloaded.config.holders.yaml;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
public class YamlMagicHolder extends ConfigurationFile implements InvocationHandler { public class YamlMagicHolder extends ConfigurationFile implements InvocationHandler {
public static final String FILENAME = "magic.yml"; public static final String FILENAME = "magic.yml";
@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.holders.yaml; package com.rammelkast.anticheatreloaded.config.holders.yaml;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
import net.gravitydevelopment.anticheat.config.providers.Rules;
import net.gravitydevelopment.anticheat.util.rule.Rule;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
import com.rammelkast.anticheatreloaded.config.providers.Rules;
import com.rammelkast.anticheatreloaded.util.rule.Rule;
public class YamlRulesHolder extends ConfigurationFile implements Rules { public class YamlRulesHolder extends ConfigurationFile implements Rules {
public static final String FILENAME = "rules.yml"; public static final String FILENAME = "rules.yml";
@@ -16,12 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.providers; package com.rammelkast.anticheatreloaded.config.providers;
import net.gravitydevelopment.anticheat.util.Group;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.util.Group;
public interface Groups { public interface Groups {
/** /**
@@ -1,4 +1,4 @@
package net.gravitydevelopment.anticheat.config.providers; package com.rammelkast.anticheatreloaded.config.providers;
import java.util.List; import java.util.List;
@@ -16,12 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.providers; package com.rammelkast.anticheatreloaded.config.providers;
import net.gravitydevelopment.anticheat.util.User;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.util.User;
public interface Levels { public interface Levels {
/** /**
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.providers; package com.rammelkast.anticheatreloaded.config.providers;
/** /**
* Magic number class. Modifications to values in magic.yml will be accepted here. * Magic number class. Modifications to values in magic.yml will be accepted here.
@@ -161,10 +161,6 @@ public interface Magic {
* Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE. * Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE.
*/ */
public int GLIDE_LIMIT(); public int GLIDE_LIMIT();
/**
* The max fallspeed after which glide check is disabled; Type=DOUBLE
*/
public double GLIDE_MAX();
/** /**
* How many blocks you can travel before action is taken; Type=INTEGER, Leniency=INCREASE. * How many blocks you can travel before action is taken; Type=INTEGER, Leniency=INCREASE.
*/ */
@@ -257,10 +253,6 @@ public interface Magic {
* Minimum time in between block placing; Type=INTEGER, Leniency=DECREASE. * Minimum time in between block placing; Type=INTEGER, Leniency=DECREASE.
*/ */
public double BLOCK_PLACE_MIN(); public double BLOCK_PLACE_MIN();
/**
* Minimum time in between healing; Type=SYSTEM, Leniency=DECREASE.
*/
public int HEAL_TIME_MIN();
/** /**
* Minimum time in between eating; Type=SYSTEM, Leniency=DECREASE. * Minimum time in between eating; Type=SYSTEM, Leniency=DECREASE.
*/ */
@@ -17,12 +17,12 @@
*/ */
package net.gravitydevelopment.anticheat.config.providers; package com.rammelkast.anticheatreloaded.config.providers;
import net.gravitydevelopment.anticheat.util.rule.Rule;
import java.util.List; import java.util.List;
import com.rammelkast.anticheatreloaded.util.rule.Rule;
public interface Rules { public interface Rules {
/** /**
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.config.yaml; package com.rammelkast.anticheatreloaded.config.yaml;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -33,6 +33,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -188,7 +189,9 @@ public class CommentedConfiguration extends YamlConfiguration {
CommentedConfiguration config = new CommentedConfiguration(); CommentedConfiguration config = new CommentedConfiguration();
try { try {
config.load(stream); InputStreamReader reader = new InputStreamReader(stream);
config.load(reader);
reader.close();
} catch (IOException ex) { } catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
} catch (InvalidConfigurationException ex) { } catch (InvalidConfigurationException ex) {
@@ -16,13 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.event; package com.rammelkast.anticheatreloaded.event;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.check.CheckResult;
import net.gravitydevelopment.anticheat.util.Distance;
import net.gravitydevelopment.anticheat.util.Utilities;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@@ -31,6 +26,12 @@ import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Utilities;
public class BlockListener extends EventListener { public class BlockListener extends EventListener {
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@@ -16,10 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.event; package com.rammelkast.anticheatreloaded.event;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creeper; import org.bukkit.entity.Creeper;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
@@ -29,18 +28,18 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import com.rammelkast.anticheatreloaded.AntiCheat;
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 org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.check.combat.CriticalsCheck;
import net.gravitydevelopment.anticheat.check.combat.KillAuraCheck;
import net.gravitydevelopment.anticheat.check.combat.VelocityCheck;
import net.gravitydevelopment.anticheat.util.Distance;
import net.gravitydevelopment.anticheat.util.Utilities;
public class EntityListener extends EventListener { public class EntityListener extends EventListener {
@EventHandler @EventHandler
@@ -16,17 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.event; package com.rammelkast.anticheatreloaded.event;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.Backend;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.manage.*;
import net.gravitydevelopment.anticheat.util.User;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import com.rammelkast.anticheatreloaded.AntiCheat;
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.util.User;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -16,12 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.event; package com.rammelkast.anticheatreloaded.event;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.util.User;
import net.gravitydevelopment.anticheat.check.CheckResult;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
@@ -29,6 +25,11 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.util.User;
public class InventoryListener extends EventListener { public class InventoryListener extends EventListener {
@EventHandler @EventHandler
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.event; package com.rammelkast.anticheatreloaded.event;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@@ -51,20 +51,21 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.event.player.PlayerVelocityEvent; import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import net.gravitydevelopment.anticheat.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import net.gravitydevelopment.anticheat.check.combat.KillAuraCheck; import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import net.gravitydevelopment.anticheat.check.movement.FlightCheck; import com.rammelkast.anticheatreloaded.check.movement.ElytraFly;
import net.gravitydevelopment.anticheat.check.movement.GlideCheck; import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import net.gravitydevelopment.anticheat.check.movement.SpeedCheck; import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
import net.gravitydevelopment.anticheat.check.movement.WaterWalkCheck; import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
import net.gravitydevelopment.anticheat.check.movement.YAxisCheck; import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
import net.gravitydevelopment.anticheat.util.Distance; import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
import net.gravitydevelopment.anticheat.util.Permission; import com.rammelkast.anticheatreloaded.util.Distance;
import net.gravitydevelopment.anticheat.util.User; import com.rammelkast.anticheatreloaded.util.Permission;
import net.gravitydevelopment.anticheat.util.Utilities; import com.rammelkast.anticheatreloaded.util.User;
import net.gravitydevelopment.anticheat.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class PlayerListener extends EventListener { public class PlayerListener extends EventListener {
@@ -346,6 +347,12 @@ public class PlayerListener extends EventListener {
log(result.getMessage(), player, CheckType.FLY); log(result.getMessage(), player, CheckType.FLY);
} }
} }
if (getCheckManager().willCheckQuick(player, CheckType.FLY)) {
CheckResult result = ElytraFly.runCheck(player, distance);
if (result.failed()) {
log(result.getMessage(), player, CheckType.FLY);
}
}
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) { if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) {
CheckResult result = getBackend().checkVClip(player, new Distance(event.getFrom(), event.getTo())); CheckResult result = getBackend().checkVClip(player, new Distance(event.getFrom(), event.getTo()));
if (result.failed()) { if (result.failed()) {
@@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.event; package com.rammelkast.anticheatreloaded.event;
import net.gravitydevelopment.anticheat.AntiCheat;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.event.vehicle.VehicleExitEvent;
import com.rammelkast.anticheatreloaded.AntiCheat;
public class VehicleListener extends EventListener { public class VehicleListener extends EventListener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.manage; package com.rammelkast.anticheatreloaded.manage;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@@ -25,9 +25,9 @@ import java.util.logging.Logger;
import org.bukkit.plugin.RegisteredListener; import org.bukkit.plugin.RegisteredListener;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.check.Backend; import com.rammelkast.anticheatreloaded.check.Backend;
import net.gravitydevelopment.anticheat.config.Configuration; import com.rammelkast.anticheatreloaded.config.Configuration;
/** /**
* The internal hub for all managers. * The internal hub for all managers.
@@ -16,14 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.manage; package com.rammelkast.anticheatreloaded.manage;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.config.Configuration;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -16,16 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.manage; package com.rammelkast.anticheatreloaded.manage;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.util.FileFormatter;
import net.gravitydevelopment.anticheat.util.Permission;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.util.FileFormatter;
import com.rammelkast.anticheatreloaded.util.Permission;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@@ -1,9 +1,9 @@
package net.gravitydevelopment.anticheat.manage; package com.rammelkast.anticheatreloaded.manage;
import com.comphenix.protocol.Packets; import com.comphenix.protocol.Packets;
import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.*; import com.comphenix.protocol.events.*;
import net.gravitydevelopment.anticheat.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
public class PacketManager { public class PacketManager {
@@ -16,21 +16,23 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.manage; package com.rammelkast.anticheatreloaded.manage;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.util.Group;
import net.gravitydevelopment.anticheat.util.User;
import net.gravitydevelopment.anticheat.util.Utilities;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.BanList.Type;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.util.Group;
import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities;
public class UserManager { public class UserManager {
private List<User> users = new ArrayList<User>(); private List<User> users = new ArrayList<User>();
private static AntiCheatManager manager; private static AntiCheatManager manager;
@@ -228,6 +230,7 @@ public class UserManager {
} }
} else if (event.equalsIgnoreCase("KICK")) { } else if (event.equalsIgnoreCase("KICK")) {
user.getPlayer().kickPlayer(RED + kickReason); user.getPlayer().kickPlayer(RED + kickReason);
AntiCheat.getPlugin().onPlayerKicked();
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")"; String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) { if (!msg.equals("")) {
manager.log(msg); manager.log(msg);
@@ -241,7 +244,7 @@ public class UserManager {
} }
} }
} else if (event.equalsIgnoreCase("BAN")) { } else if (event.equalsIgnoreCase("BAN")) {
user.getPlayer().setBanned(true); Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), RED + banReason, null, null);
user.getPlayer().kickPlayer(RED + banReason); user.getPlayer().kickPlayer(RED + banReason);
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")"; String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) { if (!msg.equals("")) {
File diff suppressed because it is too large. Load diff
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import org.bukkit.Material; import org.bukkit.Material;
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import org.bukkit.Location; import org.bukkit.Location;
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@@ -16,11 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import net.gravitydevelopment.anticheat.AntiCheat;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import com.rammelkast.anticheatreloaded.AntiCheat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -0,0 +1,21 @@
package com.rammelkast.anticheatreloaded.util;
import java.util.EnumSet;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.potion.PotionEffectType;
public class NMS_1_9_PLUS {
static final EnumSet<Material> MOVE_UP_BLOCKS_1_9 = EnumSet.of(Material.ACACIA_STAIRS,
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
Material.RED_SANDSTONE_STAIRS, Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS,
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS, Material.PURPUR_STAIRS);
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
}
@@ -1,13 +1,13 @@
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_10_R1.CraftServer; import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
@@ -15,21 +15,21 @@ import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.rammelkast.anticheatreloaded.AntiCheat;
import net.gravitydevelopment.anticheat.AntiCheat; import net.minecraft.server.v1_12_R1.EntityHuman;
import net.minecraft.server.v1_10_R1.EntityHuman; import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_10_R1.EntityPlayer; import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_10_R1.MinecraftServer; import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_10_R1.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_12_R1.PlayerConnection;
import net.minecraft.server.v1_10_R1.PlayerConnection; import net.minecraft.server.v1_12_R1.PlayerInteractManager;
import net.minecraft.server.v1_10_R1.PlayerInteractManager; import net.minecraft.server.v1_12_R1.World;
import net.minecraft.server.v1_10_R1.World; import net.minecraft.server.v1_12_R1.WorldServer;
import net.minecraft.server.v1_10_R1.WorldServer;
public class NPC_1_10 { public class NPC_1_12 {
private final UUID owner; private final UUID owner;
private final String name; private final String name;
@@ -42,7 +42,7 @@ public class NPC_1_10 {
return this.entityId; return this.entityId;
} }
public NPC_1_10(Player owner) { public NPC_1_12(Player owner) {
this.owner = owner.getUniqueId(); this.owner = owner.getUniqueId();
this.name = NameGenerator.generateName(); this.name = NameGenerator.generateName();
Location eyelocation = owner.getEyeLocation(); Location eyelocation = owner.getEyeLocation();
@@ -81,7 +81,7 @@ public class NPC_1_10 {
vec.setZ(-3 * vec.getZ()); vec.setZ(-3 * vec.getZ());
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.teleportTo(back, false); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc)); ((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) { if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
this.npc.setInvisible(false); this.npc.setInvisible(false);
@@ -102,7 +102,7 @@ public class NPC_1_10 {
vec.setZ(-3 * vec.getZ()); vec.setZ(-3 * vec.getZ());
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.teleportTo(back, false); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc)); ((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
} }
} else if (e.getTo().getPitch() >= 22) { } else if (e.getTo().getPitch() >= 22) {
@@ -113,7 +113,7 @@ public class NPC_1_10 {
vec.setZ(-3 * vec.getZ()); vec.setZ(-3 * vec.getZ());
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.teleportTo(back, false); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc)); ((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
} else { } else {
Location eyelocation = e.getPlayer().getEyeLocation(); Location eyelocation = e.getPlayer().getEyeLocation();
@@ -129,7 +129,6 @@ public class NPC_1_10 {
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
this.npc.teleportTo(back, false);
((CraftPlayer) this.getOwner()).getHandle().playerConnection ((CraftPlayer) this.getOwner()).getHandle().playerConnection
.sendPacket(new PacketPlayOutEntityTeleport(npc)); .sendPacket(new PacketPlayOutEntityTeleport(npc));
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) { if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
@@ -168,7 +167,7 @@ public class NPC_1_10 {
} }
public void damage() { public void damage() {
if (this.npc == null) { if (this.npc == null || this.getOwner() == null) {
return; return;
} }
if (new Random().nextBoolean() && this.npc.isInvisible()) { if (new Random().nextBoolean() && this.npc.isInvisible()) {
@@ -1,4 +1,4 @@
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -12,7 +12,10 @@ public class NameGenerator {
"NoHax", "NoHax",
"Just", "Just",
"That", "That",
"New" "New",
"Ultra",
"Killer",
"Swift"
}); });
private static final List<String> END = Arrays.asList(new String[]{ private static final List<String> END = Arrays.asList(new String[]{
@@ -21,7 +24,12 @@ public class NameGenerator {
"JustYolo", "JustYolo",
"Gaming", "Gaming",
"Minecraft", "Minecraft",
"Games" "Games",
"Bawz",
"1",
"51",
"99",
"" + new Random().nextInt(100)
}); });
public static String generateName() { public static String generateName() {
@@ -1,4 +1,4 @@
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import java.util.Random; import java.util.Random;
@@ -16,17 +16,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.config.providers.Magic;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.providers.Magic;
import java.io.*; import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import org.bukkit.Material; import org.bukkit.Material;
@@ -16,18 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.util.rule.Rule;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.util.rule.Rule;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -16,9 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util; package com.rammelkast.anticheatreloaded.util;
import net.gravitydevelopment.anticheat.AntiCheat;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@@ -29,6 +28,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.NumberConversions; import org.bukkit.util.NumberConversions;
import com.rammelkast.anticheatreloaded.AntiCheat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -0,0 +1,61 @@
package com.rammelkast.anticheatreloaded.util;
import java.util.EnumSet;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class VersionUtil {
public static String getVersion() {
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
}
private static final EnumSet<Material> MOVE_UP_BLOCKS_1_8 = EnumSet.of(Material.ACACIA_STAIRS,
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
Material.RED_SANDSTONE_STAIRS, Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS,
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
public static boolean isFlying(Player p) {
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
} else {
return p.isFlying();
}
}
public static EnumSet<Material> getMoveUpBlocks() {
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
} else {
return MOVE_UP_BLOCKS_1_8;
}
}
public static boolean isNewYSpeed() {
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return true;
} else {
return false;
}
}
public static long getHealTime() {
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return 495;
} else {
return 1995;
}
}
public static boolean isFrostWalk(Player player) {
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
} else {
return false;
}
}
}
@@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util.enterprise; package com.rammelkast.anticheatreloaded.util.enterprise;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.util.User;
import net.gravitydevelopment.anticheat.util.Utilities;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@@ -16,14 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util.rule; package com.rammelkast.anticheatreloaded.util.rule;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.util.User;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager; import javax.script.ScriptEngineManager;
import javax.script.ScriptException; import javax.script.ScriptException;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.util.User;
import java.util.SortedMap; import java.util.SortedMap;
/** /**
@@ -42,7 +43,7 @@ import java.util.SortedMap;
* Check_SPIDER > 0 ? Player.KICK : null<br /> * Check_SPIDER > 0 ? Player.KICK : null<br />
* <i>The above statement would read 'If the spider check has been failed over zero times, kick the player. Otherwise, do nothing.'</i> * <i>The above statement would read 'If the spider check has been failed over zero times, kick the player. Otherwise, do nothing.'</i>
* <p/> * <p/>
* To see syntax for variables and functions that you may use, see {@link net.gravitydevelopment.anticheat.util.rule.Rule} * To see syntax for variables and functions that you may use, see {@link com.rammelkast.anticheatreloaded.util.rule.Rule}
*/ */
public class ConditionalRule extends Rule { public class ConditionalRule extends Rule {
@@ -16,15 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package net.gravitydevelopment.anticheat.util.rule; package com.rammelkast.anticheatreloaded.util.rule;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckType;
import net.gravitydevelopment.anticheat.util.User;
import net.gravitydevelopment.anticheat.util.Group;
import net.gravitydevelopment.anticheat.util.Utilities;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.util.Group;
import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -44,7 +45,7 @@ import java.util.TreeMap;
* <ul> * <ul>
* <li>Check * <li>Check
* <ul> * <ul>
* <li>Contains all valid checks as listed in {@link net.gravitydevelopment.anticheat.check.CheckType}</li> * <li>Contains all valid checks as listed in {@link com.rammelkast.anticheatreloaded.check.CheckType}</li>
* <li>Will return the number of times this user has failed the given check</li> * <li>Will return the number of times this user has failed the given check</li>
* <li><b>Example:</b> Check_SPRINT</li> * <li><b>Example:</b> Check_SPRINT</li>
* </ul> * </ul>
@@ -76,7 +77,7 @@ import java.util.TreeMap;
* <p/> * <p/>
* The Rule class itself is not an functional rule setup, * The Rule class itself is not an functional rule setup,
* it is inherited and made functional by different implementations of the rule parser.<br /> * it is inherited and made functional by different implementations of the rule parser.<br />
* The only current Rule implementation is the {@link net.gravitydevelopment.anticheat.util.rule.ConditionalRule} * The only current Rule implementation is the {@link com.rammelkast.anticheatreloaded.util.rule.ConditionalRule}
*/ */
public class Rule { public class Rule {
@@ -145,7 +146,7 @@ public class Rule {
/** /**
* Get the type of rule this is * Get the type of rule this is
* *
* @return a {@link net.gravitydevelopment.anticheat.util.rule.Rule.Type} * @return a {@link com.rammelkast.anticheatreloaded.util.rule.Rule.Type}
*/ */
public Type getType() { public Type getType() {
return type; return type;
@@ -1,215 +0,0 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.gravitydevelopment.anticheat;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import net.gravitydevelopment.anticheat.check.combat.KillAuraCheck;
import net.gravitydevelopment.anticheat.check.movement.BlinkCheck;
import net.gravitydevelopment.anticheat.command.CommandHandler;
import net.gravitydevelopment.anticheat.config.Configuration;
import net.gravitydevelopment.anticheat.event.BlockListener;
import net.gravitydevelopment.anticheat.event.EntityListener;
import net.gravitydevelopment.anticheat.event.InventoryListener;
import net.gravitydevelopment.anticheat.event.PlayerListener;
import net.gravitydevelopment.anticheat.event.VehicleListener;
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
import net.gravitydevelopment.anticheat.util.User;
import net.gravitydevelopment.anticheat.util.VersionUtil;
public class AntiCheat extends JavaPlugin {
private static AntiCheatManager manager;
private static AntiCheat plugin;
private static List<Listener> eventList = new ArrayList<Listener>();
private static Configuration config;
private static boolean verbose;
private static boolean developer;
private static final int PROJECT_ID = 100229;
private static ProtocolManager protocolManager;
private static boolean protocolLib = false;
private static Long loadTime;
@Override
public void onEnable() {
plugin = this;
loadTime = System.currentTimeMillis();
manager = new AntiCheatManager(this, getLogger());
eventList.add(new PlayerListener());
eventList.add(new BlockListener());
eventList.add(new EntityListener());
eventList.add(new VehicleListener());
eventList.add(new InventoryListener());
// Order is important in some cases, don't screw with these unless needed, especially config
setupConfig();
setupEvents();
setupCommands();
setupProtocol();
// Enterprise must come before levels
setupEnterprise();
restoreLevels();
// Check if NoCheatPlus is installed
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
public void run() {
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
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.");
}else if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
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.");
}
}
}, 40L);
// End tests
verboseLog("Finished loading.");
getLogger().info("Running version " + VersionUtil.getVersion() + "...");
// Enable packetlisteners
KillAuraCheck.listenPackets();
BlinkCheck.startTimer();
BlinkCheck.listenPackets();
}
@Override
public void onDisable() {
verboseLog("Saving user levels...");
config.getLevels().saveLevelsFromUsers(getManager().getUserManager().getUsers());
AntiCheatManager.close();
getServer().getScheduler().cancelTasks(this);
cleanup();
}
private void setupProtocol() {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
protocolLib = true;
protocolManager = ProtocolLibrary.getProtocolManager();
verboseLog("Hooked into ProtocolLib");
}
}
private void setupEvents() {
for (Listener listener : eventList) {
getServer().getPluginManager().registerEvents(listener, this);
verboseLog("Registered events for ".concat(listener.toString().split("@")[0].split(".anticheat.")[1]));
}
}
private void setupCommands() {
getCommand("anticheat").setExecutor(new CommandHandler());
verboseLog("Registered commands.");
}
private void setupConfig() {
config = manager.getConfiguration();
verboseLog("Setup the config.");
}
private void setupEnterprise() {
if (config.getConfig().enterprise.getValue()) {
if (config.getEnterprise().loggingEnabled.getValue()) {
config.getEnterprise().database.cleanEvents();
}
}
}
private void restoreLevels() {
for (Player player : getServer().getOnlinePlayers()) {
UUID uuid = player.getUniqueId();
User user = new User(uuid);
user.setIsWaitingOnLevelSync(true);
config.getLevels().loadLevelToUser(user);
manager.getUserManager().addUser(user);
verboseLog("Data for " + uuid + " loaded");
}
}
public static AntiCheat getPlugin() {
return plugin;
}
public static AntiCheatManager getManager() {
return manager;
}
public static String getVersion() {
return manager.getPlugin().getDescription().getVersion();
}
private void cleanup() {
eventList = null;
manager = null;
config = null;
}
public static boolean developerMode() {
return developer;
}
public static void setDeveloperMode(boolean b) {
developer = b;
}
public static boolean isUsingProtocolLib() {
return protocolLib;
}
public static void debugLog(final String string) {
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
public void run() {
if (developer) {
manager.debugLog("[DEBUG] " + string);
}
}
});
}
public void verboseLog(final String string) {
if (verbose) {
getLogger().info(string);
}
}
public void setVerbose(boolean b) {
verbose = b;
}
public Long getLoadTime() {
return loadTime;
}
public static ProtocolManager getProtocolManager() {
return protocolManager;
}
}
@@ -1,86 +0,0 @@
package net.gravitydevelopment.anticheat.check.movement;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult;
import net.gravitydevelopment.anticheat.util.Distance;
import net.gravitydevelopment.anticheat.util.Utilities;
import net.gravitydevelopment.anticheat.util.VersionUtil;
/**
*
* @author Marco
* TODO rewrite this check
*/
public class FlightCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> blocksOverFlight = new HashMap<UUID, Double>();
public static Map<UUID, Long> movingExempt = new HashMap<UUID, Long>();
public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN() || VersionUtil.isFlying(player)) {
// This was a teleport, so we don't care about it.
return PASS;
}
final UUID uuid = player.getUniqueId();
final double y1 = distance.fromY();
final double y2 = distance.toY();
if (!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})) {
if (!blocksOverFlight.containsKey(uuid)) {
blocksOverFlight.put(uuid, 0D);
}
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) + distance.getXDifference() + distance.getYDifference() + distance.getZDifference()));
if (y1 > y2) {
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) - distance.getYDifference()));
}
if (blocksOverFlight.get(uuid) > AntiCheat.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() && (y1 <= y2)) {
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " flew over " + blocksOverFlight.get(uuid) + " blocks (max=" + AntiCheat.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
}
} else {
blocksOverFlight.put(uuid, 0D);
}
return PASS;
}
public static boolean isMovingExempt(Player player) {
return isDoing(player, movingExempt, -1);
}
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
if (map.containsKey(player.getUniqueId())) {
if (max != -1) {
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
map.remove(player.getUniqueId());
return false;
} else {
return true;
}
} else {
// Termination time has already been calculated
if (map.get(player.getUniqueId()) < System.currentTimeMillis()) {
map.remove(player.getUniqueId());
return false;
} else {
return true;
}
}
} else {
return false;
}
}
}
@@ -1,75 +0,0 @@
package net.gravitydevelopment.anticheat.check.movement;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult;
import net.gravitydevelopment.anticheat.util.Distance;
import net.gravitydevelopment.anticheat.util.Utilities;
/**
*
* @author Marco STILL IN ALPHA TESTING!
* TODO fix false positives
*/
public class GlideCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> lastYDelta = new HashMap<UUID, Double>();
public static Map<UUID, Integer> glideBuffer = new HashMap<UUID, Integer>();
public static CheckResult runCheck(Player player, Distance distance) {
UUID uuid = player.getUniqueId();
if(!lastYDelta.containsKey(uuid))
lastYDelta.put(uuid, 0.0);
if(!YAxisCheck.lastYcoord.containsKey(uuid))
YAxisCheck.lastYcoord.put(uuid, player.getLocation().getY());
double currentY = player.getLocation().getY();
double math = currentY - YAxisCheck.lastYcoord.get(uuid);
if((math < 0 && math > AntiCheat.getManager().getBackend().getMagic().GLIDE_MAX()) && !AntiCheat.getManager().getBackend().isMovingExempt(player))
{
if(math <= lastYDelta.get(uuid) && !(player.getEyeLocation().getBlock().getType() == Material.LADDER)
&& !Utilities.isInWater(player) && !Utilities.isInWeb(player)
&& Utilities.cantStandAt(player.getLocation().getBlock()) && !Utilities.cantStandAtSingle(player.getLocation().getBlock()) && !!Utilities.cantStandAtSingle(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
if(!glideBuffer.containsKey(uuid))
glideBuffer.put(uuid, 0);
int currentBuffer = glideBuffer.get(uuid);
glideBuffer.put(uuid, currentBuffer + 1);
if(currentBuffer >= AntiCheat.getManager().getBackend().getMagic().GLIDE_LIMIT())
{
double fallDist = distanceToFall(player.getLocation());
player.teleport(player.getLocation().add(0, -fallDist, 0));
player.setFallDistance((float) fallDist);
if(!AntiCheat.getManager().getBackend().silentMode())
{
player.sendMessage(ChatColor.RED + "[AntiCheat] Glide/Fly hacking detected.");
}
lastYDelta.put(uuid, math);
return new CheckResult(CheckResult.Result.FAILED, uuid + " attempted to fall too slowly!");
}
}
}else {
glideBuffer.remove(uuid);
}
lastYDelta.put(uuid, math);
return PASS;
}
private static double distanceToFall(Location location) {
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();
}
}
@@ -1,90 +0,0 @@
package net.gravitydevelopment.anticheat.check.movement;
import java.util.ArrayList;
import java.util.HashMap;
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 net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult;
import net.gravitydevelopment.anticheat.util.Utilities;
/**
* This check seems to be broken/outdated
*/
public class WaterWalkCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static List<UUID> isInWater = new ArrayList<UUID>();
public static List<UUID> isInWaterCache = new ArrayList<UUID>();
public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>();
public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>();
public static CheckResult runCheck(Player player, double x, double y, double z) {
Block block = player.getLocation().getBlock();
UUID uuid = player.getUniqueId();
if (player.getVehicle() == null && !player.isFlying()) {
if (block.isLiquid()) {
if (isInWater.contains(uuid)) {
if (isInWaterCache.contains(uuid)) {
if (player.getNearbyEntities(1, 1, 1).isEmpty()) {
boolean b;
if (!Utilities.sprintFly(player)) {
b = x > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER() || z > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER();
} else {
b = x > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT() || z > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT();
}
if (!b && !Utilities.isFullyInWater(player.getLocation()) && Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D && !block.getType().equals(Material.WATER_LILY)) {
b = true;
}
if (b) {
if (waterSpeedViolation.containsKey(uuid)) {
int v = waterSpeedViolation.get(uuid);
if (v >= AntiCheat.getManager().getBackend().getMagic().WATER_SPEED_VIOLATION_MAX()) {
waterSpeedViolation.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() + ")");
} else {
waterSpeedViolation.put(uuid, v + 1);
}
} else {
waterSpeedViolation.put(uuid, 1);
}
}
}
} else {
isInWaterCache.add(uuid);
return PASS;
}
} else {
isInWater.add(uuid);
return PASS;
}
} else if (block.getRelative(BlockFace.DOWN).isLiquid() && !AntiCheat.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block) && Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))) {
if (waterAscensionViolation.containsKey(uuid)) {
int v = waterAscensionViolation.get(uuid);
if (v >= AntiCheat.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
waterAscensionViolation.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() + ")");
} else {
waterAscensionViolation.put(uuid, v + 1);
}
} else {
waterAscensionViolation.put(uuid, 1);
}
} else {
isInWater.remove(uuid);
isInWaterCache.remove(uuid);
}
}
return PASS;
}
}
@@ -1,112 +0,0 @@
package net.gravitydevelopment.anticheat.check.movement;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import net.gravitydevelopment.anticheat.AntiCheat;
import net.gravitydevelopment.anticheat.check.CheckResult;
import net.gravitydevelopment.anticheat.util.Distance;
import net.gravitydevelopment.anticheat.util.Utilities;
import net.gravitydevelopment.anticheat.util.VersionUtil;
public class YAxisCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> lastYcoord = new HashMap<UUID, Double>();
public static Map<UUID, Long> lastYtime = new HashMap<UUID, Long>();
public static Map<UUID, Integer> yAxisViolations = new HashMap<UUID, Integer>();
public static Map<UUID, Long> yAxisLastViolation = new HashMap<UUID, Long>();
private static boolean hasJumpPotion(Player player) {
return player.hasPotionEffect(PotionEffectType.JUMP);
}
public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN() || distance.getYDifference() < 0 || VersionUtil.isFlying(player)) {
return PASS;
}
if (!FlightCheck.isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock()) && !player.isInsideVehicle() && !Utilities.isInWater(player) && !hasJumpPotion(player) && !isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) && !isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) {
double y1 = player.getLocation().getY();
UUID uuid = player.getUniqueId();
// Fix Y axis spam.
if (!lastYcoord.containsKey(uuid) || !lastYtime.containsKey(uuid) || !yAxisLastViolation.containsKey(uuid)) {
lastYcoord.put(uuid, y1);
yAxisViolations.put(uuid, 0);
yAxisLastViolation.put(uuid, 0L);
lastYtime.put(uuid, System.currentTimeMillis());
} else {
if (y1 > lastYcoord.get(uuid) && yAxisViolations.get(uuid) > AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() && (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) < AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
Location g = player.getLocation();
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
yAxisLastViolation.put(uuid, System.currentTimeMillis());
if (!AntiCheat.getManager().getBackend().silentMode()) {
g.setY(lastYcoord.get(uuid));
player.sendMessage(ChatColor.RED + "[AntiCheat] Fly hacking on the y-axis detected. Please wait 5 seconds to prevent getting damage.");
if (g.getBlock().getType() == Material.AIR) {
player.teleport(g);
}
}
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis " + yAxisViolations.get(uuid) + " times (max =" + AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
} else {
if (yAxisViolations.get(uuid) > AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() && (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
yAxisViolations.put(uuid, 0);
yAxisLastViolation.put(uuid, 0L);
}
}
long i = System.currentTimeMillis() - lastYtime.get(uuid);
double diff = AntiCheat.getManager().getBackend().getMagic().Y_MAXDIFF() + (Utilities.isStair(player.getLocation().add(0, -1, 0).getBlock()) ? 0.5 : 0.0);
if ((y1 - lastYcoord.get(uuid)) > diff && i < AntiCheat.getManager().getBackend().getMagic().Y_TIME()) {
Location g = player.getLocation();
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
yAxisLastViolation.put(uuid, System.currentTimeMillis());
if (!AntiCheat.getManager().getBackend().silentMode()) {
g.setY(lastYcoord.get(uuid));
if (g.getBlock().getType() == Material.AIR) {
player.teleport(g);
}
}
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis in " + i + " ms (min =" + AntiCheat.getManager().getBackend().getMagic().Y_TIME() + ")");
} else {
if ((y1 - lastYcoord.get(uuid)) > AntiCheat.getManager().getBackend().getMagic().Y_MAXDIFF() + 1 || (System.currentTimeMillis() - lastYtime.get(uuid)) > AntiCheat.getManager().getBackend().getMagic().Y_TIME()) {
lastYtime.put(uuid, System.currentTimeMillis());
lastYcoord.put(uuid, y1);
}
}
}
}
// Fix Y axis spam
return PASS;
}
public static boolean isMoveUpBlock(Block block) {
return MOVE_UP_BLOCKS.contains(block.getType());
}
private static final EnumSet<Material> MOVE_UP_BLOCKS = EnumSet.of(
Material.ACACIA_STAIRS,
Material.BIRCH_WOOD_STAIRS,
Material.BRICK_STAIRS,
Material.COBBLESTONE_STAIRS,
Material.DARK_OAK_STAIRS,
Material.JUNGLE_WOOD_STAIRS,
Material.NETHER_BRICK_STAIRS,
Material.QUARTZ_STAIRS,
Material.RED_SANDSTONE_STAIRS,
Material.SANDSTONE_STAIRS,
Material.SMOOTH_STAIRS,
Material.SPRUCE_WOOD_STAIRS,
Material.WOOD_STAIRS,
Material.PURPUR_STAIRS
);
}
@@ -1,20 +0,0 @@
package net.gravitydevelopment.anticheat.util;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class VersionUtil {
public static String getVersion() {
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
}
public static boolean isFlying(Player p) {
if (getVersion().equals("v1_8_R3")) {
return p.isFlying();
}else {
return p.isFlying() || p.isGliding();
}
}
}
+2 -4
View File
@@ -40,7 +40,6 @@ FASTPLACE_TIMEMIN: 50
FASTPLACE_ZEROLIMIT: 3 FASTPLACE_ZEROLIMIT: 3
FLIGHT_BLOCK_LIMIT: 15.0 FLIGHT_BLOCK_LIMIT: 15.0
FLIGHT_LIMIT: 150 FLIGHT_LIMIT: 150
HEAL_TIME_MIN: 2000
INSTANT_BREAK_TIME: 2 INSTANT_BREAK_TIME: 2
INVENTORY_CHECK: 10 INVENTORY_CHECK: 10
INVENTORY_TIMEMIN: 50 INVENTORY_TIMEMIN: 50
@@ -84,7 +83,6 @@ Y_MAXVIOTIME: 5500
Y_SPEED_MAX: 0.5125 Y_SPEED_MAX: 0.5125
Y_TIME: 800 Y_TIME: 800
GLIDE_LIMIT: 10 GLIDE_LIMIT: 10
GLIDE_MAX: -3.75 KILLAURA_BOTHITS: 4
KILLAURA_BOTHITS: 5 BLINK_PACKET: 74
BLINK_PACKET: 75
VELOCITY_AMT: 5 VELOCITY_AMT: 5
+2 -3
View File
@@ -1,10 +1,9 @@
name: AntiCheatReloaded name: AntiCheatReloaded
author: Rammelkast author: Rammelkast
description: AntiCheatReloaded helps easily identify and block malicious users on your server. description: AntiCheatReloaded helps easily identify and block malicious users on your server.
main: net.gravitydevelopment.anticheat.AntiCheat main: com.rammelkast.anticheatreloaded.AntiCheat
softdepend: [ProtocolLib] depend: [ProtocolLib]
startup: postworld startup: postworld
url: http://gravitydevelopment.net
version: ${project.build.version} version: ${project.build.version}
commands: commands:
anticheat: anticheat: