mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f609758d28 | ||
|
|
2d064ee849 | ||
|
|
717b7acb67 | ||
|
|
2617aa1225 | ||
|
|
dd8c495ee6 | ||
|
|
09ddbfba8f | ||
|
|
7f13a0ad4c | ||
|
|
21d0108c16 | ||
|
|
15181ab6ad | ||
|
|
347eec8ff0 | ||
|
|
518e4c32e7 | ||
|
|
583d2de244 | ||
|
|
792a4ae0a5 | ||
|
|
406ba01523 | ||
|
|
b2571a32f1 | ||
|
|
52b96bedc4 | ||
|
|
01602e187c | ||
|
|
db13527498 | ||
|
|
1e4aaab2c0 | ||
|
|
3baa074b6f | ||
|
|
b264bb1e43 | ||
|
|
57d7ee9b62 | ||
|
|
24125e9195 | ||
|
|
eca5a60d22 | ||
|
|
8e4cef9a7d | ||
|
|
db821e4809 | ||
|
|
c229252f7a | ||
|
|
93a5595bb1 |
No files matched your search
@@ -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!
|
||||
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
|
||||
-------
|
||||
* Blink
|
||||
@@ -29,15 +45,4 @@ My BTC address is 1JfyX6hvGUazHTtKVLaNcYaUxnyjR5HtMY
|
||||
* FastBreak
|
||||
* FastPlace
|
||||
* Spam
|
||||
* 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.
|
||||
* FastEat
|
||||
@@ -1,9 +1,9 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.gravitydevelopment.anticheat</groupId>
|
||||
<artifactId>AntiCheat</artifactId>
|
||||
<version>1.5.2-ALPHA</version>
|
||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.6.2-ALPHA</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://rammelkast.com</url>
|
||||
<properties>
|
||||
@@ -11,13 +11,9 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>http://maven.elmakers.com/repository/</url>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>http://repo.dmulloy2.net/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
@@ -28,8 +24,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -47,7 +43,7 @@
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>net.gravitydevelopment.*</include>
|
||||
<include>com.rammelkast.*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
@@ -85,7 +81,7 @@
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.1.0-SNAPSHOT</version>
|
||||
<version>4.2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@@ -97,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.11-R0.1-SNAPSHOT</version>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
}
|
||||
+9
-9
@@ -16,18 +16,18 @@
|
||||
* 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 org.bukkit.entity.Player;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
|
||||
import net.gravitydevelopment.anticheat.manage.CheckManager;
|
||||
import net.gravitydevelopment.anticheat.manage.UserManager;
|
||||
import net.gravitydevelopment.anticheat.util.Group;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
||||
import com.rammelkast.anticheatreloaded.util.Group;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return The player's group
|
||||
@@ -159,7 +159,7 @@ public class AntiCheatAPI {
|
||||
* Get all configured Groups
|
||||
*
|
||||
* @return List of all groups
|
||||
* @see net.gravitydevelopment.anticheat.util.Group
|
||||
* @see com.rammelkast.anticheatreloaded.util.Group
|
||||
*/
|
||||
public static List<Group> getGroups() {
|
||||
return getManager().getConfiguration().getGroups().getGroups();
|
||||
+8
-7
@@ -16,13 +16,14 @@
|
||||
* 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.HandlerList;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
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() {
|
||||
return type;
|
||||
+33
-34
@@ -16,7 +16,7 @@
|
||||
* 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.HashMap;
|
||||
@@ -25,7 +25,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -37,23 +36,23 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.combat.KillAuraCheck;
|
||||
import net.gravitydevelopment.anticheat.check.combat.VelocityCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.BlinkCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.FlightCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.GlideCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.SpeedCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.WaterWalkCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.YAxisCheck;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.config.providers.Lang;
|
||||
import net.gravitydevelopment.anticheat.config.providers.Magic;
|
||||
import net.gravitydevelopment.anticheat.manage.AntiCheatManager;
|
||||
import net.gravitydevelopment.anticheat.util.Distance;
|
||||
import net.gravitydevelopment.anticheat.util.User;
|
||||
import net.gravitydevelopment.anticheat.util.Utilities;
|
||||
import net.gravitydevelopment.anticheat.util.VersionUtil;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class Backend {
|
||||
private List<UUID> isAscending = new ArrayList<UUID>();
|
||||
@@ -170,13 +169,17 @@ public class Backend {
|
||||
inventoryTime.remove(pU);
|
||||
inventoryClicks.remove(pU);
|
||||
lastFallPacket.remove(pU);
|
||||
GlideCheck.lastYDelta.remove(pU);
|
||||
GlideCheck.glideBuffer.remove(pU);
|
||||
GlideCheck.lastDiff.remove(pU);
|
||||
GlideCheck.lastFallDistance.remove(pU);
|
||||
GlideCheck.violations.remove(pU);
|
||||
SpeedCheck.speedViolation.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public CheckResult checkFastBow(Player player, float force) {
|
||||
// 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);
|
||||
bowWindUp.remove(player.getUniqueId());
|
||||
float f = (float) ticks / 20.0F;
|
||||
@@ -258,7 +261,7 @@ public class Backend {
|
||||
}
|
||||
|
||||
public CheckResult checkYSpeed(Player player, double y) {
|
||||
if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && y > magic.Y_SPEED_MAX() && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
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() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
@@ -291,7 +294,7 @@ public class Backend {
|
||||
}
|
||||
|
||||
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;
|
||||
if (i != -1) {
|
||||
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";
|
||||
}
|
||||
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 (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) {
|
||||
increment(player, ascensionCount, max);
|
||||
@@ -457,9 +460,6 @@ public class Backend {
|
||||
int i = fastBreakViolation.get(uuid);
|
||||
if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) {
|
||||
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 + ")");
|
||||
} else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) {
|
||||
fastBreakViolation.put(uuid, 0);
|
||||
@@ -521,9 +521,6 @@ public class Backend {
|
||||
AntiCheat.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
|
||||
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
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 + ")");
|
||||
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
AntiCheat.debugLog("Reset facePlaceViolation for " + uuid);
|
||||
@@ -655,10 +652,11 @@ public class Backend {
|
||||
public CheckResult checkFastHeal(Player player) {
|
||||
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());
|
||||
lastHeal.remove(player.getUniqueId());
|
||||
if ((System.currentTimeMillis() - l) < magic.HEAL_TIME_MIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + magic.HEAL_TIME_MIN() + " ms)");
|
||||
if ((System.currentTimeMillis() - l) < healTime) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
@@ -779,8 +777,9 @@ public class Backend {
|
||||
YAxisCheck.yAxisLastViolation.remove(player.getUniqueId());
|
||||
YAxisCheck.lastYcoord.remove(player.getUniqueId());
|
||||
YAxisCheck.lastYtime.remove(player.getUniqueId());
|
||||
GlideCheck.lastYDelta.remove(player.getUniqueId());
|
||||
GlideCheck.glideBuffer.remove(player.getUniqueId());
|
||||
GlideCheck.lastFallDistance.remove(player.getUniqueId());
|
||||
GlideCheck.lastDiff.remove(player.getUniqueId());
|
||||
GlideCheck.violations.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
public void logExitFly(final Player player) {
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* 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 {
|
||||
|
||||
+5
-4
@@ -16,14 +16,15 @@
|
||||
* 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.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.Map;
|
||||
import java.util.UUID;
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package net.gravitydevelopment.anticheat.check.combat;
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import org.bukkit.Material;
|
||||
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.potion.PotionEffectType;
|
||||
|
||||
import net.gravitydevelopment.anticheat.check.CheckResult;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.event.EventListener;
|
||||
import net.gravitydevelopment.anticheat.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class CriticalsCheck {
|
||||
|
||||
+13
-13
@@ -1,10 +1,9 @@
|
||||
package net.gravitydevelopment.anticheat.check.combat;
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@@ -13,20 +12,19 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.CheckResult;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.event.EventListener;
|
||||
import net.gravitydevelopment.anticheat.util.NPC_1_11;
|
||||
import net.gravitydevelopment.anticheat.util.VersionUtil;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.NPC_1_12;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
*/
|
||||
public class KillAuraCheck {
|
||||
|
||||
private static final Map<UUID, NPC_1_11> NPC_LIST = new HashMap<UUID, NPC_1_11>();
|
||||
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>();
|
||||
|
||||
public static void cleanPlayer(Player p) {
|
||||
@@ -58,7 +56,8 @@ public class KillAuraCheck {
|
||||
}else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -73,7 +72,7 @@ public class KillAuraCheck {
|
||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
||||
NPC_LIST.get(p.getUniqueId()).damage(e, p);
|
||||
else {
|
||||
NPC_1_11 npc = new NPC_1_11(p);
|
||||
NPC_1_12 npc = new NPC_1_12(p);
|
||||
NPC_LIST.put(p.getUniqueId(), npc);
|
||||
npc.spawn();
|
||||
}
|
||||
@@ -83,8 +82,9 @@ public class KillAuraCheck {
|
||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId()))
|
||||
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) {
|
||||
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
package net.gravitydevelopment.anticheat.check.combat;
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -9,10 +9,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.CheckResult;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
public class VelocityCheck {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class VelocityCheck {
|
||||
else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
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());
|
||||
}
|
||||
}
|
||||
+10
-11
@@ -1,10 +1,9 @@
|
||||
package net.gravitydevelopment.anticheat.check.movement;
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -13,11 +12,10 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.CheckResult;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
@@ -32,7 +30,7 @@ public class BlinkCheck {
|
||||
public void run() {
|
||||
MOVE_COUNT.clear();
|
||||
}
|
||||
}.runTaskTimer(AntiCheat.getPlugin(), 0, 20);
|
||||
}.runTaskTimer(AntiCheat.getPlugin(), 20, 20);
|
||||
}
|
||||
|
||||
public static void listenPackets() {
|
||||
@@ -41,17 +39,18 @@ public class BlinkCheck {
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
Location cur = e.getPlayer().getLocation();
|
||||
if (!MOVE_COUNT.containsKey(p.getUniqueId()))
|
||||
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
|
||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
||||
else {
|
||||
} else {
|
||||
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()) {
|
||||
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());
|
||||
e.setCancelled(true);
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
package net.gravitydevelopment.anticheat.check.movement;
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -8,9 +8,9 @@ import org.bukkit.Material;
|
||||
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.VersionUtil;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class SpeedCheck {
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SpeedCheck {
|
||||
reason = "on soulsand ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
|
||||
}
|
||||
} else if (player.isFlying()) {
|
||||
} else if (VersionUtil.isFlying(player)) {
|
||||
reason = "while flying ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY();
|
||||
} 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?
|
||||
|
||||
}
|
||||
+6
-6
@@ -16,7 +16,7 @@
|
||||
* 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.ChatColor;
|
||||
@@ -24,11 +24,11 @@ import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.manage.CheckManager;
|
||||
import net.gravitydevelopment.anticheat.manage.UserManager;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandBase {
|
||||
|
||||
+9
-9
@@ -16,7 +16,7 @@
|
||||
* 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.List;
|
||||
@@ -25,14 +25,14 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandCheck;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandDebug;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandDeveloper;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandHelp;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandLog;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandReload;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandReport;
|
||||
import net.gravitydevelopment.anticheat.command.executors.CommandReset;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandDebug;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandDeveloper;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandReload;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandReport;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandReset;
|
||||
|
||||
public class CommandHandler implements CommandExecutor {
|
||||
|
||||
+5
-4
@@ -16,13 +16,14 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandCheck extends CommandBase {
|
||||
+5
-4
@@ -16,15 +16,16 @@
|
||||
* 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.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.PastebinReport;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandDebug extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Debug Reporting";
|
||||
+5
-4
@@ -16,13 +16,14 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandDeveloper extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Developer Mode";
|
||||
+4
-3
@@ -16,12 +16,13 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandHelp extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheatReloaded Help";
|
||||
+5
-4
@@ -16,13 +16,14 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandLog extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Logging";
|
||||
+4
-3
@@ -16,12 +16,13 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandReload extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheat Reload";
|
||||
+7
-6
@@ -16,18 +16,19 @@
|
||||
* 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.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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.List;
|
||||
import java.util.UUID;
|
||||
+6
-6
@@ -16,17 +16,17 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.command.executors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
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 {
|
||||
|
||||
private static final String NAME = "AntiCheat Resetting";
|
||||
+9
-8
@@ -16,17 +16,18 @@
|
||||
* 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 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.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
+12
-4
@@ -16,15 +16,17 @@
|
||||
* 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.YamlConfiguration;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.config.yaml.CommentedConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class ConfigurationFile {
|
||||
|
||||
@@ -58,7 +60,13 @@ public class ConfigurationFile {
|
||||
this.saveDefault = 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();
|
||||
}
|
||||
+4
-3
@@ -16,12 +16,13 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.util.enterprise.Database;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
+5
-5
@@ -16,14 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.config.files;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
|
||||
package com.rammelkast.anticheatreloaded.config.files;
|
||||
|
||||
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 static final String FILENAME = "config.yml";
|
||||
+5
-5
@@ -16,12 +16,12 @@
|
||||
* 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 net.gravitydevelopment.anticheat.util.enterprise.Database;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.util.enterprise.Database;
|
||||
|
||||
public class Enterprise extends ConfigurationFile {
|
||||
|
||||
+6
-6
@@ -16,12 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.mysql;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@@ -29,6 +24,11 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
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 {
|
||||
|
||||
private static final String TABLE = "groups";
|
||||
+15
-6
@@ -16,15 +16,18 @@
|
||||
* 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.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.Method;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -49,7 +52,13 @@ public class MySQLLangHolder extends ConfigurationTable implements InvocationHan
|
||||
|
||||
@Override
|
||||
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>();
|
||||
listValues = new HashMap<String, List<String>>();
|
||||
+7
-6
@@ -16,15 +16,16 @@
|
||||
* 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 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.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
+15
-6
@@ -16,15 +16,18 @@
|
||||
* 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.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.Method;
|
||||
import java.sql.ResultSet;
|
||||
@@ -46,7 +49,13 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
|
||||
|
||||
@Override
|
||||
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>();
|
||||
doubles = new HashMap<String, Double>();
|
||||
+7
-7
@@ -16,19 +16,19 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.mysql;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
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 {
|
||||
|
||||
private static final String TABLE = "rules";
|
||||
+7
-7
@@ -16,16 +16,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
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 static final String FILENAME = "groups.yml";
|
||||
+5
-5
@@ -16,16 +16,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.config.holders.yaml;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
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 static final String FILENAME = "lang.yml";
|
||||
+7
-7
@@ -16,17 +16,17 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import java.util.List;
|
||||
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 static final String FILENAME = "data/levels.yml";
|
||||
+5
-5
@@ -16,15 +16,15 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.config.holders.yaml;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import net.gravitydevelopment.anticheat.config.ConfigurationFile;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
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 static final String FILENAME = "magic.yml";
|
||||
+7
-7
@@ -16,17 +16,17 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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 static final String FILENAME = "rules.yml";
|
||||
+3
-3
@@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.config.providers;
|
||||
|
||||
import net.gravitydevelopment.anticheat.util.Group;
|
||||
package com.rammelkast.anticheatreloaded.config.providers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.util.Group;
|
||||
|
||||
public interface Groups {
|
||||
|
||||
/**
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package net.gravitydevelopment.anticheat.config.providers;
|
||||
package com.rammelkast.anticheatreloaded.config.providers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+3
-3
@@ -16,12 +16,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.config.providers;
|
||||
|
||||
import net.gravitydevelopment.anticheat.util.User;
|
||||
package com.rammelkast.anticheatreloaded.config.providers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
public interface Levels {
|
||||
|
||||
/**
|
||||
+1
-9
@@ -16,7 +16,7 @@
|
||||
* 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.
|
||||
@@ -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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -257,10 +253,6 @@ public interface Magic {
|
||||
* Minimum time in between block placing; Type=INTEGER, Leniency=DECREASE.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
+3
-3
@@ -17,12 +17,12 @@
|
||||
*/
|
||||
|
||||
|
||||
package net.gravitydevelopment.anticheat.config.providers;
|
||||
|
||||
import net.gravitydevelopment.anticheat.util.rule.Rule;
|
||||
package com.rammelkast.anticheatreloaded.config.providers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.util.rule.Rule;
|
||||
|
||||
public interface Rules {
|
||||
|
||||
/**
|
||||
+5
-2
@@ -16,7 +16,7 @@
|
||||
* 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.bukkit.Bukkit;
|
||||
@@ -33,6 +33,7 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -188,7 +189,9 @@ public class CommentedConfiguration extends YamlConfiguration {
|
||||
CommentedConfiguration config = new CommentedConfiguration();
|
||||
|
||||
try {
|
||||
config.load(stream);
|
||||
InputStreamReader reader = new InputStreamReader(stream);
|
||||
config.load(reader);
|
||||
reader.close();
|
||||
} catch (IOException ex) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
|
||||
} catch (InvalidConfigurationException ex) {
|
||||
+7
-6
@@ -16,13 +16,8 @@
|
||||
* 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.entity.Player;
|
||||
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.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 {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
+10
-9
@@ -16,7 +16,7 @@
|
||||
* 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.entity.Creeper;
|
||||
@@ -28,17 +28,18 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
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.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;
|
||||
|
||||
public class EntityListener extends EventListener {
|
||||
|
||||
@EventHandler
|
||||
+8
-7
@@ -16,17 +16,18 @@
|
||||
* 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.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.HashMap;
|
||||
import java.util.Map;
|
||||
+6
-5
@@ -16,12 +16,8 @@
|
||||
* 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.event.EventHandler;
|
||||
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.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 {
|
||||
|
||||
@EventHandler
|
||||
+22
-15
@@ -16,7 +16,7 @@
|
||||
* 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.GameMode;
|
||||
@@ -51,20 +51,21 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.CheckResult;
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.check.combat.KillAuraCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.FlightCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.GlideCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.SpeedCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.WaterWalkCheck;
|
||||
import net.gravitydevelopment.anticheat.check.movement.YAxisCheck;
|
||||
import net.gravitydevelopment.anticheat.util.Distance;
|
||||
import net.gravitydevelopment.anticheat.util.Permission;
|
||||
import net.gravitydevelopment.anticheat.util.User;
|
||||
import net.gravitydevelopment.anticheat.util.Utilities;
|
||||
import net.gravitydevelopment.anticheat.util.VersionUtil;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraFly;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class PlayerListener extends EventListener {
|
||||
|
||||
@@ -346,6 +347,12 @@ public class PlayerListener extends EventListener {
|
||||
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()) {
|
||||
CheckResult result = getBackend().checkVClip(player, new Distance(event.getFrom(), event.getTo()));
|
||||
if (result.failed()) {
|
||||
+3
-2
@@ -16,15 +16,16 @@
|
||||
* 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.event.EventHandler;
|
||||
import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
|
||||
public class VehicleListener extends EventListener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
+4
-4
@@ -16,7 +16,7 @@
|
||||
* 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.Entry;
|
||||
@@ -25,9 +25,9 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.gravitydevelopment.anticheat.check.Backend;
|
||||
import net.gravitydevelopment.anticheat.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
|
||||
/**
|
||||
* The internal hub for all managers.
|
||||
+5
-4
@@ -16,14 +16,15 @@
|
||||
* 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.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.HashMap;
|
||||
import java.util.List;
|
||||
+6
-5
@@ -16,16 +16,17 @@
|
||||
* 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.ChatColor;
|
||||
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.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package net.gravitydevelopment.anticheat.manage;
|
||||
package com.rammelkast.anticheatreloaded.manage;
|
||||
|
||||
import com.comphenix.protocol.Packets;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.comphenix.protocol.events.*;
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
|
||||
public class PacketManager {
|
||||
|
||||
+14
-11
@@ -16,21 +16,23 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.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;
|
||||
package com.rammelkast.anticheatreloaded.manage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
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 {
|
||||
private List<User> users = new ArrayList<User>();
|
||||
private static AntiCheatManager manager;
|
||||
@@ -228,6 +230,7 @@ public class UserManager {
|
||||
}
|
||||
} else if (event.equalsIgnoreCase("KICK")) {
|
||||
user.getPlayer().kickPlayer(RED + kickReason);
|
||||
AntiCheat.getPlugin().onPlayerKicked();
|
||||
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
|
||||
if (!msg.equals("")) {
|
||||
manager.log(msg);
|
||||
@@ -241,7 +244,7 @@ public class UserManager {
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
|
||||
if (!msg.equals("")) {
|
||||
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -16,7 +16,7 @@
|
||||
* 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;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* 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;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* 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.SimpleDateFormat;
|
||||
+3
-2
@@ -16,11 +16,12 @@
|
||||
* 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 com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
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;
|
||||
|
||||
}
|
||||
+22
-23
@@ -1,13 +1,13 @@
|
||||
package net.gravitydevelopment.anticheat.util;
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
@@ -15,21 +15,21 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
|
||||
import net.gravitydevelopment.anticheat.AntiCheat;
|
||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_11_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_11_R1.PlayerConnection;
|
||||
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_11_R1.World;
|
||||
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_12_R1.PlayerConnection;
|
||||
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||
|
||||
public class NPC_1_11 {
|
||||
public class NPC_1_12 {
|
||||
|
||||
private final UUID owner;
|
||||
private final String name;
|
||||
@@ -42,7 +42,7 @@ public class NPC_1_11 {
|
||||
return this.entityId;
|
||||
}
|
||||
|
||||
public NPC_1_11(Player owner) {
|
||||
public NPC_1_12(Player owner) {
|
||||
this.owner = owner.getUniqueId();
|
||||
this.name = NameGenerator.generateName();
|
||||
Location eyelocation = owner.getEyeLocation();
|
||||
@@ -81,7 +81,7 @@ public class NPC_1_11 {
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
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));
|
||||
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
|
||||
this.npc.setInvisible(false);
|
||||
@@ -102,7 +102,7 @@ public class NPC_1_11 {
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
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));
|
||||
}
|
||||
} else if (e.getTo().getPitch() >= 22) {
|
||||
@@ -113,7 +113,7 @@ public class NPC_1_11 {
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
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));
|
||||
} else {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
@@ -129,7 +129,6 @@ public class NPC_1_11 {
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
|
||||
this.npc.teleportTo(back, false);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
|
||||
@@ -168,7 +167,7 @@ public class NPC_1_11 {
|
||||
}
|
||||
|
||||
public void damage() {
|
||||
if (this.npc == null) {
|
||||
if (this.npc == null || this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
||||
+11
-3
@@ -1,4 +1,4 @@
|
||||
package net.gravitydevelopment.anticheat.util;
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -12,7 +12,10 @@ public class NameGenerator {
|
||||
"NoHax",
|
||||
"Just",
|
||||
"That",
|
||||
"New"
|
||||
"New",
|
||||
"Ultra",
|
||||
"Killer",
|
||||
"Swift"
|
||||
});
|
||||
|
||||
private static final List<String> END = Arrays.asList(new String[]{
|
||||
@@ -21,7 +24,12 @@ public class NameGenerator {
|
||||
"JustYolo",
|
||||
"Gaming",
|
||||
"Minecraft",
|
||||
"Games"
|
||||
"Games",
|
||||
"Bawz",
|
||||
"1",
|
||||
"51",
|
||||
"99",
|
||||
"" + new Random().nextInt(100)
|
||||
});
|
||||
|
||||
public static String generateName() {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package net.gravitydevelopment.anticheat.util;
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
+5
-4
@@ -16,17 +16,18 @@
|
||||
* 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.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
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.lang.reflect.Field;
|
||||
import java.net.HttpURLConnection;
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* 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;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* 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;
|
||||
|
||||
+6
-5
@@ -16,18 +16,19 @@
|
||||
* 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.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
+3
-2
@@ -16,9 +16,8 @@
|
||||
* 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.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -29,6 +28,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+6
-5
@@ -16,15 +16,16 @@
|
||||
* 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.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.DriverManager;
|
||||
import java.sql.PreparedStatement;
|
||||
+6
-5
@@ -16,14 +16,15 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.gravitydevelopment.anticheat.util.rule;
|
||||
|
||||
import net.gravitydevelopment.anticheat.check.CheckType;
|
||||
import net.gravitydevelopment.anticheat.util.User;
|
||||
package com.rammelkast.anticheatreloaded.util.rule;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
@@ -42,7 +43,7 @@ import java.util.SortedMap;
|
||||
* 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>
|
||||
* <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 {
|
||||
|
||||
+10
-9
@@ -16,15 +16,16 @@
|
||||
* 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 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.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -44,7 +45,7 @@ import java.util.TreeMap;
|
||||
* <ul>
|
||||
* <li>Check
|
||||
* <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><b>Example:</b> Check_SPRINT</li>
|
||||
* </ul>
|
||||
@@ -76,7 +77,7 @@ import java.util.TreeMap;
|
||||
* <p/>
|
||||
* The Rule class itself is not an functional rule setup,
|
||||
* 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 {
|
||||
|
||||
@@ -145,7 +146,7 @@ public class Rule {
|
||||
/**
|
||||
* 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() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,7 +40,6 @@ FASTPLACE_TIMEMIN: 50
|
||||
FASTPLACE_ZEROLIMIT: 3
|
||||
FLIGHT_BLOCK_LIMIT: 15.0
|
||||
FLIGHT_LIMIT: 150
|
||||
HEAL_TIME_MIN: 2000
|
||||
INSTANT_BREAK_TIME: 2
|
||||
INVENTORY_CHECK: 10
|
||||
INVENTORY_TIMEMIN: 50
|
||||
@@ -84,7 +83,6 @@ Y_MAXVIOTIME: 5500
|
||||
Y_SPEED_MAX: 0.5125
|
||||
Y_TIME: 800
|
||||
GLIDE_LIMIT: 10
|
||||
GLIDE_MAX: -3.75
|
||||
KILLAURA_BOTHITS: 5
|
||||
BLINK_PACKET: 75
|
||||
KILLAURA_BOTHITS: 4
|
||||
BLINK_PACKET: 74
|
||||
VELOCITY_AMT: 5
|
||||
@@ -1,10 +1,9 @@
|
||||
name: AntiCheatReloaded
|
||||
author: Rammelkast
|
||||
description: AntiCheatReloaded helps easily identify and block malicious users on your server.
|
||||
main: net.gravitydevelopment.anticheat.AntiCheat
|
||||
softdepend: [ProtocolLib]
|
||||
main: com.rammelkast.anticheatreloaded.AntiCheat
|
||||
depend: [ProtocolLib]
|
||||
startup: postworld
|
||||
url: http://gravitydevelopment.net
|
||||
version: ${project.build.version}
|
||||
commands:
|
||||
anticheat:
|
||||
|
||||
Reference in new issue
Block a user