mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Fixed a lot of things. Plugin should work a lot better on 1.12 now.
This commit is contained in:
1 parent
f609758d28
commit
06c1eab2e6
52 files changed
+416
-343
No files matched your search
@@ -3,9 +3,8 @@ AntiCheatReloaded
|
||||
AntiCheatReloaded is a fork of the old 'AntiCheat' project.
|
||||
AntiCheat helps server admins easily identify and block malicious users by monitoring and analyzing the behaviour of their players.
|
||||
|
||||
###Want to help me out?
|
||||
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
|
||||
### BTC donations: 1DwUKboRQKrgR9o1oZC4VutkCUwdZStHtk
|
||||
### LTC donations: LTXzGnVLXmiH5XJch1bKrcZtzQjaF9rd8V
|
||||
|
||||
Bug Reporting
|
||||
------------
|
||||
@@ -15,15 +14,15 @@ Issues should be filed by hitting the [issues](https://github.com/Rammelkast/Ant
|
||||
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.)
|
||||
* Your server software (Bukkit/Spigot/Other) and it's version
|
||||
* If you use ProtocolLib, your ProtocolLib version
|
||||
* Whether or not you are using protocol hacks (ViaVersion etc.)
|
||||
|
||||
Usage
|
||||
-------
|
||||
Simply drag and drop the plugin and the ProtoclLib into your Plugins folder.
|
||||
Simply drag and drop the plugin file and the ProtocolLib jar into your Plugins folder.
|
||||
|
||||
###Hacks blocked
|
||||
Hacks blocked
|
||||
-------
|
||||
* Blink
|
||||
* Flight
|
||||
|
||||
@@ -1,100 +1,100 @@
|
||||
<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>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.6.2-ALPHA</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://rammelkast.com</url>
|
||||
<properties>
|
||||
<project.build.version>${project.version}</project.build.version>
|
||||
<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>
|
||||
</repositories>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>1.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.rammelkast.*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>AntiCheatReloaded</finalName>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>2.2</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jenkins</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<project.build.version>${project.version}-b${env.BUILD_NUMBER}</project.build.version>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>com.rammelkast.anticheatreloaded</groupId>
|
||||
<artifactId>AntiCheatReloaded</artifactId>
|
||||
<version>1.6.3-ALPHA</version>
|
||||
<name>AntiCheatReloaded</name>
|
||||
<url>https://rammelkast.com</url>
|
||||
<properties>
|
||||
<project.build.version>${project.version}</project.build.version>
|
||||
<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>
|
||||
</repositories>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.rammelkast.*</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>AntiCheatReloaded</finalName>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-file</artifactId>
|
||||
<version>2.2</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jenkins</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<project.build.version>${project.version}-b${env.BUILD_NUMBER}</project.build.version>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<artifactId>ProtocolLib-API</artifactId>
|
||||
<version>4.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+37
-6
@@ -18,11 +18,13 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -43,20 +45,22 @@ import com.rammelkast.anticheatreloaded.metrics.Metrics;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class AntiCheat extends JavaPlugin {
|
||||
public class AntiCheatReloaded extends JavaPlugin {
|
||||
|
||||
private static AntiCheatManager manager;
|
||||
private static AntiCheat plugin;
|
||||
private static AntiCheatReloaded plugin;
|
||||
private static List<Listener> eventList = new ArrayList<Listener>();
|
||||
private static Configuration config;
|
||||
private static boolean verbose;
|
||||
private static boolean developer;
|
||||
private static ProtocolManager protocolManager;
|
||||
private static SecureRandom random;
|
||||
private static Long loadTime;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
plugin = this;
|
||||
random = new SecureRandom();
|
||||
loadTime = System.currentTimeMillis();
|
||||
manager = new AntiCheatManager(this, getLogger());
|
||||
eventList.add(new PlayerListener());
|
||||
@@ -81,6 +85,10 @@ public class AntiCheat extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
getLogger().info("NMS version is " + VersionUtil.getVersion());
|
||||
if (!VersionUtil.isSupported()) {
|
||||
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + "The version of this server is NOT supported by ACR! The plugin will be buggy!");
|
||||
}
|
||||
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
|
||||
// Enable packetlisteners
|
||||
KillAuraCheck.listenPackets();
|
||||
@@ -104,7 +112,21 @@ public class AntiCheat extends JavaPlugin {
|
||||
getLogger().severe("Please remove or disable AAC to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("AntiCheat") != null) {
|
||||
if (Bukkit.getPluginManager().getPlugin("Spartan") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running Spartan!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable AAC to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("NoAura") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running NoAura!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
getLogger().severe("Please remove or disable AAC to silence this warning.");
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
if (Bukkit.getPluginManager().getPlugin("AntiCheat") != null || Bukkit.getPluginManager().getPlugin("AntiCheatPlus") != null) {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
getLogger().severe("You are also running AntiCheat!");
|
||||
getLogger().severe("Multiple anticheats create false cheat detections.");
|
||||
@@ -112,11 +134,10 @@ public class AntiCheat extends JavaPlugin {
|
||||
getLogger().severe("*----------------------------------------------*");
|
||||
}
|
||||
}
|
||||
}, 60L);
|
||||
}, 90L);
|
||||
|
||||
// End tests
|
||||
verboseLog("Finished loading.");
|
||||
getLogger().info("Running NMS version " + VersionUtil.getVersion() + "...");
|
||||
|
||||
// Metrics
|
||||
try {
|
||||
@@ -154,6 +175,12 @@ public class AntiCheat extends JavaPlugin {
|
||||
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
|
||||
}
|
||||
});
|
||||
metrics.addCustomChart(new Metrics.SimplePie("nms_version") {
|
||||
@Override
|
||||
public String getValue() {
|
||||
return VersionUtil.getVersion();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -212,7 +239,7 @@ public class AntiCheat extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public static AntiCheat getPlugin() {
|
||||
public static AntiCheatReloaded getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@@ -220,6 +247,10 @@ public class AntiCheat extends JavaPlugin {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public static SecureRandom getRandom() {
|
||||
return random;
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
return manager.getPlugin().getDescription().getVersion();
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
@@ -34,8 +34,8 @@ import com.rammelkast.anticheatreloaded.util.Group;
|
||||
*/
|
||||
|
||||
public class AntiCheatAPI {
|
||||
private static CheckManager chk = AntiCheat.getManager().getCheckManager();
|
||||
private static UserManager umr = AntiCheat.getManager().getUserManager();
|
||||
private static CheckManager chk = AntiCheatReloaded.getManager().getCheckManager();
|
||||
private static UserManager umr = AntiCheatReloaded.getManager().getUserManager();
|
||||
|
||||
// CheckManager API
|
||||
|
||||
@@ -173,7 +173,7 @@ public class AntiCheatAPI {
|
||||
* @return the AntiCheat Manager
|
||||
*/
|
||||
public static AntiCheatManager getManager() {
|
||||
return AntiCheat.getManager();
|
||||
return AntiCheatReloaded.getManager();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
||||
@@ -516,14 +516,14 @@ public class Backend {
|
||||
fastPlaceViolation.put(uuid, 0);
|
||||
}
|
||||
} else if (fastPlaceViolation.containsKey(uuid) && fastPlaceViolation.get(uuid) > violations) {
|
||||
AntiCheat.debugLog("Noted that fastPlaceViolation contains key " + uuid + " with value " + fastPlaceViolation.get(uuid));
|
||||
AntiCheatReloaded.debugLog("Noted that fastPlaceViolation contains key " + uuid + " with value " + fastPlaceViolation.get(uuid));
|
||||
Long math = System.currentTimeMillis() - lastBlockPlaced.get(uuid);
|
||||
AntiCheat.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
|
||||
AntiCheatReloaded.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
|
||||
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
lastBlockPlaced.put(uuid, time);
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
|
||||
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
AntiCheat.debugLog("Reset facePlaceViolation for " + uuid);
|
||||
AntiCheatReloaded.debugLog("Reset facePlaceViolation for " + uuid);
|
||||
fastPlaceViolation.put(uuid, 0);
|
||||
}
|
||||
} else if (lastBlockPlaced.containsKey(uuid)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
@@ -38,7 +38,7 @@ public class KillAuraCheck {
|
||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
||||
return;
|
||||
}
|
||||
AntiCheat.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheat.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
|
||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
@@ -57,7 +57,7 @@ public class KillAuraCheck {
|
||||
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.KILLAURA);
|
||||
AntiCheat.getPlugin().onKillAuraViolation();
|
||||
AntiCheatReloaded.getPlugin().onKillAuraViolation();
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
@@ -23,7 +23,7 @@ public class VelocityCheck {
|
||||
}
|
||||
|
||||
public static void runCheck(EntityDamageByEntityEvent e, final Player p) {
|
||||
if (AntiCheat.getManager().getCheckManager().isOpExempt(p) || AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) || AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
||||
return;
|
||||
final Location then = p.getLocation();
|
||||
new BukkitRunnable() {
|
||||
@@ -36,8 +36,8 @@ public class VelocityCheck {
|
||||
VL_COUNT.put(p.getUniqueId(), 1);
|
||||
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() + ", dist=" + then.distance(p.getLocation()) + ")").getMessage(), p, CheckType.VELOCITY);
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Velocity, had zero/low velocity " + VL_COUNT.get(p.getUniqueId()) + " times (max=" + AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT() + ", dist=" + then.distance(p.getLocation()) + ")").getMessage(), p, CheckType.VELOCITY);
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class VelocityCheck {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 4);
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
@@ -30,11 +30,11 @@ public class BlinkCheck {
|
||||
public void run() {
|
||||
MOVE_COUNT.clear();
|
||||
}
|
||||
}.runTaskTimer(AntiCheat.getPlugin(), 20, 20);
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
||||
}
|
||||
|
||||
public static void listenPackets() {
|
||||
AntiCheat.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheat.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK}) {
|
||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK}) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
@@ -43,9 +43,9 @@ public class BlinkCheck {
|
||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
||||
} 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 (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);
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().checkInWorld(p) && !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) && !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId()) + " packets in one second (max=" + AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET() + ")").getMessage(), p, CheckType.BLINK);
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
@@ -26,7 +26,7 @@ public class FlightCheck {
|
||||
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()
|
||||
if (distance.getYDifference() > AntiCheatReloaded.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.
|
||||
@@ -51,11 +51,11 @@ public class FlightCheck {
|
||||
blocksOverFlight.put(uuid, (blocksOverFlight.get(uuid) - distance.getYDifference()));
|
||||
}
|
||||
|
||||
if (blocksOverFlight.get(uuid) > AntiCheat.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT()
|
||||
if (blocksOverFlight.get(uuid) > AntiCheatReloaded.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() + ")");
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
|
||||
}
|
||||
} else {
|
||||
blocksOverFlight.put(uuid, 0D);
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
@@ -44,13 +44,13 @@ public class GlideCheck {
|
||||
if (!violations.containsKey(player.getUniqueId())) {
|
||||
violations.put(player.getUniqueId(), 1);
|
||||
} else {
|
||||
if (violations.get(player.getUniqueId()) + 1 >= AntiCheat.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
||||
if (violations.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
||||
violations.remove(player.getUniqueId());
|
||||
Location to = player.getLocation();
|
||||
to.setY(to.getY() - distanceToFall(to));
|
||||
player.teleport(to);
|
||||
// Report glide violation to statistics, just for the lulz jk
|
||||
AntiCheat.getPlugin().onGlideViolation();
|
||||
AntiCheatReloaded.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 {
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
@@ -18,51 +18,51 @@ public class SpeedCheck {
|
||||
public static Map<UUID, Integer> speedViolation = new HashMap<UUID, Integer>();
|
||||
|
||||
public static boolean isSpeedExempt(Player player) {
|
||||
return AntiCheat.getManager().getBackend().isMovingExempt(player)
|
||||
|| AntiCheat.getManager().getBackend().justVelocity(player) || VersionUtil.isFlying(player);
|
||||
return AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)
|
||||
|| AntiCheatReloaded.getManager().getBackend().justVelocity(player) || VersionUtil.isFlying(player);
|
||||
}
|
||||
|
||||
public static CheckResult checkXZSpeed(Player player, double x, double z) {
|
||||
if (!isSpeedExempt(player) && player.getVehicle() == null) {
|
||||
String reason = "";
|
||||
double max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX();
|
||||
double max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX();
|
||||
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
||||
if (player.isSprinting()) {
|
||||
reason = "on soulsand while sprinting ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND_SPRINT();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND_SPRINT();
|
||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||
reason = "on soulsand with speed potion ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND_POTION();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND_POTION();
|
||||
} else {
|
||||
reason = "on soulsand ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
|
||||
}
|
||||
} else if (VersionUtil.isFlying(player)) {
|
||||
reason = "while flying ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY();
|
||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||
if (player.isSprinting()) {
|
||||
reason = "with speed potion while sprinting ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION_SPRINT();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION_SPRINT();
|
||||
} else {
|
||||
reason = "with speed potion ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_POTION();
|
||||
}
|
||||
} else if (player.isSprinting()) {
|
||||
reason = "while sprinting ";
|
||||
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
|
||||
max = AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_SPRINT();
|
||||
}
|
||||
|
||||
float speed = player.getWalkSpeed();
|
||||
max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;
|
||||
|
||||
if (x > max || z > max) {
|
||||
int num = AntiCheat.getManager().getBackend().increment(player, speedViolation,
|
||||
AntiCheat.getManager().getBackend().getMagic().SPEED_MAX());
|
||||
if (num >= AntiCheat.getManager().getBackend().getMagic().SPEED_MAX()) {
|
||||
int num = AntiCheatReloaded.getManager().getBackend().increment(player, speedViolation,
|
||||
AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX());
|
||||
if (num >= AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + "'s speed was too high " + reason + num + " times in a row (max="
|
||||
+ AntiCheat.getManager().getBackend().getMagic().SPEED_MAX() + ", speed="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX() + ", speed="
|
||||
+ (x > z ? x : z) + ", max speed=" + max + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
@@ -39,11 +39,11 @@ public class WaterWalkCheck {
|
||||
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();
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER()
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER();
|
||||
} else {
|
||||
b = x > AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
||||
|| z > AntiCheat.getManager().getBackend().getMagic()
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER_SPRINT();
|
||||
}
|
||||
if (!b && !Utilities.isFullyInWater(player.getLocation())
|
||||
@@ -54,7 +54,7 @@ public class WaterWalkCheck {
|
||||
if (b) {
|
||||
if (waterSpeedViolation.containsKey(uuid)) {
|
||||
int v = waterSpeedViolation.get(uuid);
|
||||
if (v >= AntiCheat.getManager().getBackend().getMagic()
|
||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.WATER_SPEED_VIOLATION_MAX()) {
|
||||
waterSpeedViolation.put(uuid, 0);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
@@ -78,11 +78,11 @@ public class WaterWalkCheck {
|
||||
return PASS;
|
||||
}
|
||||
} else if (block.getRelative(BlockFace.DOWN).isLiquid()
|
||||
&& !AntiCheat.getManager().getBackend().isAscending(player) && Utilities.cantStandAt(block)
|
||||
&& !AntiCheatReloaded.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()) {
|
||||
if (v >= AntiCheatReloaded.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()
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
@@ -32,7 +32,7 @@ public class YAxisCheck {
|
||||
}
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||
|| distance.getYDifference() < 0 || VersionUtil.isFlying(player)) {
|
||||
return PASS;
|
||||
}
|
||||
@@ -52,13 +52,13 @@ public class YAxisCheck {
|
||||
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()
|
||||
&& yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) < AntiCheatReloaded.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()) {
|
||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
||||
g.setY(lastYcoord.get(uuid));
|
||||
if (g.getBlock().getType() == Material.AIR) {
|
||||
player.teleport(g);
|
||||
@@ -66,33 +66,33 @@ public class YAxisCheck {
|
||||
}
|
||||
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() + ")");
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
|
||||
} else {
|
||||
if (yAxisViolations.get(uuid) > AntiCheat.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheat.getManager()
|
||||
if (yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheatReloaded.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()
|
||||
double diff = AntiCheatReloaded.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()) {
|
||||
if ((y1 - lastYcoord.get(uuid)) > diff && i < AntiCheatReloaded.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()) {
|
||||
if (!AntiCheatReloaded.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() + ")");
|
||||
+ i + " ms (min =" + AntiCheatReloaded.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()
|
||||
if ((y1 - lastYcoord.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF() + 1
|
||||
|| (System.currentTimeMillis() - lastYtime.get(uuid)) > AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().Y_TIME()) {
|
||||
lastYtime.put(uuid, System.currentTimeMillis());
|
||||
lastYcoord.put(uuid, y1);
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
import com.rammelkast.anticheatreloaded.manage.UserManager;
|
||||
@@ -32,9 +32,9 @@ import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandBase {
|
||||
|
||||
public static final Configuration CONFIG = AntiCheat.getManager().getConfiguration();
|
||||
public static final UserManager USER_MANAGER = AntiCheat.getManager().getUserManager();
|
||||
public static final CheckManager CHECK_MANAGER = AntiCheat.getManager().getCheckManager();
|
||||
public static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||
public static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
||||
public static final CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
||||
public static final ChatColor RED = ChatColor.RED;
|
||||
public static final ChatColor YELLOW = ChatColor.YELLOW;
|
||||
public static final ChatColor GREEN = ChatColor.GREEN;
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.command.executors;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CommandDeveloper extends CommandBase {
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
AntiCheat.setDeveloperMode(!AntiCheat.developerMode());
|
||||
cs.sendMessage(GREEN + "Developer mode " + (AntiCheat.developerMode() ? "ON" : "OFF"));
|
||||
AntiCheatReloaded.setDeveloperMode(!AntiCheatReloaded.developerMode());
|
||||
cs.sendMessage(GREEN + "Developer mode " + (AntiCheatReloaded.developerMode() ? "ON" : "OFF"));
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||
@@ -83,7 +83,7 @@ public class CommandReport extends CommandBase {
|
||||
// Test users
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) {
|
||||
User user = AntiCheat.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||
playerReport(cs, user, page);
|
||||
return;
|
||||
}
|
||||
@@ -176,13 +176,13 @@ public class CommandReport extends CommandBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (AntiCheat.developerMode()) {
|
||||
if (AntiCheatReloaded.developerMode()) {
|
||||
int permission = 0;
|
||||
int check = 0;
|
||||
for (Permission perm : Permission.values()) {
|
||||
if (perm.get(user.getPlayer())) permission++;
|
||||
}
|
||||
CheckManager manager = AntiCheat.getManager().getCheckManager();
|
||||
CheckManager manager = AntiCheatReloaded.getManager().getCheckManager();
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (manager.willCheck(user.getPlayer(), type)) check++;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
@@ -53,7 +53,7 @@ public class CommandReset extends CommandBase {
|
||||
if (user != null) {
|
||||
user.resetLevel();
|
||||
user.clearMessages();
|
||||
AntiCheat.getManager().getBackend().resetChatLevel(user);
|
||||
AntiCheatReloaded.getManager().getBackend().resetChatLevel(user);
|
||||
cs.sendMessage(args[0] + GREEN + " has been reset.");
|
||||
} else {
|
||||
cs.sendMessage(RED + "Player: " +args[0] + " not found.");
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.config;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.files.Config;
|
||||
import com.rammelkast.anticheatreloaded.config.files.Enterprise;
|
||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.*;
|
||||
@@ -48,7 +48,7 @@ public class Configuration {
|
||||
private ArrayList<ConfigurationFile> flatfiles;
|
||||
private ArrayList<ConfigurationTable> dbfiles;
|
||||
|
||||
public Configuration(AntiCheat plugin, AntiCheatManager manager) {
|
||||
public Configuration(AntiCheatReloaded plugin, AntiCheatManager manager) {
|
||||
removeOldFiles();
|
||||
this.manager = manager;
|
||||
config = new Config(plugin, this);
|
||||
@@ -146,20 +146,20 @@ public class Configuration {
|
||||
|
||||
private void removeOldFiles() {
|
||||
ArrayList<String> removed = new ArrayList<String>();
|
||||
File configFile = new File(AntiCheat.getPlugin().getDataFolder(), "config.yml");
|
||||
File configFile = new File(AntiCheatReloaded.getPlugin().getDataFolder(), "config.yml");
|
||||
if (configFile.exists() && YamlConfiguration.loadConfiguration(configFile).getString("System.Auto update") != null) {
|
||||
configFile.renameTo(new File(AntiCheat.getPlugin().getDataFolder(), "config.old"));
|
||||
configFile.renameTo(new File(AntiCheatReloaded.getPlugin().getDataFolder(), "config.old"));
|
||||
removed.add("config.yml has been renamed to config.old and replaced with the new config.yml");
|
||||
}
|
||||
File eventsFile = new File(AntiCheat.getPlugin().getDataFolder(), "events.yml");
|
||||
File eventsFile = new File(AntiCheatReloaded.getPlugin().getDataFolder(), "events.yml");
|
||||
if (eventsFile.exists()) {
|
||||
eventsFile.renameTo(new File(AntiCheat.getPlugin().getDataFolder(), "events.old"));
|
||||
eventsFile.renameTo(new File(AntiCheatReloaded.getPlugin().getDataFolder(), "events.old"));
|
||||
removed.add("events.yml has been renamed to events.old and replaced with groups.yml and rules.yml");
|
||||
}
|
||||
if (removed.size() > 0) {
|
||||
AntiCheat.getPlugin().getLogger().info("You are upgrading from an old version of AntiCheat. Due to configuration changes, the following files have been modified:");
|
||||
AntiCheatReloaded.getPlugin().getLogger().info("You are upgrading from an old version of AntiCheat. Due to configuration changes, the following files have been modified:");
|
||||
for (String s : removed) {
|
||||
AntiCheat.getPlugin().getLogger().info(s);
|
||||
AntiCheatReloaded.getPlugin().getLogger().info(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.config;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.yaml.CommentedConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@@ -37,21 +37,21 @@ public class ConfigurationFile {
|
||||
private FileConfiguration defaultConfigFile;
|
||||
private Configuration config;
|
||||
|
||||
private AntiCheat plugin;
|
||||
private AntiCheatReloaded plugin;
|
||||
|
||||
private boolean saveDefault;
|
||||
|
||||
protected boolean needsReload;
|
||||
|
||||
public ConfigurationFile(AntiCheat plugin, Configuration config, String fileName) {
|
||||
public ConfigurationFile(AntiCheatReloaded plugin, Configuration config, String fileName) {
|
||||
this(plugin, config, fileName, true);
|
||||
}
|
||||
|
||||
public ConfigurationFile(AntiCheat plugin, Configuration config, String fileName, boolean saveDefault) {
|
||||
public ConfigurationFile(AntiCheatReloaded plugin, Configuration config, String fileName, boolean saveDefault) {
|
||||
this(plugin, config, fileName, saveDefault, new File(plugin.getDataFolder(), fileName));
|
||||
}
|
||||
|
||||
public ConfigurationFile(AntiCheat plugin, Configuration config, String fileName, boolean saveDefault, File rawFile) {
|
||||
public ConfigurationFile(AntiCheatReloaded plugin, Configuration config, String fileName, boolean saveDefault, File rawFile) {
|
||||
// Can't change with user editing
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.config;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.util.enterprise.Database;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -59,7 +59,7 @@ public class ConfigurationTable {
|
||||
|
||||
public void reload() {
|
||||
// For after sql inserts have been made
|
||||
Bukkit.getScheduler().runTask(AntiCheat.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTask(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
load();
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.config.files;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Config extends ConfigurationFile {
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
public ConfigValue<List<String>> disabledChecks;
|
||||
|
||||
public Config(AntiCheat plugin, Configuration config) {
|
||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.config.files;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.util.enterprise.Database;
|
||||
@@ -43,7 +43,7 @@ public class Enterprise extends ConfigurationFile {
|
||||
|
||||
public Database database;
|
||||
|
||||
public Enterprise(AntiCheat plugin, Configuration config) {
|
||||
public Enterprise(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.config.holders.mysql;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||
@@ -52,7 +52,7 @@ public class MySQLLangHolder extends ConfigurationTable implements InvocationHan
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("lang.yml"));
|
||||
InputStreamReader reader = new InputStreamReader(AntiCheatReloaded.getPlugin().getResource("lang.yml"));
|
||||
defaults = YamlConfiguration.loadConfiguration(reader);
|
||||
try {
|
||||
reader.close();
|
||||
@@ -150,7 +150,7 @@ public class MySQLLangHolder extends ConfigurationTable implements InvocationHan
|
||||
return value;
|
||||
}
|
||||
}
|
||||
AntiCheat.getPlugin().getLogger().severe("The lang value " + key + " couldn't be found.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().severe("The lang value " + key + " couldn't be found.");
|
||||
return "Language error. See console for details.";
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.config.holders.mysql;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Levels;
|
||||
@@ -81,11 +81,11 @@ public class MySQLLevelsHolder extends ConfigurationTable implements Levels {
|
||||
|
||||
@Override
|
||||
public void saveLevelFromUser(final User user) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!user.isWaitingOnLevelSync()) {
|
||||
AntiCheat.debugLog("Saving level from " + user.getUUID() + ". Value: " + user.getLevel());
|
||||
AntiCheatReloaded.debugLog("Saving level from " + user.getUUID() + ". Value: " + user.getLevel());
|
||||
try {
|
||||
PreparedStatement statement = getConnection().prepareStatement(sqlSave);
|
||||
statement.setString(1, user.getUUID().toString());
|
||||
@@ -101,14 +101,14 @@ public class MySQLLevelsHolder extends ConfigurationTable implements Levels {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
AntiCheat.getManager().getUserManager().remove(user);
|
||||
AntiCheatReloaded.getManager().getUserManager().remove(user);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadLevelToUser(final User user) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -120,7 +120,7 @@ public class MySQLLevelsHolder extends ConfigurationTable implements Levels {
|
||||
boolean has = false;
|
||||
while (set.next()) {
|
||||
has = true;
|
||||
AntiCheat.debugLog("Syncing level to " + user.getUUID() + ". Value: " + set.getInt("level"));
|
||||
AntiCheatReloaded.debugLog("Syncing level to " + user.getUUID() + ". Value: " + set.getInt("level"));
|
||||
user.setLevel(set.getInt("level"));
|
||||
user.setLevelSyncTimestamp(set.getTimestamp("last_update"));
|
||||
}
|
||||
@@ -162,7 +162,7 @@ public class MySQLLevelsHolder extends ConfigurationTable implements Levels {
|
||||
|
||||
@Override
|
||||
public void updateLevelToUser(final User user) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -174,7 +174,7 @@ public class MySQLLevelsHolder extends ConfigurationTable implements Levels {
|
||||
ResultSet set = statement.executeQuery();
|
||||
|
||||
while (set.next()) {
|
||||
AntiCheat.debugLog("Syncing level to " + user.getUUID() + ". Value: " + set.getInt("level"));
|
||||
AntiCheatReloaded.debugLog("Syncing level to " + user.getUUID() + ". Value: " + set.getInt("level"));
|
||||
user.setLevel(set.getInt("level"));
|
||||
user.setLevelSyncTimestamp(set.getTimestamp("last_update"));
|
||||
}
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.config.holders.mysql;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
@@ -49,7 +49,7 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
|
||||
|
||||
@Override
|
||||
public void open() {
|
||||
InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("magic.yml"));
|
||||
InputStreamReader reader = new InputStreamReader(AntiCheatReloaded.getPlugin().getResource("magic.yml"));
|
||||
defaults = YamlConfiguration.loadConfiguration(reader);
|
||||
try {
|
||||
reader.close();
|
||||
@@ -102,7 +102,7 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
|
||||
} else if (set.getObject("value_double") != null) {
|
||||
doubles.put(key, set.getDouble("value_double"));
|
||||
} else {
|
||||
AntiCheat.getPlugin().getLogger().severe("The magic value " + key + " loaded from the database did not have a value configured. Using the default value.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().severe("The magic value " + key + " loaded from the database did not have a value configured. Using the default value.");
|
||||
for (int i=1;i<=methods.length;i++) {
|
||||
String name = methods[i-1].getName();
|
||||
if (name.equalsIgnoreCase(key)) {
|
||||
@@ -149,7 +149,7 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
|
||||
return value;
|
||||
}
|
||||
}
|
||||
AntiCheat.getPlugin().getLogger().severe("The magic value " + key + " couldn't be found.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().severe("The magic value " + key + " couldn't be found.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -23,7 +23,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Rules;
|
||||
@@ -65,7 +65,7 @@ public class MySQLRulesHolder extends ConfigurationTable implements Rules {
|
||||
if (rule != null) {
|
||||
this.rules.add(rule);
|
||||
} else {
|
||||
AntiCheat.getPlugin().getLogger().warning("Couldn't load rule '" + string + "' from the database. Improper format used.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("Couldn't load rule '" + string + "' from the database. Improper format used.");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Groups;
|
||||
@@ -34,7 +34,7 @@ public class YamlGroupsHolder extends ConfigurationFile implements Groups {
|
||||
|
||||
private int highestLevel;
|
||||
|
||||
public YamlGroupsHolder(AntiCheat plugin, Configuration config) {
|
||||
public YamlGroupsHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -22,7 +22,7 @@ import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class YamlLangHolder extends ConfigurationFile implements InvocationHandl
|
||||
|
||||
public static final String FILENAME = "lang.yml";
|
||||
|
||||
public YamlLangHolder(AntiCheat plugin, Configuration config) {
|
||||
public YamlLangHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class YamlLangHolder extends ConfigurationFile implements InvocationHandl
|
||||
return value.getValue();
|
||||
}
|
||||
}
|
||||
AntiCheat.getPlugin().getLogger().severe("The lang value " + key + " couldn't be found.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().severe("The lang value " + key + " couldn't be found.");
|
||||
return "Language error. See console for details.";
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Levels;
|
||||
@@ -31,7 +31,7 @@ public class YamlLevelsHolder extends ConfigurationFile implements Levels {
|
||||
|
||||
public static final String FILENAME = "data/levels.yml";
|
||||
|
||||
public YamlLevelsHolder(AntiCheat plugin, Configuration config) {
|
||||
public YamlLevelsHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME, false);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class YamlLevelsHolder extends ConfigurationFile implements Levels {
|
||||
|
||||
private void saveLevelFromUser(User user, boolean remove) {
|
||||
saveLevel(user.getUUID(), user.getLevel());
|
||||
if (remove) AntiCheat.getManager().getUserManager().remove(user);
|
||||
if (remove) AntiCheatReloaded.getManager().getUserManager().remove(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ 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.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class YamlMagicHolder extends ConfigurationFile implements InvocationHand
|
||||
|
||||
public static final String FILENAME = "magic.yml";
|
||||
|
||||
public YamlMagicHolder(AntiCheat plugin, Configuration config) {
|
||||
public YamlMagicHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class YamlMagicHolder extends ConfigurationFile implements InvocationHand
|
||||
} else if (method.getReturnType().getSimpleName().equals("double")) {
|
||||
return new ConfigValue<Double>(key).getValue();
|
||||
} else {
|
||||
AntiCheat.getPlugin().getLogger().severe("The magic value " + key + " couldn't be found.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().severe("The magic value " + key + " couldn't be found.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Rules;
|
||||
@@ -33,7 +33,7 @@ public class YamlRulesHolder extends ConfigurationFile implements Rules {
|
||||
|
||||
private List<Rule> rules;
|
||||
|
||||
public YamlRulesHolder(AntiCheat plugin, Configuration config) {
|
||||
public YamlRulesHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||
super(plugin, config, FILENAME);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class YamlRulesHolder extends ConfigurationFile implements Rules {
|
||||
if (rule != null) {
|
||||
this.rules.add(rule);
|
||||
} else {
|
||||
AntiCheat.getPlugin().getLogger().warning("Couldn't load rule '" + string + "' from config. Improper format used.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("Couldn't load rule '" + string + "' from config. Improper format used.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ 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.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
@@ -48,7 +48,7 @@ public class BlockListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@@ -65,7 +65,7 @@ public class BlockListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
|
||||
@@ -29,7 +29,7 @@ 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.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
||||
@@ -57,7 +57,7 @@ public class EntityListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -76,7 +76,7 @@ public class EntityListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -95,7 +95,7 @@ public class EntityListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
@@ -169,6 +169,6 @@ public class EntityListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.event;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
@@ -36,18 +36,18 @@ import java.util.UUID;
|
||||
public class EventListener implements Listener {
|
||||
private static final Map<CheckType, Integer> USAGE_LIST = new EnumMap<CheckType, Integer>(CheckType.class);
|
||||
private static final Map<UUID, Integer> DECREASE_LIST = new HashMap<UUID, Integer>();
|
||||
private static final CheckManager CHECK_MANAGER = AntiCheat.getManager().getCheckManager();
|
||||
private static final Backend BACKEND = AntiCheat.getManager().getBackend();
|
||||
private static final AntiCheat PLUGIN = AntiCheat.getManager().getPlugin();
|
||||
private static final UserManager USER_MANAGER = AntiCheat.getManager().getUserManager();
|
||||
private static final Configuration CONFIG = AntiCheat.getManager().getConfiguration();
|
||||
private static final CheckManager CHECK_MANAGER = AntiCheatReloaded.getManager().getCheckManager();
|
||||
private static final Backend BACKEND = AntiCheatReloaded.getManager().getBackend();
|
||||
private static final AntiCheatReloaded PLUGIN = AntiCheatReloaded.getManager().getPlugin();
|
||||
private static final UserManager USER_MANAGER = AntiCheatReloaded.getManager().getUserManager();
|
||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||
|
||||
public static void log(String message, Player player, CheckType type) {
|
||||
User user = getUserManager().getUser(player.getUniqueId());
|
||||
if (user != null) { // npc
|
||||
logCheat(type, user);
|
||||
if (user.increaseLevel(type) && message != null) {
|
||||
AntiCheat.getManager().log(message);
|
||||
AntiCheatReloaded.getManager().log(message);
|
||||
}
|
||||
removeDecrease(user);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class EventListener implements Listener {
|
||||
}
|
||||
|
||||
public static AntiCheatManager getManager() {
|
||||
return AntiCheat.getManager();
|
||||
return AntiCheatReloaded.getManager();
|
||||
}
|
||||
|
||||
public static Backend getBackend() {
|
||||
@@ -127,7 +127,7 @@ public class EventListener implements Listener {
|
||||
return USER_MANAGER;
|
||||
}
|
||||
|
||||
public static AntiCheat getPlugin() {
|
||||
public static AntiCheatReloaded getPlugin() {
|
||||
return PLUGIN;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ 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.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
@@ -51,7 +51,7 @@ public class InventoryListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
@@ -82,7 +82,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -91,7 +91,7 @@ public class PlayerListener extends EventListener {
|
||||
getBackend().logEnterExit(event.getPlayer());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -100,7 +100,7 @@ public class PlayerListener extends EventListener {
|
||||
getBackend().logEnterExit(event.getPlayer());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -121,7 +121,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -130,14 +130,14 @@ public class PlayerListener extends EventListener {
|
||||
getBackend().logTeleport(event.getPlayer());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChangeWorlds(PlayerChangedWorldEvent event) {
|
||||
getBackend().logTeleport(event.getPlayer());
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -146,7 +146,7 @@ public class PlayerListener extends EventListener {
|
||||
getBackend().logToggleSneak(event.getPlayer());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -160,7 +160,7 @@ public class PlayerListener extends EventListener {
|
||||
getBackend().logVelocity(player);
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@@ -179,14 +179,14 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerKick(PlayerKickEvent event) {
|
||||
getBackend().garbageClean(event.getPlayer());
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -197,7 +197,7 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
getConfig().getLevels().saveLevelFromUser(user);
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -216,7 +216,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -238,7 +238,7 @@ public class PlayerListener extends EventListener {
|
||||
getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@@ -252,7 +252,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@@ -260,7 +260,7 @@ public class PlayerListener extends EventListener {
|
||||
if (event.getBed().getType() != Material.BED) return;
|
||||
getBackend().logEnterExit(event.getPlayer());
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@@ -268,12 +268,12 @@ public class PlayerListener extends EventListener {
|
||||
if (event.getBed().getType() != Material.BED) return;
|
||||
getBackend().logEnterExit(event.getPlayer());
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerAnimation(PlayerAnimationEvent event) {
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -305,7 +305,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
@@ -440,7 +440,7 @@ public class PlayerListener extends EventListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.bukkit.event.vehicle.VehicleDestroyEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class VehicleListener extends EventListener {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class VehicleListener extends EventListener {
|
||||
getBackend().logEnterExit((Player) event.getEntered());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
@@ -43,7 +43,7 @@ public class VehicleListener extends EventListener {
|
||||
getBackend().logEnterExit((Player) event.getExited());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,6 @@ public class VehicleListener extends EventListener {
|
||||
getBackend().logEnterExit((Player) event.getVehicle().getPassenger());
|
||||
}
|
||||
|
||||
AntiCheat.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
*/
|
||||
|
||||
public class AntiCheatManager {
|
||||
private static AntiCheat plugin = null;
|
||||
private static AntiCheatReloaded plugin = null;
|
||||
private static Configuration configuration;
|
||||
private static UserManager userManager = null;
|
||||
private static CheckManager checkManager = null;
|
||||
@@ -43,7 +43,7 @@ public class AntiCheatManager {
|
||||
private static Map<String, RegisteredListener[]> eventchains = new ConcurrentHashMap<String, RegisteredListener[]>();
|
||||
private static Map<String, Long> eventcache = new ConcurrentHashMap<String, Long>();
|
||||
|
||||
public AntiCheatManager(AntiCheat instance, Logger logger) {
|
||||
public AntiCheatManager(AntiCheatReloaded instance, Logger logger) {
|
||||
plugin = instance;
|
||||
configuration = new Configuration(plugin, this);
|
||||
loggingManager = new LoggingManager(plugin, logger, configuration);
|
||||
@@ -104,7 +104,7 @@ public class AntiCheatManager {
|
||||
return gen;
|
||||
}
|
||||
|
||||
public AntiCheat getPlugin() {
|
||||
public AntiCheatReloaded getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.manage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
|
||||
@@ -175,7 +175,7 @@ public class CheckManager {
|
||||
&& !isExempt(player, type)
|
||||
&& !type.checkPermission(player)
|
||||
&& !isOpExempt(player);
|
||||
AntiCheat.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
||||
AntiCheatReloaded.debugLog("Check " + type + (check ? " run " : " not run ") + "on " + player.getName());
|
||||
// TODO temp fix
|
||||
if ((type == CheckType.FLY || type == CheckType.SPEED) && player.isFlying())
|
||||
return false;
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.util.FileFormatter;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
@@ -42,7 +42,7 @@ public class LoggingManager {
|
||||
private static List<String> logs = new CopyOnWriteArrayList<String>();
|
||||
private final Configuration config;
|
||||
|
||||
public LoggingManager(AntiCheat plugin, Logger logger, Configuration config) {
|
||||
public LoggingManager(AntiCheatReloaded plugin, Logger logger, Configuration config) {
|
||||
this.fileLogger = Logger.getLogger("net.gravitydevelopment.anticheat.AntiCheat");
|
||||
this.config = config;
|
||||
try {
|
||||
@@ -70,12 +70,12 @@ public class LoggingManager {
|
||||
}
|
||||
|
||||
public void debugLog(String message) {
|
||||
Bukkit.getConsoleSender().sendMessage("[AntiCheat] " + ChatColor.GRAY + message);
|
||||
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.GRAY + message);
|
||||
logToLogs(message);
|
||||
}
|
||||
|
||||
public void logToConsole(String message) {
|
||||
Bukkit.getConsoleSender().sendMessage("[AntiCheat] " + ChatColor.RED + message);
|
||||
Bukkit.getConsoleSender().sendMessage("[ACR] " + ChatColor.RED + message);
|
||||
}
|
||||
|
||||
public void logToFile(String message) {
|
||||
|
||||
@@ -3,15 +3,15 @@ package com.rammelkast.anticheatreloaded.manage;
|
||||
import com.comphenix.protocol.Packets;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.comphenix.protocol.events.*;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
public class PacketManager {
|
||||
|
||||
private ProtocolManager protocolManager;
|
||||
private AntiCheat plugin;
|
||||
private AntiCheatReloaded plugin;
|
||||
private AntiCheatManager manager;
|
||||
|
||||
public PacketManager(ProtocolManager protocolManager, AntiCheat plugin, AntiCheatManager manager) {
|
||||
public PacketManager(ProtocolManager protocolManager, AntiCheatReloaded plugin, AntiCheatManager manager) {
|
||||
this.protocolManager = protocolManager;
|
||||
this.plugin = plugin;
|
||||
this.manager = manager;
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.bukkit.BanList.Type;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.util.Group;
|
||||
@@ -217,9 +217,12 @@ public class UserManager {
|
||||
*/
|
||||
public void execute(final User user, final List<String> actions, final CheckType type, final String kickReason, final List<String> warning, final String banReason) {
|
||||
// Execute synchronously for thread safety when called from AsyncPlayerChatEvent
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AntiCheat.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (user.getPlayer() == null) {
|
||||
return;
|
||||
}
|
||||
final String name = user.getName();
|
||||
for (String event : actions) {
|
||||
event = event.replaceAll("&player", name).replaceAll("&world", user.getPlayer().getWorld().getName()).replaceAll("&check", type.name());
|
||||
@@ -230,7 +233,7 @@ public class UserManager {
|
||||
}
|
||||
} else if (event.equalsIgnoreCase("KICK")) {
|
||||
user.getPlayer().kickPlayer(RED + kickReason);
|
||||
AntiCheat.getPlugin().onPlayerKicked();
|
||||
AntiCheatReloaded.getPlugin().onPlayerKicked();
|
||||
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
|
||||
if (!msg.equals("")) {
|
||||
manager.log(msg);
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -41,8 +41,8 @@ public class Group {
|
||||
|
||||
ChatColor c = ChatColor.valueOf(color);
|
||||
if (c == null) {
|
||||
AntiCheat.getPlugin().getLogger().warning("Event '" + name + "' was initialized with the color '" + color + "' which is invalid.");
|
||||
AntiCheat.getPlugin().getLogger().warning("This event will not run properly. See http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html#enum_constant_summary for a list of valid colors");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("Event '" + name + "' was initialized with the color '" + color + "' which is invalid.");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("This event will not run properly. See http://jd.bukkit.org/apidocs/org/bukkit/ChatColor.html#enum_constant_summary for a list of valid colors");
|
||||
} else {
|
||||
this.color = c;
|
||||
}
|
||||
@@ -75,9 +75,9 @@ public class Group {
|
||||
throw new Exception();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
AntiCheat.getPlugin().getLogger().warning("An event was initialized with an invalid string: '" + string + "'");
|
||||
AntiCheat.getPlugin().getLogger().warning("The proper format is: 'name : threshold : color : action' such as 'High : 50 : RED : KICK'");
|
||||
AntiCheat.getPlugin().getLogger().warning("This event will NOT run. (" + ex.getMessage() + ")");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("An event was initialized with an invalid string: '" + string + "'");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("The proper format is: 'name : threshold : color : action' such as 'High : 50 : RED : KICK'");
|
||||
AntiCheatReloaded.getPlugin().getLogger().warning("This event will NOT run. (" + ex.getMessage() + ")");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,20 +5,24 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_12_R1.EnumItemSlot;
|
||||
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
|
||||
@@ -62,6 +66,8 @@ public class NPC_1_12 {
|
||||
this.location.getZ(), 0.0f, 0.0f);
|
||||
this.npc.collides = false;
|
||||
this.npc.setInvisible(true);
|
||||
this.npc.setEquipment(EnumItemSlot.CHEST, AntiCheatReloaded.getRandom().nextBoolean() ? CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_CHESTPLATE)) : CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_CHESTPLATE)));
|
||||
this.npc.setEquipment(EnumItemSlot.FEET, AntiCheatReloaded.getRandom().nextBoolean() ? CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_BOOTS)) : CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_BOOTS)));
|
||||
this.entityId = this.npc.getId();
|
||||
final PlayerConnection connection = ((CraftPlayer) this.getOwner()).getHandle().playerConnection;
|
||||
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
|
||||
@@ -89,10 +95,13 @@ public class NPC_1_12 {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 4);
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||
}
|
||||
}else {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
@@ -137,10 +146,13 @@ public class NPC_1_12 {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 6);
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,10 +171,13 @@ public class NPC_1_12 {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 6 + new Random().nextInt(7));
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(7));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,10 +191,13 @@ public class NPC_1_12 {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheat.getPlugin(), 6 + new Random().nextInt(8));
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@ public class NameGenerator {
|
||||
"New",
|
||||
"Ultra",
|
||||
"Killer",
|
||||
"Swift"
|
||||
"Swift",
|
||||
"Yolo",
|
||||
"Rammel"
|
||||
});
|
||||
|
||||
private static final List<String> END = Arrays.asList(new String[]{
|
||||
@@ -26,9 +28,7 @@ public class NameGenerator {
|
||||
"Minecraft",
|
||||
"Games",
|
||||
"Bawz",
|
||||
"1",
|
||||
"51",
|
||||
"99",
|
||||
"kast",
|
||||
"" + new Random().nextInt(100)
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ 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.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
|
||||
@@ -104,7 +104,7 @@ public class PastebinReport {
|
||||
}
|
||||
|
||||
private void appendLogs() {
|
||||
List<String> logs = AntiCheat.getManager().getLoggingManager().getLastLogs();
|
||||
List<String> logs = AntiCheatReloaded.getManager().getLoggingManager().getLastLogs();
|
||||
if (logs.size() == 0) {
|
||||
append("No recent logs.");
|
||||
return;
|
||||
@@ -116,8 +116,8 @@ public class PastebinReport {
|
||||
|
||||
private void appendSystemInfo() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
Configuration config = AntiCheat.getManager().getConfiguration();
|
||||
append("AntiCheat Version: " + AntiCheat.getVersion());
|
||||
Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
||||
append("AntiCheat Version: " + AntiCheatReloaded.getVersion());
|
||||
append("Server Version: " + Bukkit.getVersion());
|
||||
append("Server Implementation: " + Bukkit.getName());
|
||||
append("Server ID: " + Bukkit.getServerId());
|
||||
@@ -130,7 +130,7 @@ public class PastebinReport {
|
||||
append("Online Mode: " + Bukkit.getOnlineMode());
|
||||
append("Players: " + Bukkit.getOnlinePlayers().size() + "/" + Bukkit.getMaxPlayers());
|
||||
append("Plugin Count: " + Bukkit.getPluginManager().getPlugins().length);
|
||||
append("Plugin Uptime: " + ((System.currentTimeMillis() - AntiCheat.getPlugin().getLoadTime()) / 1000) / 60 + " minutes");
|
||||
append("Plugin Uptime: " + ((System.currentTimeMillis() - AntiCheatReloaded.getPlugin().getLoadTime()) / 1000) / 60 + " minutes");
|
||||
append("Enterprise: " + config.getConfig().enterprise.getValue());
|
||||
if (config.getConfig().enterprise.getValue()) {
|
||||
append("- Server name: " + config.getEnterprise().serverName.getValue());
|
||||
@@ -143,8 +143,8 @@ public class PastebinReport {
|
||||
|
||||
private void appendMagicDiff() {
|
||||
// This is hacky, and I like it
|
||||
Magic magic = AntiCheat.getManager().getConfiguration().getMagic();
|
||||
FileConfiguration file = YamlConfiguration.loadConfiguration(new File(AntiCheat.getPlugin().getDataFolder(), "magic.yml"));
|
||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||
FileConfiguration file = YamlConfiguration.loadConfiguration(new File(AntiCheatReloaded.getPlugin().getDataFolder(), "magic.yml"));
|
||||
boolean changed = false;
|
||||
for (Field field : Magic.class.getFields()) {
|
||||
Object defaultValue = file.get(field.getName());
|
||||
@@ -169,11 +169,11 @@ public class PastebinReport {
|
||||
}
|
||||
|
||||
private void appendEventHandlers() {
|
||||
report.append(AntiCheat.getManager().getEventChainReport());
|
||||
report.append(AntiCheatReloaded.getManager().getEventChainReport());
|
||||
}
|
||||
|
||||
private void writeReport() throws IOException {
|
||||
File f = new File(AntiCheat.getPlugin().getDataFolder() + "/report.txt");
|
||||
File f = new File(AntiCheatReloaded.getPlugin().getDataFolder() + "/report.txt");
|
||||
FileWriter r = new FileWriter(f);
|
||||
BufferedWriter writer = new BufferedWriter(r);
|
||||
writer.write(report.toString());
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.util.rule.Rule;
|
||||
@@ -41,7 +41,7 @@ public class User {
|
||||
private int level = 0;
|
||||
private Location goodLocation;
|
||||
private List<ItemStack> inventorySnapshot = null;
|
||||
private Configuration config = AntiCheat.getManager().getConfiguration();
|
||||
private Configuration config = AntiCheatReloaded.getManager().getConfiguration();
|
||||
private int toX, toY, toZ;
|
||||
private String[] messages = new String[2];
|
||||
private Long[] messageTimes = new Long[2];
|
||||
@@ -151,7 +151,7 @@ public class User {
|
||||
// Check levels
|
||||
for (Group l : getLevels()) {
|
||||
if (l.getLevel() == level) {
|
||||
AntiCheat.getManager().getUserManager().alert(this, l, type);
|
||||
AntiCheatReloaded.getManager().getUserManager().alert(this, l, type);
|
||||
if (l.getLevel() == config.getGroups().getHighestLevel()) {
|
||||
level = l.getLevel() - 10;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -59,7 +59,7 @@ public final class Utilities {
|
||||
}
|
||||
}
|
||||
for (String msg : message) {
|
||||
AntiCheat.getManager().log(msg);
|
||||
AntiCheatReloaded.getManager().log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -8,10 +10,27 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
private static final List<String> SUPPORTED_VERSIONS = Arrays.asList(new String[] {
|
||||
"v1_8",
|
||||
"v1_9",
|
||||
"v1_10",
|
||||
"v1_11",
|
||||
"v1_12"
|
||||
});
|
||||
|
||||
public static String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
}
|
||||
|
||||
public static boolean isSupported() {
|
||||
for (String versionId : SUPPORTED_VERSIONS) {
|
||||
if (getVersion().startsWith(versionId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -52,6 +71,9 @@ public class VersionUtil {
|
||||
|
||||
public static boolean isFrostWalk(Player player) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
|
||||
if (player.getInventory().getBoots() == null) {
|
||||
return false;
|
||||
}
|
||||
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -21,7 +21,7 @@ package com.rammelkast.anticheatreloaded.util.enterprise;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
@@ -137,7 +137,7 @@ public class Database {
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
if (logInterval != 0) {
|
||||
eventTask = Bukkit.getScheduler().runTaskTimerAsynchronously(AntiCheat.getPlugin(), new Runnable() {
|
||||
eventTask = Bukkit.getScheduler().runTaskTimerAsynchronously(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
flushEvents();
|
||||
@@ -146,7 +146,7 @@ public class Database {
|
||||
}
|
||||
|
||||
if(syncLevels && syncInterval != 0) {
|
||||
syncTask = Bukkit.getScheduler().runTaskTimerAsynchronously(AntiCheat.getPlugin(), new Runnable() {
|
||||
syncTask = Bukkit.getScheduler().runTaskTimerAsynchronously(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
syncUsers();
|
||||
@@ -154,7 +154,7 @@ public class Database {
|
||||
}, syncInterval * 20, syncInterval * 20);
|
||||
}
|
||||
|
||||
AntiCheat.getPlugin().verboseLog("Connected to the database.");
|
||||
AntiCheatReloaded.getPlugin().verboseLog("Connected to the database.");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -203,7 +203,7 @@ public class Database {
|
||||
|
||||
public void cleanEvents() {
|
||||
if (logLife != 0) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheat.getPlugin(), new Runnable() {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(AntiCheatReloaded.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -213,7 +213,7 @@ public class Database {
|
||||
statement.executeUpdate();
|
||||
|
||||
connection.commit();
|
||||
AntiCheat.getPlugin().verboseLog("Cleaned " + statement.getUpdateCount() + " old events from the database");
|
||||
AntiCheatReloaded.getPlugin().verboseLog("Cleaned " + statement.getUpdateCount() + " old events from the database");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -223,8 +223,8 @@ public class Database {
|
||||
}
|
||||
|
||||
private void syncUsers() {
|
||||
for (User user : AntiCheat.getManager().getUserManager().getUsers()) {
|
||||
AntiCheat.getManager().getConfiguration().getLevels().updateLevelToUser(user);
|
||||
for (User user : AntiCheatReloaded.getManager().getUserManager().getUsers()) {
|
||||
AntiCheatReloaded.getManager().getConfiguration().getLevels().updateLevelToUser(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ package com.rammelkast.anticheatreloaded.util.rule;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheat;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.util.Group;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
@@ -175,7 +175,7 @@ public class Rule {
|
||||
if (variable.equals("player_level") && Utilities.isInt(value)) {
|
||||
user.setLevel(Integer.parseInt(value));
|
||||
} else if (variable.equals("player_group") && Utilities.isInt(value)) {
|
||||
for (Group group : AntiCheat.getManager().getConfiguration().getGroups().getGroups()) {
|
||||
for (Group group : AntiCheatReloaded.getManager().getConfiguration().getGroups().getGroups()) {
|
||||
if (group.getName().equalsIgnoreCase(value)) {
|
||||
user.setLevel(group.getLevel());
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class Rule {
|
||||
text = text.split("\\.")[1];
|
||||
List<String> action = new ArrayList<String>();
|
||||
action.add(text);
|
||||
AntiCheat.getManager().getUserManager().execute(user, action, type);
|
||||
AntiCheatReloaded.getManager().getUserManager().execute(user, action, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: AntiCheatReloaded
|
||||
author: Rammelkast
|
||||
description: AntiCheatReloaded helps easily identify and block malicious users on your server.
|
||||
main: com.rammelkast.anticheatreloaded.AntiCheat
|
||||
main: com.rammelkast.anticheatreloaded.AntiCheatReloaded
|
||||
depend: [ProtocolLib]
|
||||
startup: postworld
|
||||
version: ${project.build.version}
|
||||
|
||||
Reference in new issue
Block a user