mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c91ec7ba4 | ||
|
|
abff433510 | ||
|
|
fad298086c | ||
|
|
8b413a382a | ||
|
|
1428b55591 | ||
|
|
a84b573fa8 | ||
|
|
9211003d6d | ||
|
|
01df416236 | ||
|
|
619c8efae1 | ||
|
|
ab2fcc5521 | ||
|
|
8843725ede | ||
|
|
0d9b8707dd | ||
|
|
6e2eae7d1e | ||
|
|
ef5b4069ce | ||
|
|
3b9b39c49a | ||
|
|
09c42905d0 | ||
|
|
8de7ae1c59 | ||
|
|
768331011e | ||
|
|
1f48785d1d | ||
|
|
7cd90cfb61 | ||
|
|
5f181c556e | ||
|
|
16c778c17f | ||
|
|
97534e5df0 | ||
|
|
e770d0e01c | ||
|
|
a59a4baf28 | ||
|
|
7caf7376ba | ||
|
|
a6a39e352a | ||
|
|
700c0145f3 | ||
|
|
c74fc92da9 | ||
|
|
3bc49141fc | ||
|
|
cffd6d07ae | ||
|
|
e9a99f0463 | ||
|
|
4deb8ae0fb | ||
|
|
07f957cf35 | ||
|
|
9850f48a4e | ||
|
|
656841b046 | ||
|
|
fc006c39f2 | ||
|
|
f4ca2ea8bf | ||
|
|
6966582e4c | ||
|
|
168c25e5d2 | ||
|
|
07f3c3abce | ||
|
|
128a668e6c | ||
|
|
ad618ffaf0 | ||
|
|
2086a01f80 | ||
|
|
add3fe5eae | ||
|
|
20635a2acb | ||
|
|
636f94b408 |
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
AntiCheatReloaded
|
AntiCheatReloaded   
|
||||||
=============
|
=============
|
||||||
AntiCheatReloaded helps server admins combat the use of hacked clients and spambots. It analyses the behavior of players and can prevent malicious gameplay. The plugin offers a lot of customizability and can be connected across multiple servers in case it is used in a server network context. AntiCheatReloaded is based on gravitylow's AntiCheat and has been around since 2012.
|
AntiCheatReloaded helps server admins combat the use of hacked clients and spambots. It analyses the behavior of players and can prevent malicious gameplay. The plugin offers a lot of customizability and can be connected across multiple servers in case it is used in a server network context. AntiCheatReloaded is based on gravitylow's AntiCheat and has been around since 2012.
|
||||||
|
|
||||||
@@ -14,36 +14,40 @@ 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;
|
Please include the following information with your issue, this allows me to fix it quicker;
|
||||||
* Your AntiCheatReloaded version
|
* Your AntiCheatReloaded version
|
||||||
* Your server software (Bukkit/Spigot/Other) and it's version
|
* Your server implementation (Craftbukkit/Spigot/Other) and it's version
|
||||||
* Your ProtocolLib version
|
* Your ProtocolLib version
|
||||||
* Whether or not you are using protocol hacks (ViaVersion etc.)
|
* Whether or not you are using protocol hacks (ViaVersion etc.)
|
||||||
* Any logs relating to the issue
|
* Any logs relating to the issue
|
||||||
|
|
||||||
Hacks blocked
|
Hacks blocked
|
||||||
-------
|
-------
|
||||||
* Flight
|
* Flight/Glide
|
||||||
* Glide
|
* ElytraFly
|
||||||
* FastLadder
|
* WaterWalk/Jesus
|
||||||
* Jesus
|
|
||||||
* Step
|
|
||||||
* Criticals
|
|
||||||
* Anti-Knockback
|
|
||||||
* FastBow
|
|
||||||
* FastDrop
|
|
||||||
* Reach
|
|
||||||
* Spider
|
|
||||||
* Speed
|
|
||||||
* NoFall
|
|
||||||
* Sneak
|
|
||||||
* vClip
|
|
||||||
* FastBreak
|
* FastBreak
|
||||||
* FastPlace
|
* FastPlace
|
||||||
* Spam
|
* Chat spam
|
||||||
|
* Command spam
|
||||||
|
* Sprint
|
||||||
|
* (Packet)Sneak
|
||||||
|
* Speed
|
||||||
|
* Vclip
|
||||||
|
* Spider
|
||||||
|
* NoFall
|
||||||
|
* FastBow
|
||||||
* FastEat
|
* FastEat
|
||||||
* ElytraFly
|
* FastHeal
|
||||||
* Unicode chat
|
|
||||||
* GhostHand
|
|
||||||
* KillAura
|
* KillAura
|
||||||
|
* Aimbot
|
||||||
|
* Reach
|
||||||
|
* Unicode chat
|
||||||
|
* FastProjectile
|
||||||
|
* ItemSpam
|
||||||
|
* FastInventory
|
||||||
|
* Timer
|
||||||
|
* Blink
|
||||||
|
* Anti-Knockback
|
||||||
* Scaffold
|
* Scaffold
|
||||||
* MorePackets
|
* FastLadder
|
||||||
* BadPackets
|
* Strafe
|
||||||
|
* NoSlow
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
<groupId>com.rammelkast.anticheatreloaded</groupId>
|
||||||
<artifactId>AntiCheatReloaded</artifactId>
|
<artifactId>AntiCheatReloaded</artifactId>
|
||||||
<version>1.8.2-PRE</version>
|
<version>1.9.4</version>
|
||||||
<name>AntiCheatReloaded</name>
|
<name>AntiCheatReloaded</name>
|
||||||
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
|
||||||
<properties>
|
<properties>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.2.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -44,7 +44,6 @@
|
|||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>com.rammelkast.*</include>
|
<include>com.rammelkast.*</include>
|
||||||
<include>com.cryptomorin.*</include>
|
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -55,7 +54,7 @@
|
|||||||
<extension>
|
<extension>
|
||||||
<groupId>org.apache.maven.wagon</groupId>
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
<artifactId>wagon-file</artifactId>
|
<artifactId>wagon-file</artifactId>
|
||||||
<version>2.2</version>
|
<version>3.4.1</version>
|
||||||
</extension>
|
</extension>
|
||||||
</extensions>
|
</extensions>
|
||||||
<resources>
|
<resources>
|
||||||
@@ -69,7 +68,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.comphenix.protocol</groupId>
|
<groupId>com.comphenix.protocol</groupId>
|
||||||
<artifactId>ProtocolLib</artifactId>
|
<artifactId>ProtocolLib</artifactId>
|
||||||
<version>4.5.1-SNAPSHOT</version>
|
<version>4.6.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
@@ -80,7 +79,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.15.2-R0.1-SNAPSHOT</version>
|
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.ProtocolManager;
|
import com.comphenix.protocol.ProtocolManager;
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.EntityListener;
|
import com.rammelkast.anticheatreloaded.event.EntityListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.InventoryListener;
|
import com.rammelkast.anticheatreloaded.event.InventoryListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.PlayerListener;
|
import com.rammelkast.anticheatreloaded.event.PlayerListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.event.PotionEffectListener;
|
||||||
import com.rammelkast.anticheatreloaded.event.VehicleListener;
|
import com.rammelkast.anticheatreloaded.event.VehicleListener;
|
||||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||||
import com.rammelkast.anticheatreloaded.metrics.Metrics;
|
import com.rammelkast.anticheatreloaded.metrics.Metrics;
|
||||||
@@ -77,6 +77,10 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
eventList.add(new EntityListener());
|
eventList.add(new EntityListener());
|
||||||
eventList.add(new VehicleListener());
|
eventList.add(new VehicleListener());
|
||||||
eventList.add(new InventoryListener());
|
eventList.add(new InventoryListener());
|
||||||
|
// Handles 1.9+ potion effects
|
||||||
|
if (!VersionUtil.isBountifulUpdate()) {
|
||||||
|
eventList.add(new PotionEffectListener());
|
||||||
|
}
|
||||||
// Order is important in some cases, don't screw with these unless
|
// Order is important in some cases, don't screw with these unless
|
||||||
// needed, especially config
|
// needed, especially config
|
||||||
this.setupConfig();
|
this.setupConfig();
|
||||||
@@ -89,20 +93,22 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||||
this.setupProtocol();
|
this.setupProtocol();
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "Shutting down, ProtocolLib not found!");
|
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.RED
|
||||||
|
+ "Could not find ProtocolLib. Shutting down!");
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info("NMS version is " + VersionUtil.getVersion());
|
Bukkit.getConsoleSender()
|
||||||
if (!VersionUtil.isSupported()) {
|
.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED
|
+ "Running Minecraft version " + VersionUtil.getVersion() + " "
|
||||||
+ "The version of this server is NOT supported by ACR! The plugin will not work as expected!");
|
+ (VersionUtil.isSupported() ? (ChatColor.GREEN + "(supported)")
|
||||||
}
|
: (ChatColor.RED + "(NOT SUPPORTED!)")));
|
||||||
|
|
||||||
getLogger().info("Enabling packet listeners");
|
getLogger().info("Enabling packet listeners");
|
||||||
PacketListener.listenKeepAlivePackets();
|
|
||||||
PacketListener.listenMovementPackets();
|
PacketListener.listenMovementPackets();
|
||||||
|
PacketListener.listenKeepAlivePackets();
|
||||||
|
PacketListener.listenUseItemPackets();
|
||||||
|
|
||||||
updateManager = new UpdateManager();
|
updateManager = new UpdateManager();
|
||||||
|
|
||||||
@@ -164,6 +170,10 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
|
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
|
||||||
ticks = 1;
|
ticks = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for updates every 12 hours
|
||||||
|
if (ticks % 864000 == 0)
|
||||||
|
updateManager.update();
|
||||||
}
|
}
|
||||||
}.runTaskTimer(this, 40L, 1L);
|
}.runTaskTimer(this, 40L, 1L);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,5 +152,4 @@ public class AntiCheatAPI {
|
|||||||
return AntiCheatReloaded.getManager();
|
return AntiCheatReloaded.getManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,13 +16,10 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check;
|
package com.rammelkast.anticheatreloaded.check;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -31,7 +28,6 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@@ -43,12 +39,10 @@ import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
|||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||||
@@ -59,14 +53,11 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
|
|
||||||
public class Backend {
|
public class Backend {
|
||||||
public Map<UUID, Long> velocitized = new HashMap<UUID, Long>();
|
public Map<UUID, Long> velocitized = new HashMap<UUID, Long>();
|
||||||
private List<UUID> isAscending = new ArrayList<UUID>();
|
private Map<UUID, Long> levitatingEnd = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Integer> chatLevel = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> chatLevel = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Integer> commandLevel = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> commandLevel = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Integer> nofallViolation = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> nofallViolation = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Integer> fastBreakViolation = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Integer> fastBreaks = new HashMap<UUID, Integer>();
|
|
||||||
private Map<UUID, Boolean> blockBreakHolder = new HashMap<UUID, Boolean>();
|
private Map<UUID, Boolean> blockBreakHolder = new HashMap<UUID, Boolean>();
|
||||||
private Map<UUID, Long> lastBlockBroken = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Integer> fastPlaceViolation = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> fastPlaceViolation = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Long> lastBlockPlaced = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastBlockPlaced = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> lastBlockPlaceTime = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastBlockPlaceTime = new HashMap<UUID, Long>();
|
||||||
@@ -77,28 +68,28 @@ public class Backend {
|
|||||||
private Map<UUID, Long> lastHeal = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastHeal = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> projectileTime = new HashMap<UUID, Long>();
|
private Map<UUID, Long> projectileTime = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> bowWindUp = new HashMap<UUID, Long>();
|
private Map<UUID, Long> bowWindUp = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> instantBreakExempt = new HashMap<UUID, Long>();
|
|
||||||
private Map<UUID, Long> sprinted = new HashMap<UUID, Long>();
|
private Map<UUID, Long> sprinted = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> brokenBlock = new HashMap<UUID, Long>();
|
private Map<UUID, Long> brokenBlock = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> placedBlock = new HashMap<UUID, Long>();
|
public Map<UUID, Long> placedBlock = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> blockTime = new HashMap<UUID, Long>();
|
private Map<UUID, Long> blockTime = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Integer> blocksDropped = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> blocksDropped = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Long> lastInventoryTime = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastInventoryTime = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Long> inventoryTime = new HashMap<UUID, Long>();
|
private Map<UUID, Long> inventoryTime = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Integer> inventoryClicks = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> inventoryClicks = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Material> itemInHand = new HashMap<UUID, Material>();
|
|
||||||
private HashSet<Byte> transparent = new HashSet<Byte>();
|
private HashSet<Byte> transparent = new HashSet<Byte>();
|
||||||
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
|
||||||
private Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
|
private Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
|
||||||
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
private Map<UUID, Long> lastSneak = new HashMap<UUID, Long>();
|
||||||
|
|
||||||
private Magic magic;
|
private Magic magic;
|
||||||
|
private Checks checksConfig;
|
||||||
private AntiCheatManager manager = null;
|
private AntiCheatManager manager = null;
|
||||||
private Lang lang = null;
|
private Lang lang = null;
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public Backend(AntiCheatManager instance) {
|
public Backend(AntiCheatManager instance) {
|
||||||
magic = instance.getConfiguration().getMagic();
|
magic = instance.getConfiguration().getMagic();
|
||||||
|
checksConfig = instance.getConfiguration().getChecks();
|
||||||
manager = instance;
|
manager = instance;
|
||||||
lang = manager.getConfiguration().getLang();
|
lang = manager.getConfiguration().getLang();
|
||||||
transparent.add((byte) -1);
|
transparent.add((byte) -1);
|
||||||
@@ -128,13 +119,8 @@ public class Backend {
|
|||||||
startEat.remove(uuid);
|
startEat.remove(uuid);
|
||||||
lastHeal.remove(uuid);
|
lastHeal.remove(uuid);
|
||||||
sprinted.remove(uuid);
|
sprinted.remove(uuid);
|
||||||
instantBreakExempt.remove(uuid);
|
|
||||||
isAscending.remove(uuid);
|
|
||||||
nofallViolation.remove(uuid);
|
nofallViolation.remove(uuid);
|
||||||
fastBreakViolation.remove(uuid);
|
|
||||||
fastBreaks.remove(uuid);
|
|
||||||
blockBreakHolder.remove(uuid);
|
blockBreakHolder.remove(uuid);
|
||||||
lastBlockBroken.remove(uuid);
|
|
||||||
fastPlaceViolation.remove(uuid);
|
fastPlaceViolation.remove(uuid);
|
||||||
lastBlockPlaced.remove(uuid);
|
lastBlockPlaced.remove(uuid);
|
||||||
lastBlockPlaceTime.remove(uuid);
|
lastBlockPlaceTime.remove(uuid);
|
||||||
@@ -146,7 +132,6 @@ public class Backend {
|
|||||||
lastHeal.remove(uuid);
|
lastHeal.remove(uuid);
|
||||||
projectileTime.remove(uuid);
|
projectileTime.remove(uuid);
|
||||||
bowWindUp.remove(uuid);
|
bowWindUp.remove(uuid);
|
||||||
instantBreakExempt.remove(uuid);
|
|
||||||
sprinted.remove(uuid);
|
sprinted.remove(uuid);
|
||||||
brokenBlock.remove(uuid);
|
brokenBlock.remove(uuid);
|
||||||
placedBlock.remove(uuid);
|
placedBlock.remove(uuid);
|
||||||
@@ -158,28 +143,18 @@ public class Backend {
|
|||||||
lastFallPacket.remove(uuid);
|
lastFallPacket.remove(uuid);
|
||||||
fastSneakViolations.remove(uuid);
|
fastSneakViolations.remove(uuid);
|
||||||
lastSneak.remove(uuid);
|
lastSneak.remove(uuid);
|
||||||
|
levitatingEnd.remove(uuid);
|
||||||
AimbotCheck.LAST_DELTA_YAW.remove(uuid);
|
AimbotCheck.LAST_DELTA_YAW.remove(uuid);
|
||||||
VelocityCheck.VIOLATIONS.remove(uuid);
|
VelocityCheck.VIOLATIONS.remove(uuid);
|
||||||
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
MorePacketsCheck.LAST_PACKET_TIME.remove(uuid);
|
||||||
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
MorePacketsCheck.PACKET_BALANCE.remove(uuid);
|
||||||
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
|
||||||
GlideCheck.LAST_MOTION_Y.remove(uuid);
|
|
||||||
GlideCheck.LAST_FALL_DISTANCE.remove(uuid);
|
|
||||||
GlideCheck.VIOLATIONS.remove(uuid);
|
|
||||||
SpeedCheck.SPEED_VIOLATIONS.remove(uuid);
|
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
|
||||||
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
|
||||||
|
KillAuraCheck.PACKETORDER_FLAGS.remove(uuid);
|
||||||
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
FlightCheck.MOVING_EXEMPT.remove(uuid);
|
||||||
FlightCheck.ASCENSION_COUNT.remove(uuid);
|
NoSlowCheck.LAST_RELEASE.remove(uuid);
|
||||||
FlightCheck.BLOCKS_OVER_FLIGHT.remove(uuid);
|
NoSlowCheck.VIOLATIONS.remove(uuid);
|
||||||
YAxisCheck.Y_AXIS_VIOLATIONS.remove(uuid);
|
|
||||||
YAxisCheck.LAST_Y_AXIS_VIOLATION.remove(uuid);
|
|
||||||
YAxisCheck.LAST_Y_COORD_CACHE.remove(uuid);
|
|
||||||
YAxisCheck.LAST_Y_TIME.remove(uuid);
|
|
||||||
WaterWalkCheck.IS_IN_WATER.remove(uuid);
|
|
||||||
WaterWalkCheck.IS_IN_WATER_CACHE.remove(uuid);
|
|
||||||
WaterWalkCheck.WATER_ASCENSION_VIOLATIONS.remove(uuid);
|
|
||||||
WaterWalkCheck.WATER_SPEED_VIOLATIONS.remove(uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkFastBow(Player player, float force) {
|
public CheckResult checkFastBow(Player player, float force) {
|
||||||
@@ -192,7 +167,8 @@ public class Backend {
|
|||||||
float f = (float) ticks / 20.0F;
|
float f = (float) ticks / 20.0F;
|
||||||
f = (f * f + f * 2.0F) / 3.0F;
|
f = (f * f + f * 2.0F) / 3.0F;
|
||||||
f = f > 1.0F ? 1.0F : f;
|
f = f > 1.0F ? 1.0F : f;
|
||||||
if (Math.abs(force - f) > magic.BOW_ERROR()) {
|
double bowError = checksConfig.getDouble(CheckType.FAST_BOW, "bowError");
|
||||||
|
if (Math.abs(force - f) > bowError) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")");
|
"fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")");
|
||||||
} else {
|
} else {
|
||||||
@@ -202,16 +178,18 @@ public class Backend {
|
|||||||
|
|
||||||
public CheckResult checkProjectile(Player player) {
|
public CheckResult checkProjectile(Player player) {
|
||||||
incrementOld(player, projectilesShot, 10);
|
incrementOld(player, projectilesShot, 10);
|
||||||
|
int projectilesToWait = checksConfig.getInteger(CheckType.FAST_PROJECTILE, "projectilesToWait");
|
||||||
if (!projectileTime.containsKey(player.getUniqueId())) {
|
if (!projectileTime.containsKey(player.getUniqueId())) {
|
||||||
projectileTime.put(player.getUniqueId(), System.currentTimeMillis());
|
projectileTime.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
return new CheckResult(CheckResult.Result.PASSED);
|
return new CheckResult(CheckResult.Result.PASSED);
|
||||||
} else if (projectilesShot.get(player.getUniqueId()) == magic.PROJECTILE_CHECK()) {
|
} else if (projectilesShot.get(player.getUniqueId()) == projectilesToWait) {
|
||||||
long time = System.currentTimeMillis() - projectileTime.get(player.getUniqueId());
|
long time = System.currentTimeMillis() - projectileTime.get(player.getUniqueId());
|
||||||
|
int minimumTime = checksConfig.getInteger(CheckType.FAST_PROJECTILE, "minimumTime");
|
||||||
projectileTime.remove(player.getUniqueId());
|
projectileTime.remove(player.getUniqueId());
|
||||||
projectilesShot.remove(player.getUniqueId());
|
projectilesShot.remove(player.getUniqueId());
|
||||||
if (time < magic.PROJECTILE_TIME_MIN()) {
|
if (time < minimumTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "wound up a bow too fast (actual time=" + time
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
+ ", min time=" + magic.PROJECTILE_TIME_MIN() + ")");
|
"wound up a bow too fast (actual time=" + time + ", min time=" + minimumTime + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
@@ -219,56 +197,28 @@ public class Backend {
|
|||||||
|
|
||||||
public CheckResult checkFastDrop(Player player) {
|
public CheckResult checkFastDrop(Player player) {
|
||||||
incrementOld(player, blocksDropped, 10);
|
incrementOld(player, blocksDropped, 10);
|
||||||
|
int dropsToWait = checksConfig.getInteger(CheckType.ITEM_SPAM, "dropsToWait");
|
||||||
if (!blockTime.containsKey(player.getUniqueId())) {
|
if (!blockTime.containsKey(player.getUniqueId())) {
|
||||||
blockTime.put(player.getUniqueId(), System.currentTimeMillis());
|
blockTime.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
return new CheckResult(CheckResult.Result.PASSED);
|
return new CheckResult(CheckResult.Result.PASSED);
|
||||||
} else if (blocksDropped.get(player.getUniqueId()) == magic.DROP_CHECK()) {
|
} else if (blocksDropped.get(player.getUniqueId()) == dropsToWait) {
|
||||||
long time = System.currentTimeMillis() - blockTime.get(player.getUniqueId());
|
long time = System.currentTimeMillis() - blockTime.get(player.getUniqueId());
|
||||||
|
int minimumTime = checksConfig.getInteger(CheckType.ITEM_SPAM, "minimumTime");
|
||||||
blockTime.remove(player.getUniqueId());
|
blockTime.remove(player.getUniqueId());
|
||||||
blocksDropped.remove(player.getUniqueId());
|
blocksDropped.remove(player.getUniqueId());
|
||||||
if (time < magic.DROP_TIME_MIN()) {
|
if (time < minimumTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"dropped an item too fast (actual time=" + time + ", min time=" + magic.DROP_TIME_MIN() + ")");
|
"dropped an item too fast (actual time=" + time + ", min time=" + minimumTime + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkLongReachBlock(Player player, double x, double y, double z) {
|
|
||||||
if (isInstantBreakExempt(player)) {
|
|
||||||
return new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
} else {
|
|
||||||
String string = "reached too far for a block";
|
|
||||||
double distance = player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
|
||||||
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
|
||||||
: magic.BLOCK_MAX_DISTANCE();
|
|
||||||
double i = x >= distance ? x : y > distance ? y : z > distance ? z : -1;
|
|
||||||
if (i != -1) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
string + " (distance=" + i + ", max=" + magic.BLOCK_MAX_DISTANCE() + ")");
|
|
||||||
} else {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkLongReachDamage(Player player, double x, double y, double z) {
|
|
||||||
String string = "reached too far for an entity";
|
|
||||||
double i = x >= magic.ENTITY_MAX_DISTANCE() ? x
|
|
||||||
: y > magic.ENTITY_MAX_DISTANCE() ? y : z > magic.ENTITY_MAX_DISTANCE() ? z : -1;
|
|
||||||
if (i != -1) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
string + " (distance=" + i + ", max=" + magic.ENTITY_MAX_DISTANCE() + ")");
|
|
||||||
} else {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkSpider(Player player, double y) {
|
public CheckResult checkSpider(Player player, double y) {
|
||||||
if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN()
|
if (y <= 0.11761 && y >= 0.11759 && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
|
||||||
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())) {
|
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
|
||||||
|
&& !Utilities.isNearClimbable(player)) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb a non-climbable block (" + player.getLocation().getBlock().getType() + ")");
|
"tried to climb a non-climbable block (" + player.getLocation().getBlock().getType() + ")");
|
||||||
} else {
|
} else {
|
||||||
@@ -281,7 +231,8 @@ public class Backend {
|
|||||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||||
&& !VersionUtil.isSlowFalling(player)) {
|
&& !VersionUtil.isSlowFalling(player) && !Utilities
|
||||||
|
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation()) && !Utilities.isNearClimbable(player)) {
|
||||||
if (player.getFallDistance() == 0) {
|
if (player.getFallDistance() == 0) {
|
||||||
if (nofallViolation.get(uuid) == null) {
|
if (nofallViolation.get(uuid) == null) {
|
||||||
nofallViolation.put(uuid, 1);
|
nofallViolation.put(uuid, 1);
|
||||||
@@ -290,10 +241,11 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int i = nofallViolation.get(uuid);
|
int i = nofallViolation.get(uuid);
|
||||||
if (i >= magic.NOFALL_LIMIT()) {
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.NOFALL, "vlBeforeFlag");
|
||||||
|
if (i >= vlBeforeFlag) {
|
||||||
nofallViolation.put(player.getUniqueId(), 1);
|
nofallViolation.put(player.getUniqueId(), 1);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 "
|
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 "
|
||||||
+ i + " times in a row, max=" + magic.NOFALL_LIMIT() + ")");
|
+ i + " times in a row, max=" + vlBeforeFlag + ")");
|
||||||
} else {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
@@ -305,43 +257,18 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkSneak(Player player, Location location, double x, double z) {
|
|
||||||
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()
|
|
||||||
&& !Utilities.cantStandAtExp(location) && !Utilities.isSlab(location.getBlock().getRelative(BlockFace.DOWN))) {
|
|
||||||
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
|
|
||||||
if (i != -1) {
|
|
||||||
if (this.fastSneakViolations.containsKey(player.getUniqueId())) {
|
|
||||||
int flags = this.fastSneakViolations.get(player.getUniqueId());
|
|
||||||
if (flags >= 3) { // TODO possible config
|
|
||||||
this.fastSneakViolations.put(player.getUniqueId(), flags - 1);
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
|
|
||||||
}
|
|
||||||
this.fastSneakViolations.put(player.getUniqueId(), flags + 1);
|
|
||||||
return PASS;
|
|
||||||
} else {
|
|
||||||
this.fastSneakViolations.put(player.getUniqueId(), 0);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.fastSneakViolations.remove(player.getUniqueId());
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.fastSneakViolations.remove(player.getUniqueId());
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkSneakToggle(Player player) {
|
public CheckResult checkSneakToggle(Player player) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
final long lastSneak = this.lastSneak.getOrDefault(player.getUniqueId(), (long) 0);
|
||||||
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
this.lastSneak.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
if (System.currentTimeMillis() - lastSneak < 75 && (AntiCheatReloaded.getPlugin().getTPS() > 12
|
if (System.currentTimeMillis() - lastSneak < checksConfig.getInteger(CheckType.SNEAK, "minToggleTime")
|
||||||
&& !user.isLagging())) {
|
&& (AntiCheatReloaded.getPlugin().getTPS() > checksConfig.getInteger(CheckType.SNEAK, "minimumTps"))) {
|
||||||
if (!this.silentMode()) {
|
if (user.isLagging() && checksConfig.getBoolean(CheckType.SNEAK, "disableForLagging"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
if (!this.silentMode())
|
||||||
player.teleport(user.getGoodLocation(player.getLocation()));
|
player.teleport(user.getGoodLocation(player.getLocation()));
|
||||||
}
|
|
||||||
return new CheckResult(Result.FAILED,
|
return new CheckResult(Result.FAILED,
|
||||||
"toggled sneak too fast (time=" + (System.currentTimeMillis() - lastSneak) + ")");
|
"toggled sneak too fast (time=" + (System.currentTimeMillis() - lastSneak) + ")");
|
||||||
}
|
}
|
||||||
@@ -350,10 +277,11 @@ public class Backend {
|
|||||||
|
|
||||||
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
|
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
int sprintFoodMin = checksConfig.getInteger(CheckType.SPRINT, "sprintFoodMin");
|
||||||
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE
|
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE
|
||||||
&& player.getFoodLevel() <= magic.SPRINT_FOOD_MIN()) {
|
&& player.getFoodLevel() <= sprintFoodMin) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"sprinted while hungry (food=" + player.getFoodLevel() + ", min=" + magic.SPRINT_FOOD_MIN() + ")");
|
"sprinted while hungry (food=" + player.getFoodLevel() + ", min=" + sprintFoodMin + ")");
|
||||||
} else {
|
} else {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
@@ -379,102 +307,11 @@ public class Backend {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logAscension(Player player, double y1, double y2) {
|
|
||||||
UUID name = player.getUniqueId();
|
|
||||||
if (y1 < y2 && !isAscending.contains(name)) {
|
|
||||||
isAscending.add(name);
|
|
||||||
} else {
|
|
||||||
isAscending.remove(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkSwing(Player player, Block block) {
|
|
||||||
UUID uuid = player.getUniqueId();
|
|
||||||
if (!isInstantBreakExempt(player)) {
|
|
||||||
if (!VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.DIG_SPEED)
|
|
||||||
&& !(VersionUtil.getItemInHand(player).getType() == Material.SHEARS
|
|
||||||
&& block.getType().name().endsWith("LEAVES"))) {
|
|
||||||
if (blockPunches.get(uuid) != null && player.getGameMode() != GameMode.CREATIVE) {
|
|
||||||
int i = blockPunches.get(uuid);
|
|
||||||
if (i < magic.BLOCK_PUNCH_MIN()) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break a block of " + block.getType()
|
|
||||||
+ " after only " + i + " punches (min=" + magic.BLOCK_PUNCH_MIN() + ")");
|
|
||||||
} else {
|
|
||||||
blockPunches.put(uuid, 0); // it should reset after EACH block break.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkFastBreak(Player player, Block block) {
|
|
||||||
int violations = magic.FASTBREAK_MAXVIOLATIONS();
|
|
||||||
long timemax = isInstantBreakExempt(player) ? 0
|
|
||||||
: Utilities.calcSurvivalFastBreak(VersionUtil.getItemInHand(player), block.getType());
|
|
||||||
if (player.getGameMode() == GameMode.CREATIVE) {
|
|
||||||
violations = magic.FASTBREAK_MAXVIOLATIONS_CREATIVE();
|
|
||||||
timemax = magic.FASTBREAK_TIMEMAX_CREATIVE();
|
|
||||||
}
|
|
||||||
UUID uuid = player.getUniqueId();
|
|
||||||
if (!fastBreakViolation.containsKey(uuid)) {
|
|
||||||
fastBreakViolation.put(uuid, 0);
|
|
||||||
} else {
|
|
||||||
Long math = System.currentTimeMillis() - lastBlockBroken.get(uuid);
|
|
||||||
int i = fastBreakViolation.get(uuid);
|
|
||||||
if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) {
|
|
||||||
lastBlockBroken.put(uuid, System.currentTimeMillis());
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"broke blocks too fast " + i + " times in a row (max=" + violations + ")");
|
|
||||||
} else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) {
|
|
||||||
fastBreakViolation.put(uuid, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!fastBreaks.containsKey(uuid) || !lastBlockBroken.containsKey(uuid)) {
|
|
||||||
if (!lastBlockBroken.containsKey(uuid)) {
|
|
||||||
lastBlockBroken.put(uuid, System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
if (!fastBreaks.containsKey(uuid)) {
|
|
||||||
fastBreaks.put(uuid, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Long math = System.currentTimeMillis() - lastBlockBroken.get(uuid);
|
|
||||||
if ((math != 0L && timemax != 0L)) {
|
|
||||||
if (math < timemax) {
|
|
||||||
if (fastBreakViolation.containsKey(uuid) && fastBreakViolation.get(uuid) > 0) {
|
|
||||||
fastBreakViolation.put(uuid, fastBreakViolation.get(uuid) + 1);
|
|
||||||
} else {
|
|
||||||
fastBreaks.put(uuid, fastBreaks.get(uuid) + 1);
|
|
||||||
}
|
|
||||||
blockBreakHolder.put(uuid, false);
|
|
||||||
}
|
|
||||||
if (fastBreaks.get(uuid) >= magic.FASTBREAK_LIMIT() && math < timemax) {
|
|
||||||
int i = fastBreaks.get(uuid);
|
|
||||||
fastBreaks.put(uuid, 0);
|
|
||||||
fastBreakViolation.put(uuid, fastBreakViolation.get(uuid) + 1);
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break " + i + " blocks in " + math
|
|
||||||
+ " ms (max=" + magic.FASTBREAK_LIMIT() + " in " + timemax + " ms)");
|
|
||||||
} else if (fastBreaks.get(uuid) >= magic.FASTBREAK_LIMIT() || fastBreakViolation.get(uuid) > 0) {
|
|
||||||
if (!blockBreakHolder.containsKey(uuid) || !blockBreakHolder.get(uuid)) {
|
|
||||||
blockBreakHolder.put(uuid, true);
|
|
||||||
} else {
|
|
||||||
fastBreaks.put(uuid, fastBreaks.get(uuid) - 1);
|
|
||||||
if (fastBreakViolation.get(uuid) > 0) {
|
|
||||||
fastBreakViolation.put(uuid, fastBreakViolation.get(uuid) - 1);
|
|
||||||
}
|
|
||||||
blockBreakHolder.put(uuid, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lastBlockBroken.put(uuid, System.currentTimeMillis()); // always keep a log going.
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkFastPlace(Player player) {
|
public CheckResult checkFastPlace(Player player) {
|
||||||
int violations = player.getGameMode() == GameMode.CREATIVE ? magic.FASTPLACE_MAXVIOLATIONS_CREATIVE()
|
int vlBeforeFlagSurvival = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagSurvival");
|
||||||
: magic.FASTPLACE_MAXVIOLATIONS();
|
int vlBeforeFlagCreative = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagCreative");
|
||||||
|
int blockPlacementTime = checksConfig.getInteger(CheckType.FAST_PLACE, "blockPlacementTime");
|
||||||
|
int violations = player.getGameMode() == GameMode.CREATIVE ? vlBeforeFlagCreative : vlBeforeFlagSurvival;
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
if (!lastBlockPlaceTime.containsKey(uuid) || !fastPlaceViolation.containsKey(uuid)) {
|
if (!lastBlockPlaceTime.containsKey(uuid) || !fastPlaceViolation.containsKey(uuid)) {
|
||||||
@@ -484,24 +321,25 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
} else if (fastPlaceViolation.containsKey(uuid) && fastPlaceViolation.get(uuid) > violations) {
|
} else if (fastPlaceViolation.containsKey(uuid) && fastPlaceViolation.get(uuid) > violations) {
|
||||||
Long math = System.currentTimeMillis() - lastBlockPlaced.get(uuid);
|
Long math = System.currentTimeMillis() - lastBlockPlaced.get(uuid);
|
||||||
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
if (lastBlockPlaced.get(uuid) > 0 && math < blockPlacementTime) {
|
||||||
lastBlockPlaced.put(uuid, time);
|
lastBlockPlaced.put(uuid, time);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast "
|
return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast "
|
||||||
+ fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
|
+ fastPlaceViolation.get(uuid) + " times in a row (max=" + violations + ")");
|
||||||
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
} else if (lastBlockPlaced.get(uuid) > 0 && math > blockPlacementTime) {
|
||||||
fastPlaceViolation.put(uuid, 0);
|
fastPlaceViolation.put(uuid, 0);
|
||||||
}
|
}
|
||||||
} else if (lastBlockPlaced.containsKey(uuid)) {
|
} else if (lastBlockPlaced.containsKey(uuid)) {
|
||||||
long last = lastBlockPlaced.get(uuid);
|
long last = lastBlockPlaced.get(uuid);
|
||||||
long lastTime = lastBlockPlaceTime.get(uuid);
|
long lastTime = lastBlockPlaceTime.get(uuid);
|
||||||
long thisTime = time - last;
|
long thisTime = time - last;
|
||||||
|
int minimumTime = checksConfig.getInteger(CheckType.FAST_PLACE, "minimumTime");
|
||||||
|
|
||||||
if (lastTime != 0 && thisTime < magic.FASTPLACE_TIMEMIN()) {
|
if (lastTime != 0 && thisTime < minimumTime) {
|
||||||
lastBlockPlaceTime.put(uuid, (time - last));
|
lastBlockPlaceTime.put(uuid, (time - last));
|
||||||
lastBlockPlaced.put(uuid, time);
|
lastBlockPlaced.put(uuid, time);
|
||||||
fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1);
|
fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block " + thisTime
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
+ " ms after the last one (min=" + magic.FASTPLACE_TIMEMIN() + " ms)");
|
"tried to place a block " + thisTime + " ms after the last one (min=" + minimumTime + " ms)");
|
||||||
}
|
}
|
||||||
lastBlockPlaceTime.put(uuid, (time - last));
|
lastBlockPlaceTime.put(uuid, (time - last));
|
||||||
}
|
}
|
||||||
@@ -518,7 +356,8 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEating(Player player) {
|
public boolean isEating(Player player) {
|
||||||
return startEat.containsKey(player.getUniqueId()) && startEat.get(player.getUniqueId()) < magic.EAT_TIME_MIN();
|
return startEat.containsKey(player.getUniqueId())
|
||||||
|
&& startEat.get(player.getUniqueId()) < checksConfig.getInteger(CheckType.FAST_EAT, "eatTimeMin");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logHeal(Player player) {
|
public void logHeal(Player player) {
|
||||||
@@ -536,16 +375,18 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
Long l = user.getMessageTime(i);
|
Long l = user.getMessageTime(i);
|
||||||
|
|
||||||
if (System.currentTimeMillis() - l > magic.CHAT_REPEAT_MIN()) {
|
int repeatIgnore = checksConfig.getInteger(CheckType.CHAT_SPAM, "repeatIgnore");
|
||||||
|
if (System.currentTimeMillis() - l > repeatIgnore) {
|
||||||
user.clearMessages();
|
user.clearMessages();
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
int timeMin = checksConfig.getInteger(CheckType.CHAT_SPAM, "timeMin");
|
||||||
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue()
|
if (manager.getConfiguration().getConfig().blockChatSpamRepetition.getValue()
|
||||||
&& m.equalsIgnoreCase(msg) && i == 1) {
|
&& m.equalsIgnoreCase(msg) && i == 1) {
|
||||||
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
|
manager.getLoggingManager().logFineInfo(player.getName() + " spam-repeated \"" + msg + "\"");
|
||||||
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
||||||
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue()
|
} else if (manager.getConfiguration().getConfig().blockChatSpamSpeed.getValue()
|
||||||
&& System.currentTimeMillis() - user.getLastCommandTime() < magic.CHAT_MIN()) {
|
&& System.currentTimeMillis() - user.getLastCommandTime() < timeMin) {
|
||||||
manager.getLoggingManager().logFineInfo(player.getName() + " spammed quickly \"" + msg + "\"");
|
manager.getLoggingManager().logFineInfo(player.getName() + " spammed quickly \"" + msg + "\"");
|
||||||
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
||||||
}
|
}
|
||||||
@@ -563,7 +404,9 @@ public class Backend {
|
|||||||
if (Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.BASIC_LATIN
|
if (Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.BASIC_LATIN
|
||||||
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.LATIN_1_SUPPLEMENT
|
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.LATIN_1_SUPPLEMENT
|
||||||
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.LATIN_EXTENDED_A
|
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.LATIN_EXTENDED_A
|
||||||
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.GENERAL_PUNCTUATION) {
|
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.GENERAL_PUNCTUATION
|
||||||
|
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.CYRILLIC
|
||||||
|
&& Character.UnicodeBlock.of(ch) != Character.UnicodeBlock.CYRILLIC_EXTENDED_A) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "Unicode chat is not allowed.");
|
return new CheckResult(CheckResult.Result.FAILED, "Unicode chat is not allowed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -582,15 +425,17 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
Long l = user.getCommandTime(i);
|
Long l = user.getCommandTime(i);
|
||||||
|
|
||||||
if (System.currentTimeMillis() - l > magic.COMMAND_REPEAT_MIN()) {
|
int repeatIgnore = checksConfig.getInteger(CheckType.COMMAND_SPAM, "repeatIgnore");
|
||||||
|
if (System.currentTimeMillis() - l > repeatIgnore) {
|
||||||
user.clearCommands();
|
user.clearCommands();
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
int timeMin = checksConfig.getInteger(CheckType.COMMAND_SPAM, "timeMin");
|
||||||
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue()
|
if (manager.getConfiguration().getConfig().blockCommandSpamRepetition.getValue()
|
||||||
&& m.equalsIgnoreCase(cmd) && i == 1) {
|
&& m.equalsIgnoreCase(cmd) && i == 1) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
||||||
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue()
|
} else if (manager.getConfiguration().getConfig().blockCommandSpamSpeed.getValue()
|
||||||
&& System.currentTimeMillis() - user.getLastCommandTime() < magic.COMMAND_MIN()) {
|
&& System.currentTimeMillis() - user.getLastCommandTime() < timeMin) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
return new CheckResult(CheckResult.Result.FAILED, lang.SPAM_WARNING());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -610,54 +455,39 @@ public class Backend {
|
|||||||
clicks = inventoryClicks.get(uuid) + 1;
|
clicks = inventoryClicks.get(uuid) + 1;
|
||||||
}
|
}
|
||||||
inventoryClicks.put(uuid, clicks);
|
inventoryClicks.put(uuid, clicks);
|
||||||
|
int clicksToWait = checksConfig.getInteger(CheckType.FAST_INVENTORY, "clicksToWait");
|
||||||
if (clicks == 1) {
|
if (clicks == 1) {
|
||||||
inventoryTime.put(uuid, System.currentTimeMillis());
|
inventoryTime.put(uuid, System.currentTimeMillis());
|
||||||
} else if (clicks == magic.INVENTORY_CHECK()) {
|
} else if (clicks == clicksToWait) {
|
||||||
|
int minimumTime = checksConfig.getInteger(CheckType.FAST_INVENTORY, "clicksToWait");
|
||||||
long time = System.currentTimeMillis() - inventoryTime.get(uuid);
|
long time = System.currentTimeMillis() - inventoryTime.get(uuid);
|
||||||
inventoryClicks.put(uuid, 0);
|
inventoryClicks.put(uuid, 0);
|
||||||
if (time < magic.INVENTORY_TIMEMIN()) {
|
if (time < minimumTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "clicked inventory slots " + clicks + " times in "
|
return new CheckResult(CheckResult.Result.FAILED, "clicked inventory slots " + clicks + " times in "
|
||||||
+ time + " ms (max=" + magic.INVENTORY_CHECK() + " in " + magic.INVENTORY_TIMEMIN() + " ms)");
|
+ time + " ms (max=" + clicksToWait + " in " + minimumTime + " ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkAutoTool(Player player) {
|
|
||||||
if (itemInHand.containsKey(player.getUniqueId())
|
|
||||||
&& itemInHand.get(player.getUniqueId()) != VersionUtil.getItemInHand(player).getType()) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"switched tools too fast (had " + itemInHand.get(player.getUniqueId()) + ", has "
|
|
||||||
+ VersionUtil.getItemInHand(player).getType() + ")");
|
|
||||||
} else {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkSprintDamage(Player player) {
|
|
||||||
if (isDoing(player, sprinted, magic.SPRINT_MAX())) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"sprinted and damaged an entity too fast (min sprint=" + magic.SPRINT_MAX() + " ms)");
|
|
||||||
} else {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CheckResult checkFastHeal(Player player) {
|
public CheckResult checkFastHeal(Player player) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (lastHeal.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (tps < 17.5
|
if (tps < checksConfig.getDouble(CheckType.FAST_HEAL, "minimumTps")
|
||||||
|| user.isLagging()) {
|
|| (user.isLagging() && checksConfig.getBoolean(CheckType.FAST_HEAL, "disableForLagging"))) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
long healTime = magic.MIN_HEAL_TIME() - (tps >= 18.5 ? 0 : 50);
|
long minHealTime = checksConfig.getInteger(CheckType.FAST_HEAL, "minHealTime");
|
||||||
long l = lastHeal.get(player.getUniqueId());
|
long lastHealTime = lastHeal.get(player.getUniqueId());
|
||||||
|
int ping = user.getPing();
|
||||||
|
double pingCompensation = checksConfig.getInteger(CheckType.FAST_HEAL, "pingCompensation");
|
||||||
|
long allowedHealTime = (long) (minHealTime - (ping * pingCompensation));
|
||||||
lastHeal.remove(player.getUniqueId());
|
lastHeal.remove(player.getUniqueId());
|
||||||
if ((System.currentTimeMillis() - l) < healTime) {
|
if ((System.currentTimeMillis() - lastHealTime) < allowedHealTime) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time="
|
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time="
|
||||||
+ (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
|
+ (System.currentTimeMillis() - lastHealTime) + " ms, min=" + allowedHealTime + " ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
@@ -667,57 +497,50 @@ public class Backend {
|
|||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
if (startEat.containsKey(player.getUniqueId())) // Otherwise it was modified by a plugin, don't worry about it.
|
||||||
{
|
{
|
||||||
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5
|
if (AntiCheatReloaded.getPlugin().getTPS() < 17.5 || user.isLagging()) {
|
||||||
|| user.isLagging()) {
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
long l = startEat.get(player.getUniqueId());
|
long l = startEat.get(player.getUniqueId());
|
||||||
startEat.remove(player.getUniqueId());
|
startEat.remove(player.getUniqueId());
|
||||||
if ((System.currentTimeMillis() - l) < magic.EAT_TIME_MIN()) {
|
int eatTimeMin = checksConfig.getInteger(CheckType.FAST_EAT, "eatTimeMin");
|
||||||
|
if ((System.currentTimeMillis() - l) < eatTimeMin) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "ate too quickly (time="
|
return new CheckResult(CheckResult.Result.FAILED, "ate too quickly (time="
|
||||||
+ (System.currentTimeMillis() - l) + " ms, min=" + magic.EAT_TIME_MIN() + " ms)");
|
+ (System.currentTimeMillis() - l) + " ms, min=" + eatTimeMin + " ms)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logInstantBreak(final Player player) {
|
|
||||||
instantBreakExempt.put(player.getUniqueId(), System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInstantBreakExempt(Player player) {
|
|
||||||
return isDoing(player, instantBreakExempt, magic.INSTANT_BREAK_TIME());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logSprint(final Player player) {
|
public void logSprint(final Player player) {
|
||||||
sprinted.put(player.getUniqueId(), System.currentTimeMillis());
|
sprinted.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHoveringOverWaterAfterViolation(Player player) {
|
|
||||||
if (WaterWalkCheck.WATER_SPEED_VIOLATIONS.containsKey(player.getUniqueId())) {
|
|
||||||
if (WaterWalkCheck.WATER_SPEED_VIOLATIONS.get(player.getUniqueId()) >= magic.WATER_SPEED_VIOLATION_MAX()
|
|
||||||
&& Utilities.isHoveringOverWater(player.getLocation())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logBlockBreak(final Player player) {
|
public void logBlockBreak(final Player player) {
|
||||||
brokenBlock.put(player.getUniqueId(), System.currentTimeMillis());
|
brokenBlock.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean justBroke(Player player) {
|
public boolean justBroke(Player player) {
|
||||||
return isDoing(player, brokenBlock, magic.BLOCK_BREAK_MIN());
|
// TODO config??
|
||||||
|
return isDoing(player, brokenBlock, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logVelocity(final Player player) {
|
public void logVelocity(final Player player) {
|
||||||
velocitized.put(player.getUniqueId(), System.currentTimeMillis());
|
velocitized.put(player.getUniqueId(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void logLevitating(final Player player, final int duration) {
|
||||||
|
levitatingEnd.put(player.getUniqueId(), System.currentTimeMillis() + (duration * 1000L));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean justVelocity(Player player) {
|
public boolean justVelocity(Player player) {
|
||||||
return (velocitized.containsKey(player.getUniqueId())
|
return (velocitized.containsKey(player.getUniqueId())
|
||||||
? (System.currentTimeMillis() - velocitized.get(player.getUniqueId())) < magic.VELOCITY_CHECKTIME()
|
? (System.currentTimeMillis() - velocitized.get(player.getUniqueId())) < magic.VELOCITY_TIME()
|
||||||
|
: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean justLevitated(Player player) {
|
||||||
|
return (levitatingEnd.containsKey(player.getUniqueId())
|
||||||
|
? (System.currentTimeMillis() - levitatingEnd.get(player.getUniqueId())) < magic.VELOCITY_TIME()
|
||||||
: false);
|
: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -732,7 +555,7 @@ public class Backend {
|
|||||||
public void run() {
|
public void run() {
|
||||||
velocitytrack.put(player.getUniqueId(), 0);
|
velocitytrack.put(player.getUniqueId(), 0);
|
||||||
}
|
}
|
||||||
}, magic.VELOCITY_SCHETIME() * 20L);
|
}, magic.VELOCITY_EXTENSION() * 20L);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -747,7 +570,8 @@ public class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean justPlaced(Player player) {
|
public boolean justPlaced(Player player) {
|
||||||
return isDoing(player, placedBlock, magic.BLOCK_PLACE_MIN());
|
// TODO config??
|
||||||
|
return isDoing(player, placedBlock, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logDamage(final Player player, int type) {
|
public void logDamage(final Player player, int type) {
|
||||||
@@ -775,32 +599,16 @@ public class Backend {
|
|||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logToggleSneak(final Player player) {
|
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.SNEAK_TIME());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logTeleport(final Player player) {
|
public void logTeleport(final Player player) {
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.TELEPORT_TIME());
|
manager.getUserManager().getUser(player.getUniqueId()).getMovementManager().lastTeleport = System
|
||||||
|
.currentTimeMillis();
|
||||||
/* Data for fly/speed should be reset */
|
/* Data for fly/speed should be reset */
|
||||||
nofallViolation.remove(player.getUniqueId());
|
nofallViolation.remove(player.getUniqueId());
|
||||||
FlightCheck.BLOCKS_OVER_FLIGHT.remove(player.getUniqueId());
|
|
||||||
YAxisCheck.Y_AXIS_VIOLATIONS.remove(player.getUniqueId());
|
|
||||||
YAxisCheck.LAST_Y_AXIS_VIOLATION.remove(player.getUniqueId());
|
|
||||||
YAxisCheck.LAST_Y_COORD_CACHE.remove(player.getUniqueId());
|
|
||||||
YAxisCheck.LAST_Y_TIME.remove(player.getUniqueId());
|
|
||||||
GlideCheck.LAST_FALL_DISTANCE.remove(player.getUniqueId());
|
|
||||||
GlideCheck.LAST_MOTION_Y.remove(player.getUniqueId());
|
|
||||||
GlideCheck.VIOLATIONS.remove(player.getUniqueId());
|
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logExitFly(final Player player) {
|
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.EXIT_FLY_TIME());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logBoatCollision(final Player player) {
|
public void logBoatCollision(final Player player) {
|
||||||
// TODO config
|
// TODO config??
|
||||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,10 +621,6 @@ public class Backend {
|
|||||||
return isDoing(player, FlightCheck.MOVING_EXEMPT, -1);
|
return isDoing(player, FlightCheck.MOVING_EXEMPT, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAscending(Player player) {
|
|
||||||
return isAscending.contains(player.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
public boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
||||||
if (map.containsKey(player.getUniqueId())) {
|
if (map.containsKey(player.getUniqueId())) {
|
||||||
if (max != -1) {
|
if (max != -1) {
|
||||||
@@ -851,9 +655,10 @@ public class Backend {
|
|||||||
public void processChatSpammer(Player player) {
|
public void processChatSpammer(Player player) {
|
||||||
User user = manager.getUserManager().getUser(player.getUniqueId());
|
User user = manager.getUserManager().getUser(player.getUniqueId());
|
||||||
int level = chatLevel.containsKey(user.getUUID()) ? chatLevel.get(user.getUUID()) : 0;
|
int level = chatLevel.containsKey(user.getUUID()) ? chatLevel.get(user.getUUID()) : 0;
|
||||||
if (player != null && player.isOnline() && level >= magic.CHAT_ACTION_ONE_LEVEL()) {
|
int levelActionOne = checksConfig.getInteger(CheckType.CHAT_SPAM, "levelActionOne");
|
||||||
String event = level >= magic.CHAT_ACTION_TWO_LEVEL()
|
int levelActionTwo = checksConfig.getInteger(CheckType.CHAT_SPAM, "levelActionTwo");
|
||||||
? manager.getConfiguration().getConfig().chatSpamActionTwo.getValue()
|
if (player != null && player.isOnline() && level >= levelActionOne) {
|
||||||
|
String event = level >= levelActionTwo ? manager.getConfiguration().getConfig().chatSpamActionTwo.getValue()
|
||||||
: manager.getConfiguration().getConfig().chatSpamActionOne.getValue();
|
: manager.getConfiguration().getConfig().chatSpamActionOne.getValue();
|
||||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
||||||
Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.SPAM_KICK_REASON(),
|
Utilities.stringToList(event), CheckType.CHAT_SPAM, lang.SPAM_KICK_REASON(),
|
||||||
@@ -865,8 +670,10 @@ public class Backend {
|
|||||||
public void processCommandSpammer(Player player) {
|
public void processCommandSpammer(Player player) {
|
||||||
User user = manager.getUserManager().getUser(player.getUniqueId());
|
User user = manager.getUserManager().getUser(player.getUniqueId());
|
||||||
int level = commandLevel.containsKey(user.getUUID()) ? commandLevel.get(user.getUUID()) : 0;
|
int level = commandLevel.containsKey(user.getUUID()) ? commandLevel.get(user.getUUID()) : 0;
|
||||||
if (player != null && player.isOnline() && level >= magic.COMMAND_ACTION_ONE_LEVEL()) {
|
int levelActionOne = checksConfig.getInteger(CheckType.COMMAND_SPAM, "levelActionOne");
|
||||||
String event = level >= magic.COMMAND_ACTION_TWO_LEVEL()
|
int levelActionTwo = checksConfig.getInteger(CheckType.COMMAND_SPAM, "levelActionTwo");
|
||||||
|
if (player != null && player.isOnline() && level >= levelActionOne) {
|
||||||
|
String event = level >= levelActionTwo
|
||||||
? manager.getConfiguration().getConfig().commandSpamActionTwo.getValue()
|
? manager.getConfiguration().getConfig().commandSpamActionTwo.getValue()
|
||||||
: manager.getConfiguration().getConfig().commandSpamActionOne.getValue();
|
: manager.getConfiguration().getConfig().commandSpamActionOne.getValue();
|
||||||
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
manager.getUserManager().execute(manager.getUserManager().getUser(player.getUniqueId()),
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class CheckResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Result result;
|
private Result result;
|
||||||
|
private String subCheck;
|
||||||
private String message;
|
private String message;
|
||||||
private int data;
|
private int data;
|
||||||
|
|
||||||
@@ -34,6 +35,12 @@ public class CheckResult {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CheckResult(Result result, String subcheck, String message) {
|
||||||
|
this(result);
|
||||||
|
this.subCheck = subcheck;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
public CheckResult(Result result, String message) {
|
public CheckResult(Result result, String message) {
|
||||||
this(result);
|
this(result);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
@@ -47,6 +54,10 @@ public class CheckResult {
|
|||||||
return result == Result.FAILED;
|
return result == Result.FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSubCheck() {
|
||||||
|
return subCheck;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,48 +36,50 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public enum CheckType {
|
public enum CheckType {
|
||||||
FLIGHT(Permission.CHECK_FLIGHT),
|
FLIGHT(Permission.CHECK_FLIGHT, "Flight"),
|
||||||
ELYTRAFLY(Permission.CHECK_FLIGHT),
|
ELYTRAFLY(Permission.CHECK_FLIGHT, "ElytraFly"),
|
||||||
WATER_WALK(Permission.CHECK_WATERWALK),
|
WATER_WALK(Permission.CHECK_WATERWALK, "WaterWalk"),
|
||||||
NO_SWING(Permission.CHECK_NOSWING),
|
FAST_PLACE(Permission.CHECK_FASTPLACE, "FastPlace"),
|
||||||
FAST_BREAK(Permission.CHECK_FASTBREAK),
|
CHAT_SPAM(Permission.CHECK_CHATSPAM, "ChatSpam"),
|
||||||
FAST_PLACE(Permission.CHECK_FASTPLACE),
|
COMMAND_SPAM(Permission.CHECK_COMMANDSPAM, "CommandSpam"),
|
||||||
CHAT_SPAM(Permission.CHECK_CHATSPAM),
|
SPRINT(Permission.CHECK_SPRINT, "Sprint"),
|
||||||
COMMAND_SPAM(Permission.CHECK_COMMANDSPAM),
|
SNEAK(Permission.CHECK_SNEAK, "Sneak"),
|
||||||
SPRINT(Permission.CHECK_SPRINT),
|
SPEED(Permission.CHECK_SPEED, "Speed"),
|
||||||
SNEAK(Permission.CHECK_SNEAK),
|
VCLIP(Permission.CHECK_VCLIP, "vClip"),
|
||||||
SPEED(Permission.CHECK_SPEED),
|
SPIDER(Permission.CHECK_SPIDER, "Spider"),
|
||||||
VCLIP(Permission.CHECK_VCLIP),
|
NOFALL(Permission.CHECK_NOFALL, "NoFall"),
|
||||||
SPIDER(Permission.CHECK_SPIDER),
|
FAST_BOW(Permission.CHECK_FASTBOW, "FastBow"),
|
||||||
NOFALL(Permission.CHECK_NOFALL),
|
FAST_EAT(Permission.CHECK_FASTEAT, "FastEat"),
|
||||||
FAST_BOW(Permission.CHECK_FASTBOW),
|
FAST_HEAL(Permission.CHECK_FASTHEAL, "FastHeal"),
|
||||||
FAST_EAT(Permission.CHECK_FASTEAT),
|
KILLAURA(Permission.CHECK_KILLAURA, "KillAura"),
|
||||||
FAST_HEAL(Permission.CHECK_FASTHEAL),
|
FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE, "FastProjectile"),
|
||||||
KILLAURA(Permission.CHECK_KILLAURA),
|
ITEM_SPAM(Permission.CHECK_ITEMSPAM, "ItemSpam"),
|
||||||
LONG_REACH(Permission.CHECK_LONGREACH),
|
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY, "FastInventory"),
|
||||||
FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE),
|
MOREPACKETS(Permission.CHECK_MOREPACKETS, "MorePackets"),
|
||||||
ITEM_SPAM(Permission.CHECK_ITEMSPAM),
|
BADPACKETS(Permission.CHECK_BADPACKETS, "BadPackets"),
|
||||||
FAST_INVENTORY(Permission.CHECK_FASTINVENTORY),
|
VELOCITY(Permission.CHECK_VELOCITY, "Velocity"),
|
||||||
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
CRITICALS(Permission.CHECK_CRITICALS, "Criticals"),
|
||||||
MOREPACKETS(Permission.CHECK_MOREPACKETS),
|
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
|
||||||
BADPACKETS(Permission.CHECK_BADPACKETS),
|
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
|
||||||
VELOCITY(Permission.CHECK_VELOCITY),
|
FASTLADDER(Permission.CHECK_FASTLADDER, "FastLadder"),
|
||||||
CRITICALS(Permission.CHECK_CRITICALS),
|
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot"),
|
||||||
CHAT_UNICODE(Permission.CHECK_UNICODE),
|
STRAFE(Permission.CHECK_STRAFE, "Strafe"),
|
||||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT),
|
NOSLOW(Permission.CHECK_NOSLOW, "NoSlow"),
|
||||||
FASTLADDER(Permission.CHECK_FASTLADDER),
|
BOATFLY(Permission.CHECK_BOATFLY, "BoatFly");
|
||||||
AIMBOT(Permission.CHECK_AIMBOT);
|
|
||||||
|
|
||||||
private final Permission permission;
|
private final Permission permission;
|
||||||
|
private final String displayName;
|
||||||
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
|
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a CheckType
|
* Initialize a CheckType
|
||||||
*
|
*
|
||||||
* @param perm Permission that applies to this check
|
* @param permission Permission that applies to this check
|
||||||
|
* @peram displayName The chat display name
|
||||||
*/
|
*/
|
||||||
private CheckType(Permission perm) {
|
private CheckType(Permission permission, String displayName) {
|
||||||
this.permission = perm;
|
this.permission = permission;
|
||||||
|
this.displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,23 +125,9 @@ public enum CheckType {
|
|||||||
/**
|
/**
|
||||||
* Get the reference name of a check
|
* Get the reference name of a check
|
||||||
*
|
*
|
||||||
* @param type Type of check
|
|
||||||
* @return reference name
|
* @return reference name
|
||||||
*/
|
*/
|
||||||
public static String getName(CheckType type) {
|
public String getName() {
|
||||||
if (type.name().contains("_")) {
|
return this.displayName;
|
||||||
String[] split = type.name().toLowerCase().split("_");
|
|
||||||
String name = "";
|
|
||||||
for (String part : split) {
|
|
||||||
char[] chars = part.toCharArray();
|
|
||||||
chars[0] = Character.toUpperCase(chars[0]);
|
|
||||||
name += new String(chars);
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
} else {
|
|
||||||
char[] chars = type.name().toLowerCase().toCharArray();
|
|
||||||
chars[0] = Character.toUpperCase(chars[0]);
|
|
||||||
return new String(chars);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,21 +31,22 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
|||||||
|
|
||||||
public class CriticalsCheck {
|
public class CriticalsCheck {
|
||||||
|
|
||||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player damager) {
|
public static void doDamageEvent(EntityDamageByEntityEvent event, Player damager) {
|
||||||
if (!(e.getDamager() instanceof Player) || e.getCause() != DamageCause.ENTITY_ATTACK)
|
if (!(event.getDamager() instanceof Player) || event.getCause() != DamageCause.ENTITY_ATTACK)
|
||||||
return;
|
return;
|
||||||
Player p = (Player) e.getDamager();
|
Player player = (Player) event.getDamager();
|
||||||
if (isCritical(p)) {
|
if (isCritical(player)) {
|
||||||
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0)
|
if ((player.getLocation().getY() % 1.0 == 0 || player.getLocation().getY() % 0.5 == 0)
|
||||||
&& p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
&& player.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||||
e.setCancelled(true);
|
event.setCancelled(true);
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||||
.getMessage(),
|
.getMessage(),
|
||||||
p, CheckType.CRITICALS);
|
player, CheckType.CRITICALS, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private static boolean isCritical(Player player) {
|
private static boolean isCritical(Player player) {
|
||||||
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
||||||
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@@ -31,16 +32,69 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class KillAuraCheck {
|
public class KillAuraCheck {
|
||||||
|
|
||||||
// Angle check
|
// Angle check
|
||||||
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> ANGLE_FLAGS = new HashMap<UUID, Integer>();
|
||||||
|
// PacketOrder check
|
||||||
|
public static final Map<UUID, Integer> PACKETORDER_FLAGS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult checkReach(Player player, Entity target) {
|
||||||
|
if (!(target instanceof LivingEntity))
|
||||||
|
return PASS;
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "reach"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
double allowedReach = target.getVelocity().length() < 0.08
|
||||||
|
? checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.normal")
|
||||||
|
: checksConfig.getDouble(CheckType.KILLAURA, "reach", "baseMaxValue.velocitized");
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
allowedReach += 1.5D;
|
||||||
|
// Lag compensation
|
||||||
|
double lagExtraReach = checksConfig.getDouble(CheckType.KILLAURA, "reach", "lagCompensation.lagExtraReach");
|
||||||
|
double pingCompensation = checksConfig.getDouble(CheckType.KILLAURA, "reach",
|
||||||
|
"lagCompensation.pingCompensation");
|
||||||
|
allowedReach += user.getPing() * pingCompensation;
|
||||||
|
if (user.isLagging())
|
||||||
|
allowedReach += lagExtraReach;
|
||||||
|
if (target instanceof Player) {
|
||||||
|
User targetUser = AntiCheatReloaded.getManager().getUserManager().getUser(target.getUniqueId());
|
||||||
|
allowedReach += targetUser.getPing() * pingCompensation;
|
||||||
|
if (targetUser.isLagging())
|
||||||
|
allowedReach += lagExtraReach;
|
||||||
|
}
|
||||||
|
// Velocity compensation
|
||||||
|
double velocityMultiplier = checksConfig.getDouble(CheckType.KILLAURA, "reach", "velocityMultiplier");
|
||||||
|
allowedReach += Math.abs(target.getVelocity().length()) * velocityMultiplier;
|
||||||
|
double reachedDistance = ((LivingEntity) target).getLocation().toVector()
|
||||||
|
.distance(player.getLocation().toVector());
|
||||||
|
if (reachedDistance > allowedReach)
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "Reach",
|
||||||
|
"reached too far (distance=" + Utilities.roundDouble(reachedDistance, 6) + ", max=" + Utilities.roundDouble(allowedReach, 6) + ")");
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
public static CheckResult checkAngle(Player player, EntityDamageEvent event) {
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "angle"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
LivingEntity living = (LivingEntity) entity;
|
LivingEntity living = (LivingEntity) entity;
|
||||||
Location eyeLocation = player.getEyeLocation();
|
Location eyeLocation = player.getEyeLocation();
|
||||||
@@ -49,21 +103,58 @@ public class KillAuraCheck {
|
|||||||
double playerYaw = player.getEyeLocation().getYaw();
|
double playerYaw = player.getEyeLocation().getYaw();
|
||||||
|
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
if (Math.round(angleDifference) > AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_DIFFERENCE()) {
|
int maxDifference = checksConfig.getInteger(CheckType.KILLAURA, "angle", "maxDifference");
|
||||||
|
if (Math.round(angleDifference) > maxDifference) {
|
||||||
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
if (!ANGLE_FLAGS.containsKey(uuid)) {
|
||||||
ANGLE_FLAGS.put(uuid, 1);
|
ANGLE_FLAGS.put(uuid, 1);
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int flags = ANGLE_FLAGS.get(uuid);
|
int flags = ANGLE_FLAGS.get(uuid);
|
||||||
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "angle", "vlBeforeFlag");
|
||||||
|
if (flags >= vlBeforeFlag) {
|
||||||
ANGLE_FLAGS.remove(uuid);
|
ANGLE_FLAGS.remove(uuid);
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "Angle",
|
||||||
|
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
ANGLE_FLAGS.put(uuid, flags + 1);
|
ANGLE_FLAGS.put(uuid, flags + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkPacketOrder(Player player, Entity entity) {
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
// Check if enabled
|
||||||
|
if (!checksConfig.isSubcheckEnabled(CheckType.KILLAURA, "packetOrder"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
if (user.isLagging() || (System.currentTimeMillis() - movementManager.lastTeleport) <= 100
|
||||||
|
|| AntiCheatReloaded.getPlugin().getTPS() < checksConfig.getDouble(CheckType.KILLAURA, "packetOrder", "minimumTps"))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
long elapsed = System.currentTimeMillis() - movementManager.lastUpdate;
|
||||||
|
if (elapsed < checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "minElapsedTime")) {
|
||||||
|
if (!PACKETORDER_FLAGS.containsKey(uuid)) {
|
||||||
|
PACKETORDER_FLAGS.put(uuid, 1);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int flags = PACKETORDER_FLAGS.get(uuid);
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "packetOrder", "vlBeforeFlag");
|
||||||
|
if (flags >= vlBeforeFlag) {
|
||||||
|
PACKETORDER_FLAGS.remove(uuid);
|
||||||
|
return new CheckResult(Result.FAILED, "PacketOrder", "suspicious packet order (elapsed=" + elapsed + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKETORDER_FLAGS.put(uuid, flags + 1);
|
||||||
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,4 +165,5 @@ public class KillAuraCheck {
|
|||||||
clonedFrom.setDirection(targetVector.subtract(startVector));
|
clonedFrom.setDirection(targetVector.subtract(startVector));
|
||||||
return clonedFrom.getYaw();
|
return clonedFrom.getYaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,61 +16,53 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.combat;
|
package com.rammelkast.anticheatreloaded.check.combat;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO improve
|
|
||||||
*/
|
|
||||||
public class VelocityCheck {
|
public class VelocityCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
return;
|
MovementManager movementManager = user.getMovementManager();
|
||||||
final Location then = player.getLocation();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
new BukkitRunnable() {
|
final int minimumPercentage = checksConfig.getInteger(CheckType.VELOCITY, "minimumPercentage");
|
||||||
@Override
|
final int vlBeforeFlag = checksConfig.getInteger(CheckType.VELOCITY, "vlBeforeFlag");
|
||||||
public void run() {
|
|
||||||
if (!player.isOnline())
|
if (movementManager.velocityExpectedMotionY > 0 && !movementManager.onGround) {
|
||||||
return;
|
double percentage = (movementManager.motionY / movementManager.velocityExpectedMotionY) * 100;
|
||||||
if (then.distance(player.getLocation()) < 0.125) {
|
if (percentage < 0)
|
||||||
if (!VIOLATIONS.containsKey(player.getUniqueId()))
|
percentage = 0;
|
||||||
VIOLATIONS.put(player.getUniqueId(), 1);
|
// Reset expected Y motion
|
||||||
else {
|
movementManager.velocityExpectedMotionY = 0;
|
||||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
if (percentage < minimumPercentage) {
|
||||||
if (VIOLATIONS.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
int vl = VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
||||||
.VELOCITY_MAX_FLAGS()) {
|
VIOLATIONS.put(player.getUniqueId(), vl);
|
||||||
EventListener.log(
|
if (vl >= vlBeforeFlag)
|
||||||
new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(Result.FAILED, "ignored server velocity (pct=" + Utilities.roundDouble(percentage, 2) + ")");
|
||||||
"had zero/low velocity " + VIOLATIONS.get(player.getUniqueId()) + " times (max="
|
|
||||||
+ AntiCheatReloaded.getManager().getBackend().getMagic()
|
|
||||||
.VELOCITY_MAX_FLAGS()
|
|
||||||
+ ", dist=" + then.distance(player.getLocation()) + ")").getMessage(),
|
|
||||||
player, CheckType.VELOCITY);
|
|
||||||
VIOLATIONS.remove(player.getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
VIOLATIONS.remove(player.getUniqueId());
|
VIOLATIONS.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
}
|
} else if (movementManager.airTicks > 5 && movementManager.velocityExpectedMotionY > 0)
|
||||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
movementManager.velocityExpectedMotionY = 0;
|
||||||
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -29,6 +28,8 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
|
||||||
public class AimbotCheck {
|
public class AimbotCheck {
|
||||||
|
|
||||||
@@ -37,9 +38,11 @@ public class AimbotCheck {
|
|||||||
|
|
||||||
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
public static CheckResult runCheck(Player player, PlayerMoveEvent event) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
if (backend.isMovingExempt(player)) {
|
if (backend.isMovingExempt(player)) {
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
float dYaw = Math.abs(event.getTo().getYaw() - event.getFrom().getYaw());
|
float dYaw = Math.abs(event.getTo().getYaw() - event.getFrom().getYaw());
|
||||||
float dPitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
float dPitch = Math.abs(event.getTo().getPitch() - event.getFrom().getPitch());
|
||||||
@@ -56,9 +59,10 @@ public class AimbotCheck {
|
|||||||
LAST_DELTA_YAW.put(uuid, dYaw);
|
LAST_DELTA_YAW.put(uuid, dYaw);
|
||||||
|
|
||||||
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
float absoluteYawDifference = Math.abs(dYaw - lastDeltaYaw);
|
||||||
if (absoluteYawDifference < 1E-8 && dYaw > 30 && dYaw < 355) {
|
int minYaw = checksConfig.getInteger(CheckType.AIMBOT, "minYaw");
|
||||||
|
int maxYaw = checksConfig.getInteger(CheckType.AIMBOT, "maxYaw");
|
||||||
|
if (absoluteYawDifference < 1E-8 && minYaw > 30 && dYaw < maxYaw)
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
return new CheckResult(CheckResult.Result.FAILED, "repeated yaw difference (dYaw=" + dYaw + ")");
|
||||||
}
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
public class BoatFlyCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(Player player, MovementManager movementManager, Location to) {
|
||||||
|
if (movementManager.distanceXZ <= 0 || movementManager.motionY <= 1E-3
|
||||||
|
|| (System.currentTimeMillis() - movementManager.lastTeleport <= 50) || VersionUtil.isFlying(player)
|
||||||
|
|| !player.isInsideVehicle())
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (player.getVehicle().getType() == EntityType.BOAT) {
|
||||||
|
Block bottom = player.getWorld().getBlockAt(to.getBlockX(), to.getBlockY() - 1, to.getBlockZ());
|
||||||
|
if (!Utilities.cantStandAt(bottom))
|
||||||
|
return PASS;
|
||||||
|
int violations = VIOLATIONS.getOrDefault(uuid, 1);
|
||||||
|
if (violations++ >= checksConfig.getInteger(CheckType.BOATFLY, "vlBeforeFlag")) {
|
||||||
|
violations = 0;
|
||||||
|
return new CheckResult(Result.FAILED, "tried to fly in a boat (mY=" + movementManager.motionY
|
||||||
|
+ ", bottom=" + bottom.getType().name().toLowerCase() + ")");
|
||||||
|
}
|
||||||
|
VIOLATIONS.put(uuid, violations);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
public class ElytraCheck {
|
public class ElytraCheck {
|
||||||
@@ -38,10 +39,9 @@ public class ElytraCheck {
|
|||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
// No elytra in server version
|
// No elytra in server version or not relevant
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (VersionUtil.isBountifulUpdate() || Utilities.isNearWater(player))
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import org.bukkit.entity.Player;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
|
||||||
public class FastLadderCheck {
|
public class FastLadderCheck {
|
||||||
@@ -37,7 +38,6 @@ public class FastLadderCheck {
|
|||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, double y) {
|
public static CheckResult runCheck(Player player, double y) {
|
||||||
Magic magic = AntiCheatReloaded.getManager().getBackend().getMagic();
|
|
||||||
// Only check if fully on ladder
|
// Only check if fully on ladder
|
||||||
// Liquids are climbable blocks, so we have to add a seperate check
|
// Liquids are climbable blocks, so we have to add a seperate check
|
||||||
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
if (!Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
@@ -47,12 +47,14 @@ public class FastLadderCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int vlCount = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
int vlCount = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.FASTLADDER, "vlBeforeFlag");
|
||||||
if (y > 0) {
|
if (y > 0) {
|
||||||
// Check moving up
|
// Check moving up
|
||||||
double max = magic.LADDER_Y_MAX();
|
double max = checksConfig.getDouble(CheckType.FASTLADDER, "speedUpMax");
|
||||||
// Check if going faster than max Y climbing speed
|
// Check if going faster than max Y climbing speed
|
||||||
if (y - max > 0) {
|
if (y - max > 0) {
|
||||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
if (vlCount++ > vlBeforeFlag) {
|
||||||
vlCount = 0;
|
vlCount = 0;
|
||||||
return new CheckResult(Result.FAILED,
|
return new CheckResult(Result.FAILED,
|
||||||
"tried to climb up too fast (speed=" + y + ", max=" + max + ")");
|
"tried to climb up too fast (speed=" + y + ", max=" + max + ")");
|
||||||
@@ -63,11 +65,12 @@ public class FastLadderCheck {
|
|||||||
}
|
}
|
||||||
} else if (y < 0) {
|
} else if (y < 0) {
|
||||||
// Check moving down
|
// Check moving down
|
||||||
if (Math.abs(y) > magic.LADDER_DOWN_MAX() + 6E-9) {
|
double max = checksConfig.getDouble(CheckType.FASTLADDER, "speedDownMax");
|
||||||
if (vlCount++ > magic.FASTLADDER_MAX_FLAGS()) {
|
if (Math.abs(y) > max + 6E-9) {
|
||||||
|
if (vlCount++ > vlBeforeFlag) {
|
||||||
vlCount = 0;
|
vlCount = 0;
|
||||||
return new CheckResult(Result.FAILED, "tried to climb down too fast (speed=" + Math.abs(y)
|
return new CheckResult(Result.FAILED, "tried to climb down too fast (speed=" + Math.abs(y)
|
||||||
+ ", max=" + magic.LADDER_DOWN_MAX() + ")");
|
+ ", max=" + max + ")");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (vlCount > 0)
|
if (vlCount > 0)
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@@ -31,120 +29,151 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rammelkast TODO rewrite this check
|
* @author Rammelkast
|
||||||
*/
|
*/
|
||||||
public class FlightCheck {
|
public class FlightCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Double> BLOCKS_OVER_FLIGHT = new HashMap<UUID, Double>();
|
|
||||||
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
|
||||||
public static final Map<UUID, Integer> ASCENSION_COUNT = new HashMap<UUID, Integer>();
|
public static final Map<UUID, Integer> GRAVITY_VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
private static final double GRAVITY_FRICTION = 0.9800000190734863D;
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|| VersionUtil.isFlying(player)) {
|
|| VersionUtil.isFlying(player) || player.getVehicle() != null
|
||||||
// This was a teleport or user is flying/using elytra, so we don't care
|
|| AntiCheatReloaded.getManager().getBackend().isMovingExempt(player)) {
|
||||||
|
// This was a teleport or user is flying/using elytra/in a vehicle, so we don't
|
||||||
|
// care
|
||||||
// about it.
|
// about it.
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
final UUID uuid = player.getUniqueId();
|
|
||||||
final double y1 = distance.fromY();
|
|
||||||
final double y2 = distance.toY();
|
|
||||||
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
|
||||||
&& Utilities.cantStandAtExp(player.getLocation())
|
|
||||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
|
||||||
new Material[] { Utilities.IRON_BARS })
|
|
||||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
|
||||||
new String[] { "FENCE", "FENCE_GATE" })
|
|
||||||
&& !Utilities.couldBeOnBoat(player)) {
|
|
||||||
if (!BLOCKS_OVER_FLIGHT.containsKey(uuid)) {
|
|
||||||
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
|
||||||
}
|
|
||||||
|
|
||||||
BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) + distance.getXDifference()
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
+ distance.getYDifference() + distance.getZDifference()));
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
|
||||||
if (y1 > y2) {
|
|
||||||
BLOCKS_OVER_FLIGHT.put(uuid, (BLOCKS_OVER_FLIGHT.get(uuid) - distance.getYDifference()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (BLOCKS_OVER_FLIGHT.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
|
||||||
.FLIGHT_BLOCK_LIMIT() && (y1 <= y2)) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
|
|
||||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
BLOCKS_OVER_FLIGHT.put(uuid, 0D);
|
|
||||||
}
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CheckResult checkAscension(Player player, double y1, double y2) {
|
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
int max = backend.getMagic().ASCENSION_COUNT_MAX();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
String string = "";
|
|
||||||
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
|
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player))
|
||||||
max += 12;
|
|
||||||
string = " with jump potion";
|
|
||||||
}
|
|
||||||
Block block = player.getLocation().getBlock();
|
|
||||||
if (!isMovingExempt(player) && !Utilities.isNearWater(player) && !VersionUtil.isFlying(player)
|
|
||||||
&& !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
|
||||||
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
|
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
|
|
||||||
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
|
|
||||||
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
|
|
||||||
// TODO isMoveUpBlock does not seem to be a success with stairs
|
|
||||||
// I suddenly could not replicate this, man this check is a mess
|
|
||||||
if (y1 < y2) {
|
|
||||||
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
|
|
||||||
&& !block.getRelative(BlockFace.EAST).isLiquid()
|
|
||||||
&& !block.getRelative(BlockFace.WEST).isLiquid()) {
|
|
||||||
backend.increment(player, ASCENSION_COUNT, max);
|
|
||||||
if (ASCENSION_COUNT.get(player.getUniqueId()) >= max) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"ascended " + ASCENSION_COUNT.get(player.getUniqueId()) + " times in a row (max = " + max
|
|
||||||
+ string + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ASCENSION_COUNT.put(player.getUniqueId(), 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isMovingExempt(Player player) {
|
int minAirTicks = 13;
|
||||||
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
|
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||||
}
|
minAirTicks += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 3;
|
||||||
|
|
||||||
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
|
if (movementManager.halfMovementHistoryCounter > 25)
|
||||||
if (map.containsKey(player.getUniqueId())) {
|
minAirTicks += 5;
|
||||||
if (max != -1) {
|
|
||||||
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
|
// Start AirFlight
|
||||||
map.remove(player.getUniqueId());
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
|
||||||
return false;
|
&& !backend.justVelocity(player) && movementManager.elytraEffectTicks <= 25) {
|
||||||
} else {
|
// Config default base is 1200ms
|
||||||
return true;
|
// Ping clamped to max. 1000 to prevent spoofing for an advantage
|
||||||
|
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
|
"accountForBlockPlacement") + (0.25 * (user.getPing() > 1000 ? 1000 : user.getPing())));
|
||||||
|
// Config default account is 250ms
|
||||||
|
if (AntiCheatReloaded.getPlugin().getTPS() < 18.0)
|
||||||
|
blockPlaceAccountingTime += checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
|
||||||
|
"accountForTpsDrops");
|
||||||
|
long lastPlacedBlock = AntiCheatReloaded.getManager().getBackend().placedBlock
|
||||||
|
.containsKey(player.getUniqueId())
|
||||||
|
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||||
|
: (blockPlaceAccountingTime + 1);
|
||||||
|
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
||||||
|
// Fixes snow false positive
|
||||||
|
if (movementManager.motionY < 0.004 && Utilities
|
||||||
|
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
|
||||||
|
maxMotionY = 0.004D;
|
||||||
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0
|
||||||
|
&& !Utilities.isNearClimbable(distance.getTo().clone().subtract(0, 1.25, 0)))
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirFlight",
|
||||||
|
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||||
|
|
||||||
|
if (Math.abs(movementManager.motionY - movementManager.lastMotionY) < 0.01
|
||||||
|
&& !Utilities.couldBeOnBoat(player)
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airFlight", "accountForTeleports"))
|
||||||
|
&& !VersionUtil.isSlowFalling(player) && !Utilities.isNearWeb(player)
|
||||||
|
&& movementManager.elytraEffectTicks <= 25)
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirFlight", "had too little Y dropoff (diff="
|
||||||
|
+ Math.abs(movementManager.motionY - movementManager.lastMotionY) + ")");
|
||||||
}
|
}
|
||||||
|
// End AirFlight
|
||||||
|
|
||||||
|
// Start AirClimb
|
||||||
|
// TODO three hardcoded values here shouldn't be there, temp against false
|
||||||
|
// positive
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.lastMotionY > 0
|
||||||
|
&& movementManager.motionY > 0 && movementManager.airTicks == 2
|
||||||
|
&& Math.round(movementManager.lastMotionY * 1000) != 420
|
||||||
|
&& Math.round(movementManager.motionY * 1000) != 248
|
||||||
|
&& !(Math.round(movementManager.motionY * 1000) == 333
|
||||||
|
&& Math.round(movementManager.lastMotionY * 1000) != 333)
|
||||||
|
&& !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
|
&& (!Utilities.isNearBed(distance.getTo())
|
||||||
|
|| (Utilities.isNearBed(distance.getTo()) && movementManager.motionY > 0.12675))
|
||||||
|
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25)
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||||
|
|
||||||
|
// TODO hardcoded value against false again..
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||||
|
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
|
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports"))
|
||||||
|
&& movementManager.slimeInfluenceTicks == 0 && movementManager.elytraEffectTicks <= 25) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirClimb",
|
||||||
|
"tried to climb air (mY=" + movementManager.motionY + ", at=" + movementManager.airTicks + ")");
|
||||||
|
}
|
||||||
|
// End AirClimb
|
||||||
|
|
||||||
|
// Start GroundFlight
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "groundFlight") && movementManager.onGround
|
||||||
|
&& Utilities.cantStandAt(distance.getTo().getBlock().getRelative(BlockFace.DOWN))
|
||||||
|
&& Utilities.cantStandAt(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|
||||||
|
&& Utilities.cantStandAt(distance.getTo().getBlock())) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "GroundFlight",
|
||||||
|
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
|
||||||
|
}
|
||||||
|
// End GroundFlight
|
||||||
|
|
||||||
|
// Start Gravity
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "gravity") && !movementManager.onGround
|
||||||
|
&& movementManager.motionY < 0 && !backend.justVelocity(player)
|
||||||
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
|
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
|
||||||
|
&& !Utilities.isNearWeb(player) && movementManager.elytraEffectTicks <= 25
|
||||||
|
&& !VersionUtil.isSlowFalling(player)) {
|
||||||
|
double gravitatedY = (movementManager.lastMotionY - 0.08) * GRAVITY_FRICTION;
|
||||||
|
double offset = Math.abs(gravitatedY - movementManager.motionY);
|
||||||
|
double maxOffset = checksConfig.getDouble(CheckType.FLIGHT, "gravity", "maxOffset");
|
||||||
|
if (offset > maxOffset && movementManager.airTicks > 2) {
|
||||||
|
int vl = GRAVITY_VIOLATIONS.getOrDefault(player.getUniqueId(), 0) + 1;
|
||||||
|
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
|
||||||
|
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
|
||||||
|
if (vl >= vlBeforeFlag)
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "Gravity",
|
||||||
|
"ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
|
||||||
} else {
|
} else {
|
||||||
// Termination time has already been calculated
|
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
|
||||||
if (map.get(player.getUniqueId()) < System.currentTimeMillis()) {
|
|
||||||
map.remove(player.getUniqueId());
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
// End Gravity
|
||||||
return false;
|
|
||||||
}
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
public class GlideCheck {
|
|
||||||
|
|
||||||
public static final Map<UUID, Double> LAST_MOTION_Y = new HashMap<UUID, Double>();
|
|
||||||
public static final Map<UUID, Float> LAST_FALL_DISTANCE = new HashMap<UUID, Float>();
|
|
||||||
public static final Map<UUID, Integer> AIR_TICKS = new HashMap<UUID, Integer>();
|
|
||||||
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
|
||||||
|| VersionUtil.isFlying(player) || FlightCheck.isMovingExempt(player)) {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), 0);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getLocation().getBlock().getType() == Material.LADDER
|
|
||||||
|| player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LAST_MOTION_Y.containsKey(player.getUniqueId())) {
|
|
||||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LAST_FALL_DISTANCE.containsKey(player.getUniqueId())) {
|
|
||||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int violations = VIOLATIONS.getOrDefault(player.getUniqueId(), 0);
|
|
||||||
double motionY = distance.getYDifference();
|
|
||||||
float fallDistance = player.getFallDistance();
|
|
||||||
if (motionY == LAST_MOTION_Y.get(player.getUniqueId())
|
|
||||||
&& fallDistance > LAST_FALL_DISTANCE.get(player.getUniqueId())) {
|
|
||||||
if (violations + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), 0);
|
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
|
||||||
Location prev = player.getLocation().clone();
|
|
||||||
prev.setY(prev.getY() - distanceToFall(prev));
|
|
||||||
player.teleport(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
|
||||||
.getGoodLocation(prev));
|
|
||||||
}
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"type=glide, desc_amount=" + new BigDecimal(motionY).setScale(2, RoundingMode.HALF_UP) + ")");
|
|
||||||
} else {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), violations + 1);
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// TODO redo this
|
|
||||||
}
|
|
||||||
LAST_MOTION_Y.put(player.getUniqueId(), distance.getYDifference());
|
|
||||||
LAST_FALL_DISTANCE.put(player.getUniqueId(), player.getFallDistance());
|
|
||||||
if (violations > Math.round(AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT() / 2)) {
|
|
||||||
VIOLATIONS.put(player.getUniqueId(), violations - 1);
|
|
||||||
}
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double distanceToFall(Location location) {
|
|
||||||
location = location.clone();
|
|
||||||
double highestY = location.getWorld().getHighestBlockYAt(location) + 1.02D;
|
|
||||||
return location.getY() - highestY;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
|
public class NoSlowCheck {
|
||||||
|
|
||||||
|
public static final Map<UUID, Long> LAST_RELEASE = new HashMap<UUID, Long>();
|
||||||
|
public static final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
|
||||||
|
|
||||||
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.NOSLOW))
|
||||||
|
return;
|
||||||
|
UUID uuid = player.getUniqueId();
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
final long time = System.currentTimeMillis();
|
||||||
|
final long lastRelease = LAST_RELEASE.getOrDefault(uuid, 0L);
|
||||||
|
LAST_RELEASE.put(uuid, time);
|
||||||
|
if (lastRelease == 0L)
|
||||||
|
return;
|
||||||
|
|
||||||
|
long difference = time - lastRelease;
|
||||||
|
long minimumDifference = checksConfig.getInteger(CheckType.NOSLOW, "minimumDifference");
|
||||||
|
if (difference < minimumDifference
|
||||||
|
&& movementManager.distanceXZ >= checksConfig.getDouble(CheckType.NOSLOW, "minimumDistXZ")) {
|
||||||
|
int violations = VIOLATIONS.getOrDefault(uuid, 1);
|
||||||
|
if (violations++ >= checksConfig.getInteger(CheckType.NOSLOW, "vlBeforeFlag")) {
|
||||||
|
violations = 0;
|
||||||
|
flag(player, event,
|
||||||
|
"toggled use item too fast (diff=" + difference + ", min=" + minimumDifference + ")");
|
||||||
|
}
|
||||||
|
VIOLATIONS.put(uuid, violations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void flag(Player player, PacketEvent event, String message) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
// We are currently not in the main server thread, so switch
|
||||||
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
|
CheckType.NOSLOW, null);
|
||||||
|
player.teleport(player.getLocation());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,11 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import org.bukkit.Location;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@@ -30,107 +26,263 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This check is an outdated mess which needs to be replaced
|
* @author Rammelkast TODO soulsand speed
|
||||||
*/
|
*/
|
||||||
public class SpeedCheck {
|
public class SpeedCheck {
|
||||||
|
|
||||||
public static final Map<UUID, Integer> SPEED_VIOLATIONS = new HashMap<UUID, Integer>();
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static boolean isSpeedExempt(Player player, Backend backend) {
|
public static boolean isSpeedExempt(Player player, Backend backend) {
|
||||||
return backend.isMovingExempt(player) || backend.justVelocity(player) || VersionUtil.isFlying(player);
|
return backend.isMovingExempt(player) || backend.justVelocity(player) || VersionUtil.isFlying(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkXZSpeed(Player player, double x, double z) {
|
public static CheckResult checkXZSpeed(Player player, double x, double z, Location movingTowards) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
if (!isSpeedExempt(player, backend) && player.getVehicle() == null) {
|
if (isSpeedExempt(player, backend) || player.getVehicle() != null || Utilities.isInWater(player))
|
||||||
String reason = "";
|
return PASS;
|
||||||
double max = backend.getMagic().XZ_SPEED_MAX();
|
|
||||||
if (player.getLocation().getBlock().getType() == Material.SOUL_SAND) {
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
if (player.isSprinting()) {
|
.getMovementManager();
|
||||||
reason = "on soulsand while sprinting ";
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND_SPRINT();
|
double distanceXZ = movementManager.distanceXZ;
|
||||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
|
||||||
reason = "on soulsand with speed potion ";
|
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND_POTION();
|
// AirSpeed
|
||||||
} else {
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1
|
||||||
reason = "on soulsand ";
|
&& movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_SOULSAND();
|
double multiplier = 0.985D;
|
||||||
|
double predict = 0.36 * Math.pow(multiplier, movementManager.airTicks + 1);
|
||||||
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "baseLimit"); // Default 0.03125
|
||||||
|
// Adjust for ice
|
||||||
|
if (movementManager.iceInfluenceTicks > 0) {
|
||||||
|
double iceIncrement = 0.025 * Math.pow(1.038, movementManager.iceInfluenceTicks);
|
||||||
|
// Clamp to max value
|
||||||
|
if (iceIncrement > 0.18D)
|
||||||
|
iceIncrement = 0.18D;
|
||||||
|
if (boxedIn)
|
||||||
|
iceIncrement += 0.45D;
|
||||||
|
if (!Utilities.couldBeOnIce(movingTowards))
|
||||||
|
iceIncrement *= 2.5D;
|
||||||
|
predict += iceIncrement;
|
||||||
}
|
}
|
||||||
} else if (VersionUtil.isFlying(player)) {
|
// Leniency when boxed in
|
||||||
reason = "while flying ";
|
if (boxedIn && movementManager.airTicks < 3)
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_FLY();
|
predict *= 1.2D;
|
||||||
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
|
// Adjust for slime
|
||||||
if (player.isSprinting()) {
|
if (movementManager.slimeInfluenceTicks > 0) {
|
||||||
reason = "with speed potion while sprinting ";
|
double slimeIncrement = 0.022 * Math.pow(1.0375, movementManager.slimeInfluenceTicks);
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_POTION_SPRINT();
|
// Clamp to max value
|
||||||
} else {
|
if (slimeIncrement > 0.12D)
|
||||||
reason = "with speed potion ";
|
slimeIncrement = 0.12D;
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_POTION();
|
predict += slimeIncrement;
|
||||||
}
|
}
|
||||||
} else if (player.isSprinting()) {
|
// Adjust for speed effects
|
||||||
String blockDownName = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType().name();
|
if (movementManager.hasSpeedEffect)
|
||||||
if (blockDownName.endsWith("ICE")
|
predict += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
|
||||||
&& (player.getEyeLocation().getBlock().getRelative(BlockFace.UP).getType() != Material.AIR)) {
|
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect)
|
||||||
if (player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")) {
|
limit *= 1.2D;
|
||||||
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ")
|
// Adjust for jump boost effects
|
||||||
+ " and trapdoor";
|
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_SPRINT()
|
predict += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D;
|
||||||
+ (blockDownName.equals("BLUE_ICE") ? 0.35925D : 0.35D);
|
// Adjust for custom walking speed
|
||||||
} else {
|
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default
|
||||||
reason = "while boosting on " + blockDownName.toLowerCase().replaceAll("_", " ") + " ";
|
// 1.4
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_SPRINT()
|
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||||
+ (blockDownName.equals("BLUE_ICE") ? 0.20925D : 0.2D);
|
// Slabs sometimes allow for a slight boost after jump
|
||||||
}
|
if (movementManager.halfMovementHistoryCounter > 0)
|
||||||
} else {
|
predict *= 2.125D;
|
||||||
reason = "while sprinting ";
|
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
|
||||||
max = backend.getMagic().XZ_SPEED_MAX_SPRINT();
|
predict *= 1.25D;
|
||||||
|
// Boats sometimes give a false positive
|
||||||
|
if (Utilities.couldBeOnBoat(player, 0.5, true))
|
||||||
|
predict *= 1.25D;
|
||||||
|
// Strafing in air when nearing terminal velocity gives false positives
|
||||||
|
// This fixes the issue but gives hackers some leniency which means we need
|
||||||
|
// another check for this
|
||||||
|
double deltaMotionY = movementManager.motionY - movementManager.lastMotionY;
|
||||||
|
if ((deltaMotionY < 0 && deltaMotionY >= -0.08) || movementManager.airTicks >= 40
|
||||||
|
&& (movingTowards.getBlockY() - player.getWorld().getHighestBlockYAt(movingTowards)) <= 1.5)
|
||||||
|
predict *= (movementManager.airTicks > 60 ? 4.0D : (movementManager.airTicks > 30 ? 3.0D : 2.0D));
|
||||||
|
// Players can move faster in air with slow falling
|
||||||
|
if (VersionUtil.isSlowFalling(player))
|
||||||
|
predict *= 1.25D;
|
||||||
|
// Prevent NoSlow
|
||||||
|
if (movementManager.blockingTicks > 3 && movementManager.airTicks > 2)
|
||||||
|
predict *= 0.8D;
|
||||||
|
if (movementManager.blockingTicks > 10 && movementManager.airTicks > 2)
|
||||||
|
predict *= 0.5D;
|
||||||
|
// Fixes false positive when coming out of water
|
||||||
|
if (movementManager.nearLiquidTicks >= 7 && movementManager.airTicks >= 14
|
||||||
|
&& movementManager.motionY < -0.18 && movementManager.motionY > -0.182)
|
||||||
|
predict += Math.abs(movementManager.motionY);
|
||||||
|
|
||||||
|
if (distanceXZ - predict > limit) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
|
||||||
|
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ", block="
|
||||||
|
+ movementManager.blockingTicks + ", box=" + boxedIn + ", at="
|
||||||
|
+ movementManager.airTicks + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float speed = player.getWalkSpeed();
|
// AirAcceleration
|
||||||
max += speed > 0 ? player.getWalkSpeed() - 0.2f : 0;
|
// As of right now, this falses sometimes, dont know why
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airAcceleration") && movementManager.airTicks > 1
|
||||||
if (x > max || z > max) {
|
&& movementManager.iceInfluenceTicks <= 0 && movementManager.slimeInfluenceTicks <= 0
|
||||||
int num = backend.increment(player, SPEED_VIOLATIONS, backend.getMagic().SPEED_MAX());
|
&& movementManager.elytraEffectTicks <= 0) {
|
||||||
if (num >= backend.getMagic().SPEED_MAX()) {
|
double initialAcceleration = movementManager.acceleration;
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
||||||
"speed was too high " + reason + num + " times in a row (max="
|
// Slight increase when boxed in
|
||||||
+ backend.getMagic().SPEED_MAX() + ", speed=" + (x > z ? x : z) + ", max speed="
|
if (boxedIn)
|
||||||
+ max + ")");
|
limit *= 1.08D;
|
||||||
} else {
|
// Adjust for speed effects
|
||||||
return PASS;
|
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||||
}
|
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
|
||||||
} else {
|
// Adjust for slabs
|
||||||
SPEED_VIOLATIONS.put(player.getUniqueId(), 0);
|
if (movementManager.halfMovementHistoryCounter > 15)
|
||||||
return PASS;
|
limit *= 2.0D;
|
||||||
}
|
// Adjust for custom walking speed
|
||||||
} else {
|
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration",
|
||||||
return PASS;
|
"walkSpeedMultiplier"); // Default 1.4
|
||||||
|
limit += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
|
||||||
|
// Boats sometimes give a false positive
|
||||||
|
if (Utilities.couldBeOnBoat(player))
|
||||||
|
limit *= 1.25D;
|
||||||
|
if (initialAcceleration > limit) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
|
||||||
|
"exceeded acceleration limits (acceleration=" + initialAcceleration + ", max=" + limit + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CheckResult checkYSpeed(Player player, Distance distance) {
|
// JumpBehaviour
|
||||||
|
// Works against YPorts and mini jumps
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "jumpBehaviour") && movementManager.touchedGroundThisTick
|
||||||
|
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10) {
|
||||||
|
// This happens naturally
|
||||||
|
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
|
||||||
|
double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default
|
||||||
|
|
||||||
|
if (distanceXZ >= minimumDistXZ || movementManager.lastDistanceXZ >= minimumDistXZ) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "JumpBehaviour",
|
||||||
|
"had unexpected jumping behaviour (dXZ=" + Utilities.roundDouble(distanceXZ, 4) + ", lXZ="
|
||||||
|
+ Utilities.roundDouble(movementManager.lastDistanceXZ, 4) + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroundSpeed
|
||||||
|
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "groundSpeed") && movementManager.groundTicks > 1) {
|
||||||
|
double initialLimit = checksConfig.getDouble(CheckType.SPEED, "groundSpeed", "initialLimit"); // Default
|
||||||
|
// 0.34
|
||||||
|
double limit = initialLimit - 0.0055 * Math.min(9, movementManager.groundTicks);
|
||||||
|
// Leniency when moving back on ground
|
||||||
|
if (movementManager.groundTicks < 5)
|
||||||
|
limit += 0.1D;
|
||||||
|
// Slab leniency
|
||||||
|
if (movementManager.halfMovementHistoryCounter > 8)
|
||||||
|
limit += 0.2D;
|
||||||
|
// LivingEntities can give players a small push boost
|
||||||
|
if (!movingTowards.getWorld().getNearbyEntities(movingTowards, 0.3, 0.3, 0.3).isEmpty())
|
||||||
|
limit += 0.2D;
|
||||||
|
// Leniency when boxed in
|
||||||
|
if (boxedIn)
|
||||||
|
limit *= 1.1D;
|
||||||
|
// Adjust for speed effects
|
||||||
|
if (movementManager.hasSpeedEffect)
|
||||||
|
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.06D;
|
||||||
|
if (movementManager.hasSpeedEffect && movementManager.groundTicks > 3)
|
||||||
|
limit *= 1.4D;
|
||||||
|
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect)
|
||||||
|
limit *= 1.2D;
|
||||||
|
if (movementManager.iceInfluenceTicks >= 50) {
|
||||||
|
// When moving off ice
|
||||||
|
if (!Utilities.couldBeOnIce(movingTowards))
|
||||||
|
limit *= 2.5D;
|
||||||
|
else {
|
||||||
|
// When boxed in and spamming space for boost
|
||||||
|
if (movementManager.topSolid && movementManager.bottomSolid)
|
||||||
|
limit *= 3.0D;
|
||||||
|
else
|
||||||
|
limit *= 1.25D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Increased speed when stepping on/off half blocks
|
||||||
|
if (Utilities.isNearBed(movingTowards) || Utilities.couldBeOnHalfblock(movingTowards)
|
||||||
|
|| Utilities.isNearBed(movingTowards.clone().add(0, -0.5, 0)))
|
||||||
|
limit *= 2.0D;
|
||||||
|
// Increased speed when stepping on/off boat
|
||||||
|
if (Utilities.couldBeOnBoat(player))
|
||||||
|
limit += 0.2D;
|
||||||
|
// Adjust for custom walk speed
|
||||||
|
limit += (player.getWalkSpeed() - 0.2) * 2.0D;
|
||||||
|
// Prevent NoSlow
|
||||||
|
if (player.isBlocking() && movementManager.groundTicks > 2)
|
||||||
|
limit *= 0.45D;
|
||||||
|
// Prevent NoWeb
|
||||||
|
// TODO config
|
||||||
|
if (Utilities.isInWeb(player))
|
||||||
|
limit *= 0.65D;
|
||||||
|
// Sneak speed check
|
||||||
|
// TODO config
|
||||||
|
if (movementManager.sneakingTicks > 1)
|
||||||
|
limit *= 0.68D;
|
||||||
|
|
||||||
|
if (distanceXZ - limit > 0) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "GroundSpeed",
|
||||||
|
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking="
|
||||||
|
+ player.isBlocking() + ", gt=" + movementManager.groundTicks + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkVerticalSpeed(Player player, Distance distance) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
if (!backend.isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping()
|
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|
||||||
&& (distance.getYDifference() > backend.getMagic().Y_SPEED_MAX())
|
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
|
||||||
&& !backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_TIME())
|
return PASS;
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
&& !VersionUtil.isRiptiding(player)
|
.getMovementManager();
|
||||||
&& !Utilities.isNearBed(distance.getTo())
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
&& !Utilities.isSlime(AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
|
||||||
.getGoodLocation(player.getLocation()).getBlock())
|
return PASS;
|
||||||
&& !Utilities.couldBeOnBoat(player)) {
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
|
||||||
"y speed was too high (speed=" + distance.getYDifference() + ", max=" + backend.getMagic().Y_SPEED_MAX() + ")");
|
Utilities.couldBeOnBoat(player),
|
||||||
} else {
|
Utilities.isClimbableBlock(distance.getFrom().getBlock())
|
||||||
|
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)),
|
||||||
|
movementManager.halfMovement, checksConfig);
|
||||||
|
// Fix false positive with soulsand boost
|
||||||
|
if (movementManager.nearLiquidTicks > 6)
|
||||||
|
maxMotionY *= 1.0525D;
|
||||||
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "VerticalSpeed",
|
||||||
|
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||||
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat,
|
||||||
|
boolean fromClimbable, boolean halfMovement, Checks checksConfig) {
|
||||||
|
// TODO config for these values
|
||||||
|
// TODO something funky vanilla stuff going on with 0.42, like 0.445.., check
|
||||||
|
// this..
|
||||||
|
double base = couldBeOnBoat ? 0.600000025
|
||||||
|
: (nearBed ? 0.5625 : ((halfMovement || VersionUtil.isBountifulUpdate()) ? 0.6 : 0.42));
|
||||||
|
if (fromClimbable)
|
||||||
|
base += checksConfig.getDouble(CheckType.SPEED, "verticalSpeed", "climbableCompensation"); // Default 0.04
|
||||||
|
|
||||||
|
if (player.hasPotionEffect(PotionEffectType.JUMP))
|
||||||
|
base += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.2D;
|
||||||
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rammelkast
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class StrafeCheck {
|
||||||
|
|
||||||
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
|
public static CheckResult runCheck(Player player, double x, double z, Location from, Location to) {
|
||||||
|
if (!Utilities.cantStandAtExp(from) || !Utilities.cantStandAtExp(to) || Utilities.isNearWater(player)
|
||||||
|
|| Utilities.isNearClimbable(player) || VersionUtil.isFlying(player) || player.isDead()
|
||||||
|
|| Utilities.isHalfblock(to.getBlock().getRelative(BlockFace.DOWN)))
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
|
.getMovementManager();
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - movementManager.lastTeleport <= checksConfig.getInteger(CheckType.STRAFE,
|
||||||
|
"accountForTeleports") || movementManager.elytraEffectTicks >= 20
|
||||||
|
|| movementManager.halfMovementHistoryCounter >= 20)
|
||||||
|
return PASS;
|
||||||
|
|
||||||
|
Vector oldAcceleration = new Vector(movementManager.lastDistanceX, 0, movementManager.lastDistanceZ);
|
||||||
|
Vector newAcceleration = new Vector(x, 0, z);
|
||||||
|
|
||||||
|
float angle = newAcceleration.angle(oldAcceleration);
|
||||||
|
double distance = newAcceleration.lengthSquared();
|
||||||
|
if (angle > checksConfig.getDouble(CheckType.STRAFE, "maxAngleChange")
|
||||||
|
&& distance > checksConfig.getDouble(CheckType.STRAFE, "minActivationDistance")
|
||||||
|
&& Utilities.cantStandFar(to.getBlock()))
|
||||||
|
return new CheckResult(Result.FAILED, "switched angle in air (angle=" + angle + ", dist=" + distance + ")");
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,105 +16,68 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
package com.rammelkast.anticheatreloaded.check.movement;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckResult.Result;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
|
||||||
* This check should be replaced It works, but not great
|
|
||||||
*/
|
|
||||||
public class WaterWalkCheck {
|
public class WaterWalkCheck {
|
||||||
|
|
||||||
public static final List<UUID> IS_IN_WATER = new ArrayList<UUID>();
|
|
||||||
public static final List<UUID> IS_IN_WATER_CACHE = new ArrayList<UUID>();
|
|
||||||
public static final Map<UUID, Integer> WATER_SPEED_VIOLATIONS = new HashMap<UUID, Integer>();
|
|
||||||
public static final Map<UUID, Integer> WATER_ASCENSION_VIOLATIONS = new HashMap<UUID, Integer>();
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
public static CheckResult runCheck(Player player, double x, double y, double z) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
|
||||||
Block block = player.getLocation().getBlock();
|
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
|
||||||
if (player.getVehicle() == null && !player.isFlying() && !VersionUtil.isFrostWalk(player)) {
|
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player)
|
||||||
if (block.isLiquid()) {
|
|| VersionUtil.isRiptiding(player) || VersionUtil.isSwimming(player) || VersionUtil.isFlying(player))
|
||||||
if (IS_IN_WATER.contains(uuid)) {
|
|
||||||
if (IS_IN_WATER_CACHE.contains(uuid)) {
|
|
||||||
if (player.getNearbyEntities(1, 1, 1).isEmpty()) {
|
|
||||||
boolean violation;
|
|
||||||
if (!Utilities.sprintFly(player)) {
|
|
||||||
violation = x > backend.getMagic().XZ_SPEED_MAX_WATER()
|
|
||||||
|| z > backend.getMagic().XZ_SPEED_MAX_WATER();
|
|
||||||
} else {
|
|
||||||
violation = x > backend.getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
|
||||||
|| z > backend.getMagic().XZ_SPEED_MAX_WATER_SPRINT();
|
|
||||||
}
|
|
||||||
if (!violation && !Utilities.isFullyInWater(player.getLocation())
|
|
||||||
&& Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D
|
|
||||||
&& !block.getType().equals(Utilities.LILY_PAD)) {
|
|
||||||
violation = true;
|
|
||||||
}
|
|
||||||
if (violation) {
|
|
||||||
if (WATER_SPEED_VIOLATIONS.containsKey(uuid)) {
|
|
||||||
int v = WATER_SPEED_VIOLATIONS.get(uuid);
|
|
||||||
if (v >= backend.getMagic().WATER_SPEED_VIOLATION_MAX()) {
|
|
||||||
WATER_SPEED_VIOLATIONS.put(uuid, 0);
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"stood on water " + v + " times (can't stand on " + block.getType()
|
|
||||||
+ " or " + block.getRelative(BlockFace.DOWN).getType() + ")");
|
|
||||||
} else {
|
|
||||||
WATER_SPEED_VIOLATIONS.put(uuid, v + 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
WATER_SPEED_VIOLATIONS.put(uuid, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
IS_IN_WATER_CACHE.add(uuid);
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
|
||||||
} else {
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
IS_IN_WATER.add(uuid);
|
Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
|
||||||
return PASS;
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
|
||||||
}
|
&& Utilities.isSurroundedByWater(player)
|
||||||
} else if (block.getRelative(BlockFace.DOWN).isLiquid() && !backend.isAscending(player)
|
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
|
||||||
&& Utilities.cantStandAt(block) && Utilities.cantStandAt(block.getRelative(BlockFace.DOWN))
|
|| movementManager.motionY == Utilities.JUMP_MOTION_Y)
|
||||||
&& (y < 0.025 || y == 0.09999999999999964 || y == 0.14999999999999947
|
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ")
|
||||||
|| y == 0.04999999999999982)) {
|
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false))
|
||||||
if (WATER_ASCENSION_VIOLATIONS.containsKey(uuid)) {
|
return new CheckResult(Result.FAILED, "Walk",
|
||||||
int v = WATER_ASCENSION_VIOLATIONS.get(uuid);
|
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
|
||||||
if (v >= backend.getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
|
||||||
WATER_ASCENSION_VIOLATIONS.put(uuid, 0);
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
|
||||||
"stood on water " + v + " times (can't stand on " + block.getType() + " or "
|
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY")
|
||||||
+ block.getRelative(BlockFace.DOWN).getType() + ")");
|
&& !Utilities.couldBeOnBoat(player, 0.3, false))
|
||||||
} else {
|
return new CheckResult(Result.FAILED, "Hop",
|
||||||
WATER_ASCENSION_VIOLATIONS.put(uuid, v + 1);
|
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
|
||||||
}
|
|
||||||
} else {
|
double minAbsMotionY = 0.12D;
|
||||||
WATER_ASCENSION_VIOLATIONS.put(uuid, 1);
|
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||||
}
|
minAbsMotionY += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
|
||||||
} else {
|
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
|
||||||
IS_IN_WATER.remove(uuid);
|
&& Utilities.isSurroundedByWater(player)
|
||||||
IS_IN_WATER_CACHE.remove(uuid);
|
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
|
||||||
}
|
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ")
|
||||||
}
|
&& movementManager.lastMotionY > -0.25
|
||||||
|
&& !Utilities.couldBeOnBoat(player, 0.3, false))
|
||||||
|
return new CheckResult(Result.FAILED, "Lunge", "tried to lunge in water (xz="
|
||||||
|
+ Utilities.roundDouble(movementManager.distanceXZ, 5) + ", absMotionY="
|
||||||
|
+ Utilities.roundDouble(Math.abs(movementManager.lastMotionY - movementManager.motionY), 5) + ")");
|
||||||
|
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.movement;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|
||||||
|
|
||||||
public class YAxisCheck {
|
|
||||||
|
|
||||||
public static final Map<UUID, Double> LAST_Y_COORD_CACHE = new HashMap<UUID, Double>();
|
|
||||||
public static final Map<UUID, Long> LAST_Y_TIME = new HashMap<UUID, Long>();
|
|
||||||
public static final Map<UUID, Integer> Y_AXIS_VIOLATIONS = new HashMap<UUID, Integer>();
|
|
||||||
public static final Map<UUID, Long> LAST_Y_AXIS_VIOLATION = new HashMap<UUID, Long>();
|
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
|
||||||
|
|
||||||
private static boolean hasJumpPotion(Player player) {
|
|
||||||
return player.hasPotionEffect(PotionEffectType.JUMP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
|
||||||
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|
|
||||||
|| distance.getYDifference() < 0 || VersionUtil.isFlying(player)) {
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
if (!FlightCheck.isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
|
||||||
&& !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock())
|
|
||||||
&& !player.isInsideVehicle() && !Utilities.isInWater(player) && !hasJumpPotion(player)
|
|
||||||
&& !isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
|
|
||||||
&& !isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) {
|
|
||||||
double y1 = player.getLocation().getY();
|
|
||||||
UUID uuid = player.getUniqueId();
|
|
||||||
// Fix Y axis spam.
|
|
||||||
if (!LAST_Y_COORD_CACHE.containsKey(uuid) || !LAST_Y_TIME.containsKey(uuid)
|
|
||||||
|| !LAST_Y_AXIS_VIOLATION.containsKey(uuid)) {
|
|
||||||
LAST_Y_COORD_CACHE.put(uuid, y1);
|
|
||||||
Y_AXIS_VIOLATIONS.put(uuid, 0);
|
|
||||||
LAST_Y_AXIS_VIOLATION.put(uuid, 0L);
|
|
||||||
LAST_Y_TIME.put(uuid, System.currentTimeMillis());
|
|
||||||
} else {
|
|
||||||
if (y1 > LAST_Y_COORD_CACHE.get(uuid)
|
|
||||||
&& Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
|
||||||
.Y_MAXVIOLATIONS()
|
|
||||||
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) < AntiCheatReloaded
|
|
||||||
.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
|
|
||||||
Location g = player.getLocation();
|
|
||||||
Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1);
|
|
||||||
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
|
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
|
||||||
g.setY(LAST_Y_COORD_CACHE.get(uuid));
|
|
||||||
if (g.getBlock().getType() == Material.AIR) {
|
|
||||||
player.teleport(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
|
||||||
"tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max="
|
|
||||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
|
|
||||||
} else {
|
|
||||||
if (Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
|
||||||
.Y_MAXVIOLATIONS()
|
|
||||||
&& (System.currentTimeMillis() - LAST_Y_AXIS_VIOLATION.get(uuid)) > AntiCheatReloaded
|
|
||||||
.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
|
|
||||||
Y_AXIS_VIOLATIONS.put(uuid, 0);
|
|
||||||
LAST_Y_AXIS_VIOLATION.put(uuid, 0L);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
long i = System.currentTimeMillis() - LAST_Y_TIME.get(uuid);
|
|
||||||
double diff = AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
|
||||||
+ ((Utilities.isStair(player.getLocation().add(0, -1, 0).getBlock()) || Utilities.isStair(player.getLocation().add(0, -0.5, 0).getBlock())) ? 0.5 : 0.0);
|
|
||||||
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > diff
|
|
||||||
&& i < AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME()) {
|
|
||||||
Location g = player.getLocation();
|
|
||||||
Y_AXIS_VIOLATIONS.put(uuid, Y_AXIS_VIOLATIONS.get(uuid) + 1);
|
|
||||||
LAST_Y_AXIS_VIOLATION.put(uuid, System.currentTimeMillis());
|
|
||||||
if (!AntiCheatReloaded.getManager().getBackend().silentMode()) {
|
|
||||||
g.setY(LAST_Y_COORD_CACHE.get(uuid));
|
|
||||||
if (g.getBlock().getType() == Material.AIR) {
|
|
||||||
player.teleport(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to fly on y-axis in " + i + " ms (min="
|
|
||||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")");
|
|
||||||
} else {
|
|
||||||
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
|
||||||
.Y_MAXDIFF() + 1
|
|
||||||
|| (System.currentTimeMillis() - LAST_Y_TIME.get(uuid)) > AntiCheatReloaded.getManager()
|
|
||||||
.getBackend().getMagic().Y_TIME()) {
|
|
||||||
LAST_Y_TIME.put(uuid, System.currentTimeMillis());
|
|
||||||
LAST_Y_COORD_CACHE.put(uuid, y1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Fix Y axis spam
|
|
||||||
return PASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isMoveUpBlock(Block block) {
|
|
||||||
return Utilities.isStair(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,9 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
public class BadPacketsCheck {
|
public class BadPacketsCheck {
|
||||||
@@ -38,9 +40,10 @@ public class BadPacketsCheck {
|
|||||||
public static void runCheck(Player player, PacketEvent event) {
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
Backend backend = AntiCheatReloaded.getManager().getBackend();
|
||||||
// Confirm if we should even check for BadPackets
|
// Confirm if we should even check for BadPackets
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS) || backend.isMovingExempt(player)) {
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|
||||||
|
|| backend.isMovingExempt(player) || player.isDead())
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
PacketContainer packet = event.getPacket();
|
PacketContainer packet = event.getPacket();
|
||||||
float pitch = packet.getFloat().read(1);
|
float pitch = packet.getFloat().read(1);
|
||||||
@@ -50,11 +53,13 @@ public class BadPacketsCheck {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO more precise checking for this
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (user.isLagging() || tps < 18) {
|
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
|
||||||
|
.getMovementManager();
|
||||||
|
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")
|
||||||
|
|| (System.currentTimeMillis() - movementManager.lastTeleport <= 150))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
double x = packet.getDoubles().read(0);
|
double x = packet.getDoubles().read(0);
|
||||||
double y = packet.getDoubles().read(1);
|
double y = packet.getDoubles().read(1);
|
||||||
@@ -64,15 +69,19 @@ public class BadPacketsCheck {
|
|||||||
Location previous = player.getLocation();
|
Location previous = player.getLocation();
|
||||||
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
|
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
|
||||||
double distance = previous.distanceSquared(current);
|
double distance = previous.distanceSquared(current);
|
||||||
double maxDistance = backend.getMagic().BADPACKETS_MAX_DISTANCE();
|
double maxDistance = checksConfig.getDouble(CheckType.BADPACKETS, "maxDistance");
|
||||||
|
// Fix falling false
|
||||||
|
if (movementManager.airTicks >= 40 && movementManager.motionY < 0 && movementManager.lastMotionY < 0)
|
||||||
|
maxDistance *= 1.5D;
|
||||||
boolean hasNewLocation = packet.getBooleans().read(0);
|
boolean hasNewLocation = packet.getBooleans().read(0);
|
||||||
if (distance > maxDistance) {
|
if (distance > maxDistance) {
|
||||||
flag(player, event, "moved too far between packets (distance=" + new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ")");
|
flag(player, event, "moved too far between packets (distance="
|
||||||
|
+ new BigDecimal(distance).setScale(1, RoundingMode.HALF_UP) + ", max=" + maxDistance + ", at=" + movementManager.airTicks + ")");
|
||||||
return;
|
return;
|
||||||
} else if (distance < 1E-10 && !hasNewLocation) {
|
} else if (distance < 1E-10 && !hasNewLocation) {
|
||||||
// TODO this gives false positives when teleporting
|
// TODO this gives false positives when teleporting
|
||||||
// Only found this in 1.8.8 though
|
// Only found this in 1.8.8 though
|
||||||
//flag(player, event, "sent the same packet twice");
|
// flag(player, event, "sent the same packet twice");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,7 +93,7 @@ public class BadPacketsCheck {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
CheckType.BADPACKETS);
|
CheckType.BADPACKETS, null);
|
||||||
player.teleport(player.getLocation());
|
player.teleport(player.getLocation());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ import com.comphenix.protocol.events.PacketEvent;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
@@ -43,15 +44,19 @@ public class MorePacketsCheck {
|
|||||||
|
|
||||||
public static void runCheck(Player player, PacketEvent event) {
|
public static void runCheck(Player player, PacketEvent event) {
|
||||||
// Confirm if we should even check for MorePackets
|
// Confirm if we should even check for MorePackets
|
||||||
// If your TPS is lower than 15 you are running a shitshow
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
double tps = AntiCheatReloaded.getPlugin().getTPS();
|
||||||
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS) || tps < 15) {
|
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.MOREPACKETS)
|
||||||
|
|| tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)) {
|
int maxPing = checksConfig.getInteger(CheckType.MOREPACKETS, "maxPing");
|
||||||
|
boolean disableForLagging = checksConfig.getBoolean(CheckType.MOREPACKETS, "disableForLagging");
|
||||||
|
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)
|
||||||
|
|| (maxPing > 0 && user.getPing() > maxPing) || (disableForLagging && user.isLagging())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long packetTimeNow = System.currentTimeMillis();
|
long packetTimeNow = System.currentTimeMillis();
|
||||||
@@ -61,13 +66,15 @@ public class MorePacketsCheck {
|
|||||||
long rate = packetTimeNow - lastPacketTime;
|
long rate = packetTimeNow - lastPacketTime;
|
||||||
packetBalance += 50;
|
packetBalance += 50;
|
||||||
packetBalance -= rate;
|
packetBalance -= rate;
|
||||||
if (packetBalance >= magic.MOREPACKETS_TRIGGER_BALANCE()) {
|
int triggerBalance = checksConfig.getInteger(CheckType.MOREPACKETS, "triggerBalance");
|
||||||
|
int minimumClamp = checksConfig.getInteger(CheckType.MOREPACKETS, "minimumClamp");
|
||||||
|
if (packetBalance >= triggerBalance) {
|
||||||
int ticks = (int) Math.round(packetBalance / 50);
|
int ticks = (int) Math.round(packetBalance / 50);
|
||||||
packetBalance = -1 * (magic.MOREPACKETS_TRIGGER_BALANCE() / 2);
|
packetBalance = -1 * (triggerBalance / 2);
|
||||||
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
||||||
} else if (packetBalance < -1 * (magic.MOREPACKETS_MINIMUM_CLAMP())) {
|
} else if (packetBalance < -1 * minimumClamp) {
|
||||||
// Clamp minimum, 50ms=1tick of lag leniency
|
// Clamp minimum, 50ms=1tick of lag leniency
|
||||||
packetBalance = -1 * (magic.MOREPACKETS_MINIMUM_CLAMP());
|
packetBalance = -1 * minimumClamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
LAST_PACKET_TIME.put(uuid, packetTimeNow);
|
LAST_PACKET_TIME.put(uuid, packetTimeNow);
|
||||||
@@ -81,7 +88,7 @@ public class MorePacketsCheck {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
|
||||||
CheckType.MOREPACKETS);
|
CheckType.MOREPACKETS, null);
|
||||||
player.teleport(player.getLocation());
|
player.teleport(player.getLocation());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -89,9 +96,9 @@ public class MorePacketsCheck {
|
|||||||
|
|
||||||
public static void compensate(Player player) {
|
public static void compensate(Player player) {
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
double packetBalance = PACKET_BALANCE.getOrDefault(uuid, 0D);
|
||||||
PACKET_BALANCE.put(uuid, packetBalance - magic.MOREPACKETS_TELEPORT_COMPENSATION());
|
PACKET_BALANCE.put(uuid, packetBalance - checksConfig.getInteger(CheckType.MOREPACKETS, "teleportCompensation"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.player;
|
package com.rammelkast.anticheatreloaded.check.player;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@@ -26,11 +25,14 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
@@ -39,33 +41,57 @@ public class IllegalInteract {
|
|||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
public static CheckResult performCheck(Player player, Event event) {
|
public static CheckResult performCheck(Player player, Event event) {
|
||||||
if (event instanceof BlockPlaceEvent) {
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
if (event instanceof BlockPlaceEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "place")) {
|
||||||
return checkBlockPlace(player, (BlockPlaceEvent) event);
|
return checkBlockPlace(player, (BlockPlaceEvent) event);
|
||||||
} else if (event instanceof BlockBreakEvent) {
|
} else if (event instanceof BlockBreakEvent
|
||||||
|
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "break")) {
|
||||||
return checkBlockBreak(player, (BlockBreakEvent) event);
|
return checkBlockBreak(player, (BlockBreakEvent) event);
|
||||||
|
} else if (event instanceof PlayerInteractEvent
|
||||||
|
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
|
||||||
|
return checkInteract(player, (PlayerInteractEvent) event);
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CheckResult checkInteract(Player player, PlayerInteractEvent event) {
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
||||||
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
double distance = player.getEyeLocation().toVector().distance(event.getClickedBlock().getLocation().toVector());
|
||||||
|
double maxDistance = player.getGameMode() == GameMode.CREATIVE
|
||||||
|
? checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "creativeRange")
|
||||||
|
: checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "survivalRange");
|
||||||
|
|
||||||
|
maxDistance += user.isLagging() ? 0.12 : 0;
|
||||||
|
maxDistance += user.getPing()
|
||||||
|
* checksConfig.getInteger(CheckType.ILLEGAL_INTERACT, "interact", "pingCompensation");
|
||||||
|
maxDistance += player.getVelocity().length()
|
||||||
|
* checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "velocityMultiplier");
|
||||||
|
if (distance > maxDistance) {
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "Interact",
|
||||||
|
"tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
|
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
|
||||||
if (!isValidTarget(player, event.getBlock())) {
|
if (!isValidTarget(player, event.getBlock())) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break a block which was out of view");
|
return new CheckResult(CheckResult.Result.FAILED, "Break", "tried to break a block which was out of view");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
|
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
|
||||||
if (!isValidTarget(player, event.getBlock())) {
|
if (!isValidTarget(player, event.getBlock())) {
|
||||||
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block out of their view");
|
return new CheckResult(CheckResult.Result.FAILED, "Place", "tried to place a block out of their view");
|
||||||
}
|
}
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isValidTarget(Player player, Block block) {
|
private static boolean isValidTarget(Player player, Block block) {
|
||||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
double distance = player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0
|
||||||
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
: player.getLocation().getDirection().getY() > 0.9 ? 6.0 : 5.5;
|
||||||
: magic.BLOCK_MAX_DISTANCE();
|
|
||||||
Block targetBlock = VersionUtil.getTargetBlock(player, ((int) Math.ceil(distance)));
|
Block targetBlock = VersionUtil.getTargetBlock(player, ((int) Math.ceil(distance)));
|
||||||
if (targetBlock == null) {
|
if (targetBlock == null) {
|
||||||
// TODO better check here
|
// TODO better check here
|
||||||
@@ -86,7 +112,7 @@ public class IllegalInteract {
|
|||||||
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
||||||
double playerYaw = player.getEyeLocation().getYaw();
|
double playerYaw = player.getEyeLocation().getYaw();
|
||||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||||
if (Math.round(angleDifference) > magic.ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE()) {
|
if (Math.round(angleDifference) > checksConfig.getInteger(CheckType.ILLEGAL_INTERACT, "maxAngleDifference")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class CommandBase {
|
|||||||
execute(cs, args);
|
execute(cs, args);
|
||||||
} else {
|
} else {
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
cs.sendMessage(GRAY + "Running " + GOLD + "" + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandChecks;
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
|
||||||
import com.rammelkast.anticheatreloaded.command.executors.CommandMute;
|
import com.rammelkast.anticheatreloaded.command.executors.CommandMute;
|
||||||
@@ -41,7 +41,7 @@ public class CommandHandler implements CommandExecutor {
|
|||||||
|
|
||||||
public CommandHandler() {
|
public CommandHandler() {
|
||||||
commands.add(new CommandHelp());
|
commands.add(new CommandHelp());
|
||||||
commands.add(new CommandCheck());
|
commands.add(new CommandChecks());
|
||||||
commands.add(new CommandLog());
|
commands.add(new CommandLog());
|
||||||
commands.add(new CommandReload());
|
commands.add(new CommandReload());
|
||||||
commands.add(new CommandReport());
|
commands.add(new CommandReport());
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CommandCheck extends CommandBase {
|
|
||||||
|
|
||||||
private static final String NAME = "AntiCheatReloaded Check Management";
|
|
||||||
private static final String COMMAND = "check";
|
|
||||||
private static final String USAGE = "anticheat check [check] [on/off]";
|
|
||||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
|
||||||
private static final String[] HELP = new String[3];
|
|
||||||
|
|
||||||
static {
|
|
||||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat check [check] on" + GRAY + " to enable a check";
|
|
||||||
HELP[1] = GRAY + "Use: " + AQUA + "/anticheat check [check] off" + GRAY + " to disable a check";
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append(GRAY + "Checks: ");
|
|
||||||
for (int i=0;i<CheckType.values().length;i++) {
|
|
||||||
builder.append(CheckType.values()[i]);
|
|
||||||
if (i<CheckType.values().length-1) {
|
|
||||||
builder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HELP[2] = builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandCheck() {
|
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
|
||||||
if (args.length == 2) {
|
|
||||||
for (CheckType type : CheckType.values()) {
|
|
||||||
if (type.toString().equalsIgnoreCase(args[0]) || type.toString().replaceAll("_", "").equalsIgnoreCase(args[0])) {
|
|
||||||
boolean value = CHECK_MANAGER.isActive(type);
|
|
||||||
|
|
||||||
boolean newValue;
|
|
||||||
if (args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("enable")) {
|
|
||||||
newValue = true;
|
|
||||||
} else if (args[1].equalsIgnoreCase("off") || args[1].equalsIgnoreCase("disable")) {
|
|
||||||
newValue = false;
|
|
||||||
} else {
|
|
||||||
sendHelp(cs);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String strValue = (newValue ? " activated" : " deactivated");
|
|
||||||
if (value == newValue) {
|
|
||||||
cs.sendMessage(GREEN + type.toString() + " is already" + strValue + "!");
|
|
||||||
} else {
|
|
||||||
if (newValue) {
|
|
||||||
CHECK_MANAGER.activateCheck(type, cs.getName());
|
|
||||||
List<String> checks = CONFIG.getConfig().disabledChecks.getValue();
|
|
||||||
if (checks.contains(type.toString())) {
|
|
||||||
checks.remove(type.toString());
|
|
||||||
CONFIG.getConfig().disabledChecks.setValue(checks);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
CHECK_MANAGER.deactivateCheck(type, cs.getName());
|
|
||||||
List<String> checks = CONFIG.getConfig().disabledChecks.getValue();
|
|
||||||
checks.add(type.toString());
|
|
||||||
CONFIG.getConfig().disabledChecks.setValue(checks);
|
|
||||||
}
|
|
||||||
cs.sendMessage(GREEN + type.toString() + strValue + ".");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendHelp(cs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
|
import com.rammelkast.anticheatreloaded.manage.CheckManager;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
|
|
||||||
|
public class CommandChecks extends CommandBase {
|
||||||
|
|
||||||
|
private static final String NAME = "AntiCheatReloaded Checks Management";
|
||||||
|
private static final String COMMAND = "checks";
|
||||||
|
private static final String USAGE = "anticheat checks";
|
||||||
|
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||||
|
private static final String[] HELP = new String[2];
|
||||||
|
|
||||||
|
static {
|
||||||
|
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
CheckManager checkManager = AntiCheatReloaded.getManager().getCheckManager();
|
||||||
|
builder.append(GRAY + "Checks: ");
|
||||||
|
for (int i = 0; i < CheckType.values().length; i++) {
|
||||||
|
CheckType type = CheckType.values()[i];
|
||||||
|
builder.append((checkManager.isActive(type) ? ChatColor.GREEN : ChatColor.RED) + type.getName());
|
||||||
|
if (i < CheckType.values().length - 1) {
|
||||||
|
builder.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HELP[1] = builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandChecks() {
|
||||||
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
|
sendHelp(cs);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ public class CommandHelp extends CommandBase {
|
|||||||
GOLD + "/acr " + GRAY + "reload",
|
GOLD + "/acr " + GRAY + "reload",
|
||||||
GOLD + "/acr " + GRAY + "version",
|
GOLD + "/acr " + GRAY + "version",
|
||||||
GOLD + "/acr " + GRAY + "mute",
|
GOLD + "/acr " + GRAY + "mute",
|
||||||
GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
GOLD + "/acr " + GRAY + "checks",
|
||||||
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
||||||
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
||||||
GOLD + "/acr " + GRAY + "reset " + WHITE + "[user]",
|
GOLD + "/acr " + GRAY + "reset " + WHITE + "[user]",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||||
@@ -41,6 +42,6 @@ public class CommandReload extends CommandBase {
|
|||||||
@Override
|
@Override
|
||||||
protected void execute(CommandSender cs, String[] args) {
|
protected void execute(CommandSender cs, String[] args) {
|
||||||
CONFIG.load();
|
CONFIG.load();
|
||||||
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
|
cs.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + "The configuration was reloaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+24
-20
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -25,8 +24,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
@@ -45,8 +44,7 @@ public class CommandReport extends CommandBase {
|
|||||||
private static final String[] HELP = {
|
private static final String[] HELP = {
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
|
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report", };
|
||||||
};
|
|
||||||
|
|
||||||
public CommandReport() {
|
public CommandReport() {
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
@@ -66,39 +64,37 @@ public class CommandReport extends CommandBase {
|
|||||||
|
|
||||||
if ("low".equalsIgnoreCase(args[0])) {
|
if ("low".equalsIgnoreCase(args[0])) {
|
||||||
groupReport(cs, null, page);
|
groupReport(cs, null, page);
|
||||||
}
|
} else if ("all".equalsIgnoreCase(args[0])) {
|
||||||
else if ("all".equalsIgnoreCase(args[0])) {
|
|
||||||
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
||||||
for (Group g : CONFIG.getGroups().getGroups()) {
|
for (Group g : CONFIG.getGroups().getGroups()) {
|
||||||
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
||||||
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
||||||
}
|
}
|
||||||
cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY + " for a list of players in each group.");
|
cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY
|
||||||
|
+ " for a list of players in each group.");
|
||||||
} else {
|
} else {
|
||||||
// Test groups
|
// Test groups
|
||||||
for (Group group : CONFIG.getGroups().getGroups()) {
|
for (Group group : CONFIG.getGroups().getGroups()) {
|
||||||
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0]) || "all".equalsIgnoreCase(args[0])) {
|
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0])
|
||||||
|
|| "all".equalsIgnoreCase(args[0])) {
|
||||||
groupReport(cs, group, page);
|
groupReport(cs, group, page);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getPlayer(args[0]);
|
@SuppressWarnings("deprecation")
|
||||||
|
OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[0]);
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test users
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(targetPlayer.getUniqueId());
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
if (user != null) {
|
||||||
if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) {
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
|
||||||
playerReport(cs, user, page);
|
playerReport(cs, user, page);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Neither of these
|
|
||||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -112,7 +108,8 @@ public class CommandReport extends CommandBase {
|
|||||||
String groupName = group == null ? "Low" : group.getName();
|
String groupName = group == null ? "Low" : group.getName();
|
||||||
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
||||||
if (page <= pages && page > 0) {
|
if (page <= pages && page > 0) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD
|
||||||
|
+ "]----------------------");
|
||||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||||
for (int x = 0; x < 7; x++) {
|
for (int x = 0; x < 7; x++) {
|
||||||
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
||||||
@@ -155,9 +152,13 @@ public class CommandReport extends CommandBase {
|
|||||||
groupString += " (" + user.getLevel() + ")";
|
groupString += " (" + user.getLevel() + ")";
|
||||||
|
|
||||||
if (page <= pages && page > 0) {
|
if (page <= pages && page > 0) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD
|
||||||
|
+ "]----------------------");
|
||||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
int ping = user.getPing();
|
||||||
|
cs.sendMessage(GRAY + "Ping: " + ((ping == -1) ? (RED + "Offline")
|
||||||
|
: (WHITE + "" + ping + "ms "
|
||||||
|
+ (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"))));
|
||||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||||
for (int x = 0; x < 6; x++) {
|
for (int x = 0; x < 6; x++) {
|
||||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||||
@@ -170,7 +171,7 @@ public class CommandReport extends CommandBase {
|
|||||||
} else if (use > 50) {
|
} else if (use > 50) {
|
||||||
color = RED;
|
color = RED;
|
||||||
}
|
}
|
||||||
cs.sendMessage(GRAY + CheckType.getName(type) + ": " + color + use);
|
cs.sendMessage(GRAY + type.getName() + ": " + color + use);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cs.sendMessage(MENU_END);
|
cs.sendMessage(MENU_END);
|
||||||
@@ -178,7 +179,10 @@ public class CommandReport extends CommandBase {
|
|||||||
if (pages == 0 && page == 1) {
|
if (pages == 0 && page == 1) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
||||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
int ping = user.getPing();
|
||||||
|
cs.sendMessage(GRAY + "Ping: " + ((ping == -1) ? (RED + "Offline")
|
||||||
|
: (WHITE + "" + ping + "ms "
|
||||||
|
+ (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"))));
|
||||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||||
cs.sendMessage(MENU_END);
|
cs.sendMessage(MENU_END);
|
||||||
|
|||||||
@@ -19,21 +19,35 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.config;
|
package com.rammelkast.anticheatreloaded.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.config.files.Config;
|
import com.rammelkast.anticheatreloaded.config.files.Config;
|
||||||
import com.rammelkast.anticheatreloaded.config.files.Enterprise;
|
import com.rammelkast.anticheatreloaded.config.files.Enterprise;
|
||||||
import com.rammelkast.anticheatreloaded.config.holders.mysql.*;
|
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLGroupsHolder;
|
||||||
import com.rammelkast.anticheatreloaded.config.holders.yaml.*;
|
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLLangHolder;
|
||||||
import com.rammelkast.anticheatreloaded.config.providers.*;
|
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLLevelsHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLMagicHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.mysql.MySQLRulesHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlChecksHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlGroupsHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlLangHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlLevelsHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlMagicHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.holders.yaml.YamlRulesHolder;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Groups;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Levels;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Rules;
|
||||||
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.InvocationHandler;
|
|
||||||
import java.lang.reflect.Proxy;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
|
|
||||||
private AntiCheatManager manager;
|
private AntiCheatManager manager;
|
||||||
@@ -45,6 +59,7 @@ public class Configuration {
|
|||||||
private Groups groups;
|
private Groups groups;
|
||||||
private Levels levels;
|
private Levels levels;
|
||||||
private Rules rules;
|
private Rules rules;
|
||||||
|
private Checks checks;
|
||||||
|
|
||||||
private ArrayList<ConfigurationFile> flatfiles;
|
private ArrayList<ConfigurationFile> flatfiles;
|
||||||
private ArrayList<ConfigurationTable> dbfiles;
|
private ArrayList<ConfigurationTable> dbfiles;
|
||||||
@@ -84,6 +99,9 @@ public class Configuration {
|
|||||||
flatfiles.add((YamlRulesHolder) rules);
|
flatfiles.add((YamlRulesHolder) rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checks = new YamlChecksHolder(plugin, this);
|
||||||
|
flatfiles.add((YamlChecksHolder) checks);
|
||||||
|
|
||||||
InvocationHandler handler;
|
InvocationHandler handler;
|
||||||
if (config.enterprise.getValue() && enterprise.configMagic.getValue()) {
|
if (config.enterprise.getValue() && enterprise.configMagic.getValue()) {
|
||||||
handler = new MySQLMagicHolder(this);
|
handler = new MySQLMagicHolder(this);
|
||||||
@@ -133,12 +151,15 @@ public class Configuration {
|
|||||||
file.load();
|
file.load();
|
||||||
checkReload(file);
|
checkReload(file);
|
||||||
}
|
}
|
||||||
for (ConfigurationTable table : dbfiles) {
|
|
||||||
|
for (ConfigurationTable table : dbfiles)
|
||||||
table.load();
|
table.load();
|
||||||
}
|
|
||||||
if (manager.getBackend() != null) {
|
if (manager.getBackend() != null)
|
||||||
manager.getBackend().updateConfig(this);
|
manager.getBackend().updateConfig(this);
|
||||||
}
|
|
||||||
|
if (manager.getCheckManager() != null)
|
||||||
|
manager.getCheckManager().loadCheckIgnoreList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkReload(ConfigurationFile file) {
|
private void checkReload(ConfigurationFile file) {
|
||||||
@@ -195,4 +216,8 @@ public class Configuration {
|
|||||||
public Magic getMagic() {
|
public Magic getMagic() {
|
||||||
return magic;
|
return magic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Checks getChecks() {
|
||||||
|
return checks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -36,6 +36,7 @@ public class Config extends ConfigurationFile {
|
|||||||
public ConfigValue<Boolean> eventChains;
|
public ConfigValue<Boolean> eventChains;
|
||||||
public ConfigValue<Boolean> enterprise;
|
public ConfigValue<Boolean> enterprise;
|
||||||
public ConfigValue<Boolean> debugMode;
|
public ConfigValue<Boolean> debugMode;
|
||||||
|
public ConfigValue<Boolean> disableBroadcast;
|
||||||
|
|
||||||
public ConfigValue<Boolean> blockChatSpamSpeed;
|
public ConfigValue<Boolean> blockChatSpamSpeed;
|
||||||
public ConfigValue<Boolean> blockCommandSpamSpeed;
|
public ConfigValue<Boolean> blockCommandSpamSpeed;
|
||||||
@@ -49,9 +50,9 @@ public class Config extends ConfigurationFile {
|
|||||||
public ConfigValue<Boolean> logToFile;
|
public ConfigValue<Boolean> logToFile;
|
||||||
|
|
||||||
public ConfigValue<List<String>> disabledWorlds;
|
public ConfigValue<List<String>> disabledWorlds;
|
||||||
public ConfigValue<List<String>> disabledChecks;
|
|
||||||
|
|
||||||
public ConfigValue<Integer> notifyEveryVl;
|
public ConfigValue<Integer> notifyEveryVl;
|
||||||
|
public ConfigValue<Integer> maxSetbackDistance;
|
||||||
|
|
||||||
public Config(AntiCheatReloaded plugin, Configuration config) {
|
public Config(AntiCheatReloaded plugin, Configuration config) {
|
||||||
super(plugin, config, FILENAME);
|
super(plugin, config, FILENAME);
|
||||||
@@ -67,6 +68,7 @@ public class Config extends ConfigurationFile {
|
|||||||
eventChains = new ConfigValue<Boolean>("system.event-chains");
|
eventChains = new ConfigValue<Boolean>("system.event-chains");
|
||||||
enterprise = new ConfigValue<Boolean>("system.enterprise");
|
enterprise = new ConfigValue<Boolean>("system.enterprise");
|
||||||
debugMode = new ConfigValue<Boolean>("system.debug-mode");
|
debugMode = new ConfigValue<Boolean>("system.debug-mode");
|
||||||
|
disableBroadcast = new ConfigValue<Boolean>("system.disable-broadcast");
|
||||||
|
|
||||||
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
|
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
|
||||||
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
|
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
|
||||||
@@ -81,11 +83,14 @@ public class Config extends ConfigurationFile {
|
|||||||
logToFile = new ConfigValue<Boolean>("system.log-to-file");
|
logToFile = new ConfigValue<Boolean>("system.log-to-file");
|
||||||
|
|
||||||
disabledWorlds = new ConfigValue<List<String>>("disable-in");
|
disabledWorlds = new ConfigValue<List<String>>("disable-in");
|
||||||
disabledChecks = new ConfigValue<List<String>>("disabled-checks");
|
|
||||||
|
|
||||||
notifyEveryVl = new ConfigValue<Integer>("system.notify-every-vl");
|
notifyEveryVl = new ConfigValue<Integer>("system.notify-every-vl");
|
||||||
if (notifyEveryVl.getValue() < 1) {
|
if (notifyEveryVl.getValue() < 1) {
|
||||||
notifyEveryVl.setValue(5);
|
notifyEveryVl.setValue(5);
|
||||||
}
|
}
|
||||||
|
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
|
||||||
|
if (maxSetbackDistance.getValue() < 5) {
|
||||||
|
maxSetbackDistance.setValue(50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.ConfigurationFile;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||||
|
|
||||||
|
public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
||||||
|
|
||||||
|
public static final String FILENAME = "checks.yml";
|
||||||
|
|
||||||
|
public YamlChecksHolder(AntiCheatReloaded plugin, Configuration config) {
|
||||||
|
super(plugin, config, FILENAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void open() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getBoolean(CheckType checkType, String subcheck, String name) {
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
||||||
|
.getBoolean(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSubcheckEnabled(CheckType checkType, String subcheck) {
|
||||||
|
return this.getBoolean(checkType, subcheck, "enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(CheckType checkType, String subcheck, String name) {
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
||||||
|
.getDouble(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInteger(CheckType checkType, String subcheck, String name) {
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getConfigurationSection(subcheck)
|
||||||
|
.getInt(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getBoolean(CheckType checkType, String name) {
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getBoolean(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(CheckType checkType, String name) {
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getDouble(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInteger(CheckType checkType, String name) {
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getInt(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(CheckType checkType) {
|
||||||
|
// If the root of a check has no enabled or disabled option, it has to be configured on a subcheck basis
|
||||||
|
if (!this.getConfigFile().isConfigurationSection(checkType.getName().toLowerCase())) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED
|
||||||
|
+ "Missing configuration settings for " + checkType.getName() + "!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).contains("enabled"))
|
||||||
|
return true;
|
||||||
|
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getBoolean("enabled");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.config.providers;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
|
||||||
|
public interface Checks {
|
||||||
|
|
||||||
|
public boolean getBoolean(CheckType checkType, String name);
|
||||||
|
|
||||||
|
public boolean getBoolean(CheckType checkType, String subcheck, String name);
|
||||||
|
|
||||||
|
public double getDouble(CheckType checkType, String name);
|
||||||
|
|
||||||
|
public double getDouble(CheckType checkType, String subcheck, String name);
|
||||||
|
|
||||||
|
public int getInteger(CheckType checkType, String name);
|
||||||
|
|
||||||
|
public int getInteger(CheckType checkType, String subcheck, String name);
|
||||||
|
|
||||||
|
public boolean isEnabled(CheckType checkType);
|
||||||
|
|
||||||
|
public boolean isSubcheckEnabled(CheckType checkType, String subcheck);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -99,4 +99,12 @@ public interface Lang {
|
|||||||
* @return Kicking broadcast.
|
* @return Kicking broadcast.
|
||||||
*/
|
*/
|
||||||
public String KICK_BROADCAST();
|
public String KICK_BROADCAST();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the alert prefix for staff and debug.
|
||||||
|
*
|
||||||
|
* @return Alert prefix.
|
||||||
|
*/
|
||||||
|
public String ALERT_PREFIX();
|
||||||
}
|
}
|
||||||
@@ -42,26 +42,14 @@ public interface Magic {
|
|||||||
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of entering/exiting a vehicle; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int ENTERED_EXITED_TIME();
|
public int ENTERED_EXITED_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of entering/exiting sneak mode; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int SNEAK_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int TELEPORT_TIME();
|
public int TELEPORT_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from moving because of exiting fly mode; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int EXIT_FLY_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time to exempt a player from moving because of joining the server; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of joining the server; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int JOIN_TIME();
|
public int JOIN_TIME();
|
||||||
/**
|
|
||||||
* Time to exempt a player from fastbreak check because of using instant break; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int INSTANT_BREAK_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time to exempt a player from moving because of taking damage; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of taking damage; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
@@ -74,330 +62,26 @@ public interface Magic {
|
|||||||
* Time to exempt a player from moving because of taking damage from an explosion; Type=SYSTEM, Leniency=INCREASE.
|
* Time to exempt a player from moving because of taking damage from an explosion; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int EXPLOSION_DAMAGE_TIME();
|
public int EXPLOSION_DAMAGE_TIME();
|
||||||
/**
|
|
||||||
* Minimum time it takes to fire X projectiles; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int PROJECTILE_TIME_MIN();
|
|
||||||
/**
|
|
||||||
* Number of projectiles to wait for before checking how long they took to fire off; Type=INTEGER.
|
|
||||||
*/
|
|
||||||
public int PROJECTILE_CHECK();
|
|
||||||
/**
|
|
||||||
* Minimum time it takes to drop X items; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int DROP_TIME_MIN();
|
|
||||||
/**
|
|
||||||
* Number of item drops to wait for before checking how long they took to drop; Type=INTEGER.
|
|
||||||
*/
|
|
||||||
public int DROP_CHECK();
|
|
||||||
/**
|
|
||||||
* Max number of blocks that can be broken in a given time; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTBREAK_LIMIT();
|
|
||||||
/**
|
|
||||||
* Time to wait before checking block breaks; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTBREAK_TIMEMAX();
|
|
||||||
/**
|
|
||||||
* Time to wait before checking block breaks in creative mode; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTBREAK_TIMEMAX_CREATIVE();
|
|
||||||
/**
|
|
||||||
* Number of times fastbreak can be observed before taking action; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTBREAK_MAXVIOLATIONS();
|
|
||||||
/**
|
|
||||||
* Number of times fastbreak can be observed before taking action in creative mode; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTBREAK_MAXVIOLATIONS_CREATIVE();
|
|
||||||
/**
|
|
||||||
* Time a player is forced to wait after fastbreak has been detected; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int FASTBREAK_MAXVIOLATIONTIME();
|
|
||||||
/**
|
|
||||||
* Number of blocks that can be broken without being hit before taking action; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_ZEROLIMIT();
|
|
||||||
/**
|
|
||||||
* Minimum time in between block places; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_TIMEMIN();
|
|
||||||
/**
|
|
||||||
* Number of times fastplace can be observed before taking action; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_MAXVIOLATIONS();
|
|
||||||
/**
|
|
||||||
* Number of times fastplace can be observed before taking action in creative mode; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_MAXVIOLATIONS_CREATIVE();
|
|
||||||
/**
|
|
||||||
* Time a player is forced to wait after fastplace has been detected; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int FASTPLACE_MAXVIOLATIONTIME();
|
|
||||||
/**
|
|
||||||
* Number of times required to punch a block before it breaks; Type=INTEGER, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int BLOCK_PUNCH_MIN();
|
|
||||||
/**
|
|
||||||
* Number of command spam violations before action one is executed; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int COMMAND_ACTION_ONE_LEVEL();
|
|
||||||
/**
|
|
||||||
* Number of command spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int COMMAND_ACTION_TWO_LEVEL();
|
|
||||||
/**
|
|
||||||
* Number of chat spam violations before action one is executed; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int CHAT_ACTION_ONE_LEVEL();
|
|
||||||
/**
|
|
||||||
* Number of chat spam violations before action two is executed; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int CHAT_ACTION_TWO_LEVEL();
|
|
||||||
/**
|
|
||||||
* Number of times a player can be caught in-glide before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int GLIDE_LIMIT();
|
|
||||||
/**
|
|
||||||
* How many blocks you can travel before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double FLIGHT_BLOCK_LIMIT();
|
|
||||||
/**
|
|
||||||
* Maximum speed that a player can climb a waterfall; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double WATER_CLIMB_MAX();
|
|
||||||
/**
|
|
||||||
* Number of times a player can fly on the y-axis before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int Y_MAXVIOLATIONS();
|
|
||||||
/**
|
|
||||||
* Time a player is forced to wait after flying on the y-axis; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int Y_MAXVIOTIME();
|
|
||||||
/**
|
|
||||||
* Number of times a player can fail a velocity check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_TIME();
|
|
||||||
/**
|
/**
|
||||||
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=INTEGER.
|
* Time used to schedule increasing a players velocity count - probably not touching this would be good; Type=INTEGER.
|
||||||
*/
|
*/
|
||||||
public int VELOCITY_SCHETIME();
|
public int VELOCITY_EXTENSION();
|
||||||
/**
|
/**
|
||||||
* Maximum time a player is considered to have a change in velocity; Type=SYSTEM, Leniency=INCREASE.
|
* Time a player is considered to have a change in velocity; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int VELOCITY_CHECKTIME();
|
public int VELOCITY_TIME();
|
||||||
/**
|
/**
|
||||||
* Time to extend a player's velocity count by; Type=SYSTEM, Leniency=INCREASE.
|
* Time to extend a player's velocity count by; Type=SYSTEM, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int VELOCITY_PREVENT();
|
public int VELOCITY_PREVENT();
|
||||||
/**
|
/**
|
||||||
* Number of times a player can fail the velocity check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
* Maximum amount of velocity tracks; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int VELOCITY_MAXTIMES();
|
public int VELOCITY_MAXTIMES();
|
||||||
/**
|
|
||||||
* Number of times a player can fail the nofall check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int NOFALL_LIMIT();
|
|
||||||
/**
|
|
||||||
* Number of times a player can fail the ascension check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int ASCENSION_COUNT_MAX();
|
|
||||||
/**
|
|
||||||
* Number of times a player can fail the ascension check while in water before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int WATER_ASCENSION_VIOLATION_MAX();
|
|
||||||
/**
|
|
||||||
* Number of times a player can be caught speeding in water before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int WATER_SPEED_VIOLATION_MAX();
|
|
||||||
/**
|
|
||||||
* Number of times a player can sprint without proper food level before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int SPRINT_FOOD_MIN();
|
|
||||||
/**
|
|
||||||
* Maximum times a player can interact between animations; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int ANIMATION_INTERACT_MAX();
|
|
||||||
/**
|
|
||||||
* Minimum time between animations; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int ANIMATION_MIN();
|
|
||||||
/**
|
|
||||||
* Minimum time between commands; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int COMMAND_MIN();
|
|
||||||
/**
|
|
||||||
* Minimum time before repeating a command is ignored; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int COMMAND_REPEAT_MIN();
|
|
||||||
/**
|
|
||||||
* Minimum time between chats; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int CHAT_MIN();
|
|
||||||
/**
|
|
||||||
* Time before repeating yourself in chat is ignored; Type=SYSTEM, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int CHAT_REPEAT_MIN();
|
|
||||||
/**
|
|
||||||
* Maximum speed you can travel while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double SPRINT_MAX();
|
|
||||||
/**
|
|
||||||
* Minimum time in between block breaks; Type=INTEGER, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public double BLOCK_BREAK_MIN();
|
|
||||||
/**
|
|
||||||
* Minimum time in between block placing; Type=INTEGER, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public double BLOCK_PLACE_MIN();
|
|
||||||
/**
|
|
||||||
* Minimum time in between eating; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int EAT_TIME_MIN();
|
|
||||||
/**
|
|
||||||
* Maximum percent error between predicted bow force and actual bow force; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double BOW_ERROR();
|
|
||||||
/**
|
|
||||||
* Maximum distance a player can break a block from; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double BLOCK_MAX_DISTANCE();
|
|
||||||
/**
|
|
||||||
* Minimum distance a player can break a block from in creative mode; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double BLOCK_MAX_DISTANCE_CREATIVE();
|
|
||||||
/**
|
|
||||||
* Maximum distance a player can damage an entity from; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double ENTITY_MAX_DISTANCE();
|
|
||||||
/**
|
|
||||||
* Maximum distance a player can damage an entity from in creative mode; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double ENTITY_MAX_DISTANCE_CREATIVE();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player on a ladder can travel; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double LADDER_Y_MAX();
|
|
||||||
/**
|
|
||||||
* Minimum speed a player on a ladder can travel; Type=DOUBLE, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public double LADDER_Y_MIN();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player on a ladder can travel downwards
|
|
||||||
*/
|
|
||||||
public double LADDER_DOWN_MAX();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel up; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double Y_SPEED_MAX();
|
|
||||||
/**
|
|
||||||
* Maximum difference between the player's last 2 Y values when traveling up; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double Y_MAXDIFF();
|
|
||||||
/**
|
|
||||||
* Time in between Y difference measures; Type=SYSTEM, Leniency=DECREASE.
|
|
||||||
*/
|
|
||||||
public int Y_TIME();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_SPRINT();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards while flying; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_FLY();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards while under the influence; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_POTION();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards while sprinting while under the influence; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_POTION_SPRINT();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards while sneaking; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_SNEAK();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards in water; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_WATER();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards in water while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_WATER_SPRINT();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards on soul sand; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_SOULSAND();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards on soul sand while sprinting; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_SOULSAND_SPRINT();
|
|
||||||
/**
|
|
||||||
* Maximum speed a player can travel forwards or backwards on soul sand while under the influence; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double XZ_SPEED_MAX_SOULSAND_POTION();
|
|
||||||
/**
|
|
||||||
* Maximum times a player can fail the speed check before action is taken; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int SPEED_MAX();
|
|
||||||
/**
|
|
||||||
* The number of clicks we should wait before checking if the player has used fast inventory; Type=INTEGER; Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int INVENTORY_CHECK();
|
|
||||||
/**
|
|
||||||
* The minimum time it should have taken for the player to click X times; Type=INTEGER; Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int INVENTORY_TIMEMIN();
|
|
||||||
/**
|
/**
|
||||||
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
|
* Minimum travel distance for move to be considered a teleport and subsequently be ignored; Type=INTEGER, Leniency=INCREASE.
|
||||||
*/
|
*/
|
||||||
public int TELEPORT_MIN();
|
public int TELEPORT_MIN();
|
||||||
/**
|
|
||||||
* The amount of milliseconds to compensate for a teleport; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int MOREPACKETS_TELEPORT_COMPENSATION();
|
|
||||||
/**
|
|
||||||
* The amount of milliseconds that were offset to flag for MorePackets; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int MOREPACKETS_TRIGGER_BALANCE();
|
|
||||||
/**
|
|
||||||
* The maximum amount of overall lag compensating in milliseconds; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int MOREPACKETS_MINIMUM_CLAMP();
|
|
||||||
/**
|
|
||||||
* Maximum amount of low/zero velocity moments before flagging; Type=INTEGER, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public int VELOCITY_MAX_FLAGS();
|
|
||||||
/**
|
|
||||||
* The maximum angle difference allowed when attacking; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int KILLAURA_MAX_ANGLE_DIFFERENCE();
|
|
||||||
/**
|
|
||||||
* The maximum amount of violations before flagging player as a cheater; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int KILLAURA_MAX_ANGLE_VIOLATIONS();
|
|
||||||
/**
|
|
||||||
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE();
|
|
||||||
/**
|
|
||||||
* The minimum time it takes to regenerate health; TYPE=INTEGER, Leniency=DECREASE
|
|
||||||
*/
|
|
||||||
public int MIN_HEAL_TIME();
|
|
||||||
/**
|
|
||||||
* Maximum distance allowed between two movement packets; Type=DOUBLE, Leniency=INCREASE.
|
|
||||||
*/
|
|
||||||
public double BADPACKETS_MAX_DISTANCE();
|
|
||||||
/**
|
|
||||||
* Maximum amount of fastladder movements before flagging; TYPE=INTEGER, Leniency=INCREASE
|
|
||||||
*/
|
|
||||||
public int FASTLADDER_MAX_FLAGS();
|
|
||||||
/**
|
/**
|
||||||
* The change milliseconds between two keepalives before considering a player to be lagging; TYPE=INTEGER, Leniency=DECREASE
|
* The change milliseconds between two keepalives before considering a player to be lagging; TYPE=INTEGER, Leniency=DECREASE
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,43 +16,20 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
|
||||||
|
|
||||||
public class BlockListener extends EventListener {
|
public class BlockListener extends EventListener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onBlockDamage(BlockDamageEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if (event.getInstaBreak() || Utilities.isInstantBreak(event.getBlock().getType())) {
|
|
||||||
getBackend().logInstantBreak(player);
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.AUTOTOOL)) {
|
|
||||||
CheckResult result = getBackend().checkAutoTool(player);
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.AUTOTOOL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
@@ -61,7 +38,7 @@ public class BlockListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkFastPlace(player);
|
CheckResult result = getBackend().checkFastPlace(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_PLACE);
|
log(result.getMessage(), player, CheckType.FAST_PLACE, result.getSubCheck());
|
||||||
noHack = false;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +47,7 @@ public class BlockListener extends EventListener {
|
|||||||
CheckResult result = IllegalInteract.performCheck(player, event);
|
CheckResult result = IllegalInteract.performCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||||
noHack = false;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,39 +61,13 @@ public class BlockListener extends EventListener {
|
|||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final Block block = event.getBlock();
|
|
||||||
boolean noHack = true;
|
boolean noHack = true;
|
||||||
CheckResult result;
|
CheckResult result;
|
||||||
if (getCheckManager().willCheck(player, CheckType.FAST_BREAK)) {
|
|
||||||
result = getBackend().checkFastBreak(player, block);
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.FAST_BREAK);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.NO_SWING)) {
|
|
||||||
result = getBackend().checkSwing(player, block);
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.NO_SWING);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.LONG_REACH)) {
|
|
||||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
|
||||||
result = getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.LONG_REACH);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
result = IllegalInteract.performCheck(player, event);
|
result = IllegalInteract.performCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||||
noHack = false;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
@@ -37,8 +38,6 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.CriticalsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
|
||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
public class EntityListener extends EventListener {
|
public class EntityListener extends EventListener {
|
||||||
@@ -51,7 +50,7 @@ public class EntityListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkFastBow(player, event.getForce());
|
CheckResult result = getBackend().checkFastBow(player, event.getForce());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_BOW);
|
log(result.getMessage(), player, CheckType.FAST_BOW, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,7 @@ public class EntityListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkFastHeal(player);
|
CheckResult result = getBackend().checkFastHeal(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_HEAL);
|
log(result.getMessage(), player, CheckType.FAST_HEAL, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
getBackend().logHeal(player);
|
getBackend().logHeal(player);
|
||||||
@@ -89,7 +88,7 @@ public class EntityListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkFastEat(player);
|
CheckResult result = getBackend().checkFastEat(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_EAT);
|
log(result.getMessage(), player, CheckType.FAST_EAT, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
@@ -111,21 +110,11 @@ public class EntityListener extends EventListener {
|
|||||||
}
|
}
|
||||||
if (event.getEntity() instanceof Player) {
|
if (event.getEntity() instanceof Player) {
|
||||||
Player player = (Player) event.getEntity();
|
Player player = (Player) event.getEntity();
|
||||||
VelocityCheck.runCheck(e, player);
|
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player) {
|
||||||
Player p = (Player) e.getDamager();
|
Player p = (Player) e.getDamager();
|
||||||
getBackend().logDamage(p, 1);
|
getBackend().logDamage(p, 1);
|
||||||
int value = VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
int value = VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.KNOCKBACK) ? 2 : 1;
|
||||||
getBackend().logDamage(player, value);
|
getBackend().logDamage(player, value);
|
||||||
if (getCheckManager().willCheck(p, CheckType.LONG_REACH)) {
|
|
||||||
Distance distance = new Distance(player.getLocation(), p.getLocation());
|
|
||||||
CheckResult result = getBackend().checkLongReachDamage(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), p, CheckType.LONG_REACH);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (e.getDamager() instanceof TNTPrimed || e.getDamager() instanceof Creeper) {
|
if (e.getDamager() instanceof TNTPrimed || e.getDamager() instanceof Creeper) {
|
||||||
getBackend().logDamage(player, 3);
|
getBackend().logDamage(player, 3);
|
||||||
@@ -134,30 +123,29 @@ public class EntityListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||||
Player player = (Player) e.getDamager();
|
Player player = (Player) e.getDamager();
|
||||||
getBackend().logDamage(player, 1);
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.AUTOTOOL)) {
|
|
||||||
CheckResult result = getBackend().checkAutoTool(player);
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.AUTOTOOL);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
|
||||||
CheckResult result = getBackend().checkSprintDamage(player);
|
|
||||||
if (result.failed()) {
|
|
||||||
event.setCancelled(!silentMode());
|
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
|
||||||
noHack = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
noHack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
|
noHack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
CheckResult result = KillAuraCheck.checkPacketOrder(player, event.getEntity());
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA, result.getSubCheck());
|
||||||
noHack = false;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.event;
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -48,7 +47,7 @@ public class EventListener implements Listener {
|
|||||||
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
|
||||||
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
|
||||||
|
|
||||||
public static void log(String message, Player player, CheckType type) {
|
public static void log(String message, Player player, CheckType type, String subcheck) {
|
||||||
User user = getUserManager().getUser(player.getUniqueId());
|
User user = getUserManager().getUser(player.getUniqueId());
|
||||||
if (user == null)
|
if (user == null)
|
||||||
return;
|
return;
|
||||||
@@ -56,23 +55,26 @@ public class EventListener implements Listener {
|
|||||||
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
|
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
|
||||||
int vlForType = type.getUses(player.getUniqueId()) + 1;
|
int vlForType = type.getUses(player.getUniqueId()) + 1;
|
||||||
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
|
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
|
||||||
|
String prefix = ChatColor.translateAlternateColorCodes('&', CONFIG.getLang().ALERT_PREFIX());
|
||||||
if (message == null || message.equals("")) {
|
if (message == null || message.equals("")) {
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix + player.getName() + " failed "
|
||||||
+ CheckType.getName(type);
|
+ type.getName();
|
||||||
} else {
|
} else {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix + player.getName() + " failed "
|
||||||
+ CheckType.getName(type) + ChatColor.GOLD + " (x" + vlForType + ")";
|
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix + player.getName() + " failed "
|
||||||
+ CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
+ type.getName() + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
|
||||||
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
||||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||||
} else {
|
} else {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed "
|
message = prefix
|
||||||
+ CheckType.getName(type) + ChatColor.GOLD + " (x" + vlForType + ")" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
|
+ player.getName() + " failed " + type.getName() + ChatColor.GOLD + " (x" + vlForType + ")"
|
||||||
|
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY
|
||||||
|
+ (subcheck != null ? ("type: " + subcheck.toLowerCase() + ", ") : "") + "ping: " + user.getPing() + "ms"
|
||||||
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class InventoryListener extends EventListener {
|
|||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FAST_INVENTORY);
|
log(result.getMessage(), player, CheckType.FAST_INVENTORY, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,12 +46,10 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleCollisionEvent;
|
|
||||||
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -60,14 +58,16 @@ import org.bukkit.inventory.PlayerInventory;
|
|||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.BoatFlyCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.StrafeCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
|
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
@@ -79,14 +79,15 @@ public class PlayerListener extends EventListener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (getCheckManager().willCheck(player, CheckType.COMMAND_SPAM) && !Permission.getCommandExempt(player, event.getMessage().split(" ")[0])) {
|
if (getCheckManager().willCheck(player, CheckType.COMMAND_SPAM)
|
||||||
|
&& !Permission.getCommandExempt(player, event.getMessage().split(" ")[0])) {
|
||||||
CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
|
CheckResult result = getBackend().checkCommandSpam(player, event.getMessage());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
if (!silentMode())
|
if (!silentMode())
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
|
||||||
getBackend().processCommandSpammer(player);
|
getBackend().processCommandSpammer(player);
|
||||||
log(null, player, CheckType.COMMAND_SPAM);
|
log(null, player, CheckType.COMMAND_SPAM, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +125,7 @@ public class PlayerListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkProjectile(player);
|
CheckResult result = getBackend().checkProjectile(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.FAST_PROJECTILE);
|
log(result.getMessage(), player, CheckType.FAST_PROJECTILE, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,10 +135,7 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
if (event.getCause() == TeleportCause.ENDER_PEARL || event.getCause() == TeleportCause.PLUGIN) {
|
|
||||||
getBackend().logTeleport(event.getPlayer());
|
getBackend().logTeleport(event.getPlayer());
|
||||||
}
|
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +154,7 @@ public class PlayerListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkSneakToggle(player);
|
CheckResult result = getBackend().checkSneakToggle(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.SNEAK);
|
log(result.getMessage(), player, CheckType.SNEAK, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// getBackend().logToggleSneak(event.getPlayer());
|
// getBackend().logToggleSneak(event.getPlayer());
|
||||||
@@ -176,6 +174,15 @@ public class PlayerListener extends EventListener {
|
|||||||
getBackend().logVelocity(player);
|
getBackend().logVelocity(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Part of Velocity check
|
||||||
|
User user = AntiCheatReloaded.getManager().getUserManager()
|
||||||
|
.getUser(event.getPlayer().getUniqueId());
|
||||||
|
if (!user.getMovementManager().onGround)
|
||||||
|
return;
|
||||||
|
double motionY = event.getVelocity().getY();
|
||||||
|
user.getMovementManager().velocityExpectedMotionY = motionY;
|
||||||
|
// End part of Velocity check
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +201,7 @@ public class PlayerListener extends EventListener {
|
|||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
log(null, player, CheckType.CHAT_SPAM);
|
log(null, player, CheckType.CHAT_SPAM, result.getSubCheck());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -208,7 +215,7 @@ public class PlayerListener extends EventListener {
|
|||||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
log(null, player, CheckType.CHAT_UNICODE);
|
log(null, player, CheckType.CHAT_UNICODE, result.getSubCheck());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -247,14 +254,11 @@ public class PlayerListener extends EventListener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (!event.isSprinting()) {
|
|
||||||
getBackend().logEnterExit(player);
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
|
||||||
CheckResult result = getBackend().checkSprintHungry(event);
|
CheckResult result = getBackend().checkSprintHungry(event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.SPRINT);
|
log(result.getMessage(), player, CheckType.SPRINT, result.getSubCheck());
|
||||||
} else {
|
} else {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
@@ -272,7 +276,8 @@ public class PlayerListener extends EventListener {
|
|||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (VersionUtil.isBountifulUpdate()) {
|
||||||
itemInHand = VersionUtil.getItemInHand(player);
|
itemInHand = VersionUtil.getItemInHand(player);
|
||||||
} else {
|
} else {
|
||||||
itemInHand = ((event.getHand() == EquipmentSlot.HAND) ? inv.getItemInMainHand() : inv.getItemInOffHand());
|
itemInHand = ((event.getHand() == EquipmentSlot.HAND) ? inv.getItemInMainHand()
|
||||||
|
: inv.getItemInOffHand());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemInHand.getType() == Material.BOW) {
|
if (itemInHand.getType() == Material.BOW) {
|
||||||
@@ -291,11 +296,17 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Block block = event.getClickedBlock();
|
|
||||||
|
|
||||||
if (block != null) {
|
Block block = event.getClickedBlock();
|
||||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
if (block != null
|
||||||
getBackend().checkLongReachBlock(player, distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
&& (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||||
|
CheckResult result = IllegalInteract.performCheck(player, event);
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
@@ -308,7 +319,7 @@ public class PlayerListener extends EventListener {
|
|||||||
CheckResult result = getBackend().checkFastDrop(player);
|
CheckResult result = getBackend().checkFastDrop(player);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
event.setCancelled(!silentMode());
|
event.setCancelled(!silentMode());
|
||||||
log(result.getMessage(), player, CheckType.ITEM_SPAM);
|
log(result.getMessage(), player, CheckType.ITEM_SPAM, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +328,8 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
||||||
if (event.getBed().getType().name().endsWith("BED")) return;
|
if (event.getBed().getType().name().endsWith("BED"))
|
||||||
|
return;
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
@@ -325,7 +337,8 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
||||||
if (event.getBed().getType().name().endsWith("BED")) return;
|
if (event.getBed().getType().name().endsWith("BED"))
|
||||||
|
return;
|
||||||
getBackend().logEnterExit(event.getPlayer());
|
getBackend().logEnterExit(event.getPlayer());
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
@@ -349,7 +362,10 @@ public class PlayerListener extends EventListener {
|
|||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
|
||||||
if (player.hasPermission("anticheat.admin") && !AntiCheatReloaded.getUpdateManager().isLatest()) {
|
if (player.hasPermission("anticheat.admin") && !AntiCheatReloaded.getUpdateManager().isLatest()) {
|
||||||
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + "Your version of AntiCheatReloaded is outdated! You can download " + AntiCheatReloaded.getUpdateManager().getLatestVersion() + " from the Spigot forums or DevBukkit.");
|
player.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY
|
||||||
|
+ "Your version of AntiCheatReloaded is outdated! You can download "
|
||||||
|
+ AntiCheatReloaded.getUpdateManager().getLatestVersion()
|
||||||
|
+ " from the Spigot forums or DevBukkit.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,10 +378,10 @@ public class PlayerListener extends EventListener {
|
|||||||
|
|
||||||
final Distance distance = new Distance(from, to);
|
final Distance distance = new Distance(from, to);
|
||||||
final double y = distance.getYDifference();
|
final double y = distance.getYDifference();
|
||||||
getBackend().logAscension(player, from.getY(), to.getY());
|
|
||||||
|
|
||||||
final User user = getUserManager().getUser(player.getUniqueId());
|
final User user = getUserManager().getUser(player.getUniqueId());
|
||||||
user.setTo(to.getX(), to.getY(), to.getZ());
|
user.setTo(to.getX(), to.getY(), to.getZ());
|
||||||
|
user.getMovementManager().handle(player, from, to, distance);
|
||||||
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
||||||
CheckResult result = FlightCheck.runCheck(player, distance);
|
CheckResult result = FlightCheck.runCheck(player, distance);
|
||||||
@@ -373,27 +389,33 @@ public class PlayerListener extends EventListener {
|
|||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
log(result.getMessage(), player, CheckType.FLIGHT, result.getSubCheck());
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FLIGHT) && !VersionUtil.isFlying(player)) {
|
|
||||||
CheckResult result = GlideCheck.runCheck(player, distance);
|
|
||||||
if (result.failed()) {
|
|
||||||
log(result.getMessage(), player, CheckType.FLIGHT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.ELYTRAFLY)) {
|
||||||
CheckResult result = ElytraCheck.runCheck(player, distance);
|
CheckResult result = ElytraCheck.runCheck(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.ELYTRAFLY);
|
log(result.getMessage(), player, CheckType.ELYTRAFLY, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP) && event.getFrom().getY() > event.getTo().getY()) {
|
if (getCheckManager().willCheckQuick(player, CheckType.BOATFLY)) {
|
||||||
|
CheckResult result = BoatFlyCheck.runCheck(player, user.getMovementManager(), to);
|
||||||
|
if (result.failed()) {
|
||||||
|
if (!silentMode()) {
|
||||||
|
player.eject();
|
||||||
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
|
}
|
||||||
|
log(result.getMessage(), player, CheckType.BOATFLY, result.getSubCheck());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.VCLIP)
|
||||||
|
&& event.getFrom().getY() > event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkVClip(player, new Distance(event.getFrom(), event.getTo()));
|
CheckResult result = getBackend().checkVClip(player, new Distance(event.getFrom(), event.getTo()));
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
int data = result.getData() > 3 ? 3 : result.getData();
|
int data = result.getData() > 3 ? 3 : result.getData();
|
||||||
Location newloc = new Location(player.getWorld(), event.getFrom().getX(), event.getFrom().getY() + data, event.getFrom().getZ());
|
Location newloc = new Location(player.getWorld(), event.getFrom().getX(),
|
||||||
|
event.getFrom().getY() + data, event.getFrom().getZ());
|
||||||
if (newloc.getBlock().getType() == Material.AIR) {
|
if (newloc.getBlock().getType() == Material.AIR) {
|
||||||
event.setTo(newloc);
|
event.setTo(newloc);
|
||||||
} else {
|
} else {
|
||||||
@@ -401,63 +423,53 @@ public class PlayerListener extends EventListener {
|
|||||||
}
|
}
|
||||||
player.damage(3);
|
player.damage(3);
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.VCLIP);
|
log(result.getMessage(), player, CheckType.VCLIP, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL) && getCheckManager().willCheck(player, CheckType.FLIGHT) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY()) {
|
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL)
|
||||||
|
&& getCheckManager().willCheck(player, CheckType.FLIGHT)
|
||||||
|
&& !Utilities.isClimbableBlock(player.getLocation().getBlock())
|
||||||
|
&& event.getFrom().getY() > event.getTo().getY()) {
|
||||||
CheckResult result = getBackend().checkNoFall(player, y);
|
CheckResult result = getBackend().checkNoFall(player, y);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
// TODO better handling of this
|
// TODO better handling of this
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.NOFALL);
|
log(result.getMessage(), player, CheckType.NOFALL, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean changed = false;
|
|
||||||
if (event.getTo() != event.getFrom()) {
|
if (event.getTo() != event.getFrom()) {
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPEED) && getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPEED)
|
||||||
|
&& getCheckManager().willCheck(player, CheckType.FLIGHT)) {
|
||||||
if (event.getFrom().getY() < event.getTo().getY()) {
|
if (event.getFrom().getY() < event.getTo().getY()) {
|
||||||
CheckResult result = SpeedCheck.checkYSpeed(player, distance);
|
CheckResult result = SpeedCheck.checkVerticalSpeed(player, distance);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z);
|
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPEED);
|
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
|
||||||
CheckResult result = WaterWalkCheck.runCheck(player, x, y, z);
|
CheckResult result = WaterWalkCheck.runCheck(player, x, y, z);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
player.teleport(user.getGoodLocation(player.getLocation().add(0, -1.5, 0)));
|
// TODO check this
|
||||||
|
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.WATER_WALK);
|
log(result.getMessage(), player, CheckType.WATER_WALK, result.getSubCheck());
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SNEAK)) {
|
|
||||||
CheckResult result = getBackend().checkSneak(player, event.getTo(), x, z);
|
|
||||||
if (result.failed()) {
|
|
||||||
if (!silentMode()) {
|
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
|
||||||
player.setSneaking(false);
|
|
||||||
}
|
|
||||||
log(result.getMessage(), player, CheckType.SNEAK);
|
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
|
||||||
@@ -466,29 +478,40 @@ public class PlayerListener extends EventListener {
|
|||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.SPIDER);
|
log(result.getMessage(), player, CheckType.SPIDER, result.getSubCheck());
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
|
||||||
// Does not use y value created before because that value is absolute
|
// Does not use y value created before because that value is absolute
|
||||||
CheckResult result = FastLadderCheck.runCheck(player, event.getTo().getY() - event.getFrom().getY());
|
CheckResult result = FastLadderCheck.runCheck(player,
|
||||||
|
event.getTo().getY() - event.getFrom().getY());
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
if (!silentMode()) {
|
if (!silentMode()) {
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
}
|
}
|
||||||
log(result.getMessage(), player, CheckType.FASTLADDER);
|
log(result.getMessage(), player, CheckType.FASTLADDER, result.getSubCheck());
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!changed) {
|
if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) {
|
||||||
user.setGoodLocation(event.getFrom());
|
CheckResult result = StrafeCheck.runCheck(player, x, z, event.getFrom(), event.getTo());
|
||||||
|
if (result.failed()) {
|
||||||
|
if (!silentMode()) {
|
||||||
|
event.setTo(user.getGoodLocation(from.clone()));
|
||||||
|
}
|
||||||
|
log(result.getMessage(), player, CheckType.STRAFE, result.getSubCheck());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
if (getCheckManager().willCheckQuick(player, CheckType.AIMBOT)) {
|
||||||
CheckResult result = AimbotCheck.runCheck(player, event);
|
CheckResult result = AimbotCheck.runCheck(player, event);
|
||||||
if (result.failed()) {
|
if (result.failed()) {
|
||||||
log(result.getMessage(), player, CheckType.AIMBOT);
|
log(result.getMessage(), player, CheckType.AIMBOT, result.getSubCheck());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getCheckManager().willCheckQuick(player, CheckType.VELOCITY)) {
|
||||||
|
CheckResult result = VelocityCheck.runCheck(player, distance);
|
||||||
|
if (result.failed()) {
|
||||||
|
log(result.getMessage(), player, CheckType.VELOCITY, result.getSubCheck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,34 +519,9 @@ public class PlayerListener extends EventListener {
|
|||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority=EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onRespawn(PlayerRespawnEvent event) {
|
public void onRespawn(PlayerRespawnEvent event) {
|
||||||
getBackend().logTeleport(event.getPlayer());
|
getBackend().logTeleport(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void checkFly(PlayerMoveEvent event) {
|
|
||||||
// Check flight on highest to make sure other plugins have a chance to change the values first.
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final User user = getUserManager().getUser(player.getUniqueId());
|
|
||||||
final Location from = event.getFrom();
|
|
||||||
final Location to = event.getTo();
|
|
||||||
|
|
||||||
if (!user.checkTo(to.getX(), to.getY(), to.getZ())) {
|
|
||||||
// The to value has been modified by another plugin
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getCheckManager().willCheck(player, CheckType.FLIGHT) && !player.isFlying()) {
|
|
||||||
CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to));
|
|
||||||
CheckResult result2 = FlightCheck.checkAscension(player, from.getY(), to.getY());
|
|
||||||
String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : "";
|
|
||||||
if (!log.equals("")) {
|
|
||||||
if (!silentMode()) {
|
|
||||||
event.setTo(user.getGoodLocation(from.clone()));
|
|
||||||
}
|
|
||||||
log(log, player, CheckType.FLIGHT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
|
public class PotionEffectListener extends EventListener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityPotionEffect(EntityPotionEffectEvent event) {
|
||||||
|
if (!(event.getEntity() instanceof Player))
|
||||||
|
return;
|
||||||
|
if (event.getNewEffect() == null)
|
||||||
|
return;
|
||||||
|
if (!VersionUtil.isLevitationEffect(event.getNewEffect()))
|
||||||
|
return;
|
||||||
|
getBackend().logLevitating((Player) event.getEntity(), event.getNewEffect().getDuration());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
@@ -46,14 +47,20 @@ public class CheckManager {
|
|||||||
public CheckManager(AntiCheatManager manager) {
|
public CheckManager(AntiCheatManager manager) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.config = manager.getConfiguration();
|
this.config = manager.getConfiguration();
|
||||||
|
this.loadCheckIgnoreList(this.config);
|
||||||
|
}
|
||||||
|
|
||||||
for (String string : config.getConfig().disabledChecks.getValue()) {
|
public void loadCheckIgnoreList(Configuration configuration) {
|
||||||
|
checkIgnoreList.clear();
|
||||||
for (CheckType type : CheckType.values()) {
|
for (CheckType type : CheckType.values()) {
|
||||||
if (type.toString().equalsIgnoreCase(string)) {
|
if (!configuration.getChecks().isEnabled(type)) {
|
||||||
checkIgnoreList.add(type);
|
checkIgnoreList.add(type);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!checkIgnoreList.isEmpty()) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY
|
||||||
|
+ checkIgnoreList.size() + " check(s) have been disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public class LoggingManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void logToPlayers(String message) {
|
public void logToPlayers(String message) {
|
||||||
|
if(config.getConfig().disableBroadcast.getValue()) return;
|
||||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (Permission.SYSTEM_NOTICE.get(player)) {
|
if (Permission.SYSTEM_NOTICE.get(player)) {
|
||||||
player.sendMessage(message);
|
player.sendMessage(message);
|
||||||
@@ -96,7 +97,7 @@ public class LoggingManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logToLogs(String message) { // Yo dawg
|
private void logToLogs(String message) { // Yo dawg, you like logs?
|
||||||
logs.add(ChatColor.stripColor(message));
|
logs.add(ChatColor.stripColor(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ public class UserManager {
|
|||||||
} else if (event.equalsIgnoreCase("KICK")) {
|
} else if (event.equalsIgnoreCase("KICK")) {
|
||||||
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', kickReason));
|
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', kickReason));
|
||||||
AntiCheatReloaded.getPlugin().onPlayerKicked();
|
AntiCheatReloaded.getPlugin().onPlayerKicked();
|
||||||
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().KICK_BROADCAST().replaceAll("%player%", name) + " (" + CheckType.getName(type) + ")");
|
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().KICK_BROADCAST().replaceAll("%player%", name) + " (" + type.getName() + ")");
|
||||||
if (!msg.equals("")) {
|
if (!msg.equals("")) {
|
||||||
manager.log(msg);
|
manager.log(msg);
|
||||||
manager.playerLog(msg);
|
manager.playerLog(msg);
|
||||||
@@ -224,7 +224,7 @@ public class UserManager {
|
|||||||
} else if (event.equalsIgnoreCase("BAN")) {
|
} else if (event.equalsIgnoreCase("BAN")) {
|
||||||
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), ChatColor.translateAlternateColorCodes('&', banReason), null, null);
|
Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), ChatColor.translateAlternateColorCodes('&', banReason), null, null);
|
||||||
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', banReason));
|
user.getPlayer().kickPlayer(ChatColor.translateAlternateColorCodes('&', banReason));
|
||||||
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().BAN_BROADCAST().replaceAll("%player%", name) + " (" + CheckType.getName(type) + ")");
|
String msg = ChatColor.translateAlternateColorCodes('&', config.getLang().BAN_BROADCAST().replaceAll("%player%", name) + " (" + type.getName() + ")");
|
||||||
if (!msg.equals("")) {
|
if (!msg.equals("")) {
|
||||||
manager.log(msg);
|
manager.log(msg);
|
||||||
manager.playerLog(msg);
|
manager.playerLog(msg);
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* AntiCheatReloaded for Bukkit and Spigot.
|
|
||||||
* Copyright (c) 2012-2015 AntiCheat Team
|
|
||||||
* Copyright (c) 2016-2020 Rammelkast
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
public enum BlockHardness {
|
|
||||||
STONE(1.50D), GRASS(0.60D), DIRT(0.50D), COBBLESTONE(2.00D), WOOD(2.00D), SAPLING(0.00D), WATER(100.00D),
|
|
||||||
STATIONARY_WATER(100.00D), LAVA(0.00D), STATIONARY_LAVA(100.00D), SAND(0.50D), GRAVEL(0.60D), GOLD_ORE(3.00D),
|
|
||||||
IRON_ORE(3.00D), COAL_ORE(3.00D), LOG(2.00D), LOG_2(2.00D), LEAVES(0.20D), LEAVES_2(0.20D), SPONGE(0.60D),
|
|
||||||
GLASS(0.30D), LAPIS_ORE(3.00D), LAPIS_BLOCK(3.00D), DISPENSER(3.50D), DROPPER(3.50D), SANDSTONE(0.80D),
|
|
||||||
NOTE_BLOCK(0.80D), BED(0.20D), RAILS(0.70D), DETECTOR_RAIL(0.70D), POWERED_RAIL(0.70D), ACTIVATOR_RAIL(0.70D),
|
|
||||||
WEB(4.00D), LONG_GRASS(0.00D), DOUBLE_PLANT(0.00D), DEAD_BUSH(0.00D), WOOL(0.80D), YELLOW_FLOWER(0.00D),
|
|
||||||
RED_ROSE(0.00D), BROWN_MUSHROOM(0.00D), RED_MUSHROOM(0.00D), GOLD_BLOCK(3.00D), IRON_BLOCK(5.00D),
|
|
||||||
DOUBLE_STEP(2.00D), STEP(2.00D), BRICK(2.00D), TNT(0.00D), BOOKSHELF(1.50D), MOSSY_COBBLESTONE(2.00D),
|
|
||||||
OBSIDIAN(50.00D), TORCH(0.00D), FIRE(0.00D), MOB_SPAWNER(5.00D), CHEST(2.50D), TRAPPED_CHEST(2.50D),
|
|
||||||
REDSTONE_WIRE(0.00D), DIAMOND_ORE(3.00D), DIAMOND_BLOCK(5.00D), WORKBENCH(2.50D), SOIL(0.60D), FURNACE(3.50D),
|
|
||||||
BURNING_FURNACE(3.50D), WOODEN_DOOR(3.00D), LADDER(0.40D), LEVER(0.50D), IRON_DOOR_BLOCK(5.00D), HOPPER(2.00D),
|
|
||||||
STONE_PLATE(0.50D), WOOD_PLATE(0.50D), GOLD_PLATE(0.50D), IRON_PLATE(0.50D), QUARTZ_BLOCK(0.80D), QUARTZ_ORE(3.00D),
|
|
||||||
REDSTONE_BLOCK(5.00D), REDSTONE_ORE(3.00D), GLOWING_REDSTONE_ORE(3.00D), REDSTONE_TORCH_OFF(0.00D),
|
|
||||||
REDSTONE_TORCH_ON(0.00D), REDSTONE_COMPARATOR_OFF(0.00D), REDSTONE_COMPARATOR_ON(0.00D), DAYLIGHT_DETECTOR(0.20D),
|
|
||||||
STONE_BUTTON(0.50D), SNOW(0.10D), ICE(0.50D), PACKED_ICE(0.50D), SNOW_BLOCK(0.20D), CACTUS(0.40D), CLAY(0.60D),
|
|
||||||
HARD_CLAY(1.25D), STAINED_CLAY(1.25D), SUGAR_CANE_BLOCK(0.00D), JUKEBOX(2.00D), FENCE(2.00D), NETHERRACK(0.40D),
|
|
||||||
SOUL_SAND(0.50D), GLOWSTONE(0.30D), PORTAL(-1.00D), CAKE_BLOCK(0.50D), LOCKED_CHEST(0.00D), TRAP_DOOR(3.00D),
|
|
||||||
MONSTER_EGGS(0.750D), SMOOTH_BRICK(1.50D), IRON_FENCE(5.00D), THIN_GLASS(0.30D), STAINED_GLASS(0.30D),
|
|
||||||
STAINED_GLASS_PANE(0.30D), PUMPKIN_STEM(0.00D), MELON_STEM(0.00D), VINE(0.20D), FENCE_GATE(2.00D), MYCEL(0.60D),
|
|
||||||
WATER_LILY(0.00D), NETHER_BRICK(2.00D), NETHER_FENCE(2.00D), ENCHANTMENT_TABLE(5.00D), BREWING_STAND(0.50D),
|
|
||||||
CAULDRON(2.00D), ENDER_PORTAL(-1.00D), ENDER_PORTAL_FRAME(-1.00D), DRAGON_EGG(3.00D), REDSTONE_LAMP_OFF(0.30D),
|
|
||||||
REDSTONE_LAMP_ON(0.30D), WOOD_DOUBLE_STEP(2.00D), WOOD_STEP(2.00D), COCOA(0.20D), EMERALD_ORE(3.00D),
|
|
||||||
ENDER_CHEST(22.50D), EMERALD_BLOCK(5.00D), FLOWER_POT(0.00D), WOOD_BUTTON(0.50D), ANVIL(5.00D),
|
|
||||||
HUGE_MUSHROOM_1(0.20D), HUGE_MUSHROOM_2(0.20D), BED_BLOCK(0.20D), WOOD_STAIRS(2.00D), COBBLESTONE_STAIRS(2.00D),
|
|
||||||
BRICK_STAIRS(2.00D), SMOOTH_STAIRS(1.50D), NETHER_BRICK_STAIRS(2.00D), SPRUCE_WOOD_STAIRS(2.00D),
|
|
||||||
BIRCH_WOOD_STAIRS(2.00D), JUNGLE_WOOD_STAIRS(2.00D), DARK_OAK_STAIRS(2.00D), ACACIA_STAIRS(2.00D),
|
|
||||||
QUARTZ_STAIRS(0.80D), SANDSTONE_STAIRS(0.80D), COMMAND(0.00D), BEACON(3.00D), COBBLE_WALL(2.00D), CROPS(0.00D),
|
|
||||||
CARROT(0.00D), POTATO(0.00D), SKULL(1.00D), NETHER_WARTS(0.00D), SIGN_POST(1.00D), WALL_SIGN(1.00D), PUMPKIN(1.00D),
|
|
||||||
JACK_O_LANTERN(1.00D), DIODE_BLOCK_ON(0.00D), DIODE_BLOCK_OFF(0.00D), MELON_BLOCK(1.00D), ENDER_STONE(3.00D),
|
|
||||||
TRIPWIRE(0.00D), TRIPWIRE_HOOK(0.00D), HAY_BLOCK(0.50D), CARPET(0.10D), COAL_BLOCK(5.00D), PISTON_BASE(0.70D),
|
|
||||||
PISTON_EXTENSION(0.70D), PISTON_MOVING_PIECE(0.70D), PISTON_STICKY_BASE(0.70D);
|
|
||||||
|
|
||||||
Material mat;
|
|
||||||
double hardness;
|
|
||||||
|
|
||||||
BlockHardness(double hard) {
|
|
||||||
mat = Material.getMaterial(name());
|
|
||||||
hardness = hard;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getBlockHardness(Material m) {
|
|
||||||
try {
|
|
||||||
BlockHardness h = getHardness(m);
|
|
||||||
return h == null ? 0D : h.hardness;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return 0D;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hasBlockHardness(Material m) {
|
|
||||||
return getHardness(m) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockHardness getHardness(Material m) {
|
|
||||||
for (BlockHardness e : BlockHardness.values()) {
|
|
||||||
if (e.mat.equals(m)) {
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,6 +44,18 @@ public class Distance {
|
|||||||
this.to = to;
|
this.to = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Distance() {
|
||||||
|
l1Y = 0;
|
||||||
|
l2Y = 0;
|
||||||
|
|
||||||
|
XDiff = 0;
|
||||||
|
ZDiff = 0;
|
||||||
|
YDiff = 0;
|
||||||
|
|
||||||
|
this.from = null;
|
||||||
|
this.to = null;
|
||||||
|
}
|
||||||
|
|
||||||
public double fromY() {
|
public double fromY() {
|
||||||
return l2Y;
|
return l2Y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,201 @@
|
|||||||
|
/*
|
||||||
|
* AntiCheatReloaded for Bukkit and Spigot.
|
||||||
|
* Copyright (c) 2012-2015 AntiCheat Team
|
||||||
|
* Copyright (c) 2016-2020 Rammelkast
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
|
public class MovementManager {
|
||||||
|
|
||||||
|
// Ticks in air
|
||||||
|
public int airTicks = 0;
|
||||||
|
// Ticks on ground
|
||||||
|
public int groundTicks = 0;
|
||||||
|
// Ticks on ice
|
||||||
|
public int iceTicks = 0;
|
||||||
|
// Ticks on slime
|
||||||
|
public int slimeTicks = 0;
|
||||||
|
// Ticks in air before last grounded moment
|
||||||
|
public int airTicksBeforeGrounded = 0;
|
||||||
|
// Ticks influenced by ice
|
||||||
|
public int iceInfluenceTicks = 0;
|
||||||
|
// Ticks influenced by slime
|
||||||
|
public int slimeInfluenceTicks = 0;
|
||||||
|
// Y motion of the movement
|
||||||
|
public double motionY;
|
||||||
|
// Previous Y motion of the movement
|
||||||
|
public double lastMotionY;
|
||||||
|
// Horizontal distance of movement
|
||||||
|
public double distanceXZ;
|
||||||
|
// Horizontal distance on x-axis of movement
|
||||||
|
public double distanceX;
|
||||||
|
// Horizontal distance on z-axis of movement
|
||||||
|
public double distanceZ;
|
||||||
|
// Previous horizontal distance of movement
|
||||||
|
public double lastDistanceXZ;
|
||||||
|
// Previous horizontal distance on x-axis of movement
|
||||||
|
public double lastDistanceX;
|
||||||
|
// Previous horizontal distance on z-axis of movement
|
||||||
|
public double lastDistanceZ;
|
||||||
|
// If the player touched the ground again this tick
|
||||||
|
public boolean touchedGroundThisTick = false;
|
||||||
|
// Last recorded distance
|
||||||
|
public Distance lastDistance = new Distance();
|
||||||
|
// Movement acceleration
|
||||||
|
public double acceleration;
|
||||||
|
// Is the block above solid
|
||||||
|
public boolean topSolid;
|
||||||
|
// Is the block below solid
|
||||||
|
public boolean bottomSolid;
|
||||||
|
// If the current movement is up a slab or stair
|
||||||
|
public boolean halfMovement;
|
||||||
|
// If the player is on the ground (determined clientside!)
|
||||||
|
public boolean onGround;
|
||||||
|
// Ticks counter for last halfMovement
|
||||||
|
public int halfMovementHistoryCounter = 0;
|
||||||
|
// Time of last teleport
|
||||||
|
public long lastTeleport;
|
||||||
|
// Elytra effect ticks
|
||||||
|
public int elytraEffectTicks;
|
||||||
|
// Used by Velocity check, represents the currently expected Y motion
|
||||||
|
public double velocityExpectedMotionY;
|
||||||
|
// Amount of ticks a player is sneaking
|
||||||
|
public int sneakingTicks;
|
||||||
|
// Ticks counter after being near a liquid
|
||||||
|
public int nearLiquidTicks;
|
||||||
|
// Ticks of player blocking
|
||||||
|
public int blockingTicks;
|
||||||
|
// If the player has a speed effect
|
||||||
|
public boolean hasSpeedEffect = false;
|
||||||
|
// If the player had speed effect previous tick
|
||||||
|
public boolean hadSpeedEffect = false;
|
||||||
|
// Time of last update
|
||||||
|
public long lastUpdate;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public void handle(Player player, Location from, Location to, Distance distance) {
|
||||||
|
// TODO as of now, we "trust" the client to send the right thing
|
||||||
|
// This is checked for spoofing by "GroundFlight"
|
||||||
|
// Also seems to make NoFall cheats flag for speed lmao
|
||||||
|
this.onGround = player.isOnGround();
|
||||||
|
|
||||||
|
double x = distance.getXDifference();
|
||||||
|
double z = distance.getZDifference();
|
||||||
|
this.lastDistanceXZ = this.distanceXZ;
|
||||||
|
this.lastDistanceX = this.distanceX;
|
||||||
|
this.lastDistanceZ = this.distanceZ;
|
||||||
|
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||||
|
this.distanceX = x;
|
||||||
|
this.distanceZ = z;
|
||||||
|
|
||||||
|
// Account for standing on boat
|
||||||
|
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
|
||||||
|
this.onGround = true;
|
||||||
|
|
||||||
|
this.touchedGroundThisTick = false;
|
||||||
|
this.halfMovement = false;
|
||||||
|
if (!this.onGround) {
|
||||||
|
this.groundTicks = 0;
|
||||||
|
this.airTicks++;
|
||||||
|
} else {
|
||||||
|
if (this.airTicks > 0)
|
||||||
|
this.touchedGroundThisTick = true;
|
||||||
|
this.airTicksBeforeGrounded = this.airTicks;
|
||||||
|
this.airTicks = 0;
|
||||||
|
this.groundTicks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utilities.couldBeOnIce(to)) {
|
||||||
|
this.iceTicks++;
|
||||||
|
this.iceInfluenceTicks = 60;
|
||||||
|
} else {
|
||||||
|
this.iceTicks = 0;
|
||||||
|
if (this.iceInfluenceTicks > 0)
|
||||||
|
this.iceInfluenceTicks--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utilities.couldBeOnSlime(to)) {
|
||||||
|
this.slimeTicks++;
|
||||||
|
this.slimeInfluenceTicks = 40;
|
||||||
|
} else {
|
||||||
|
this.slimeTicks = 0;
|
||||||
|
if (this.slimeInfluenceTicks > 0)
|
||||||
|
this.slimeInfluenceTicks--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VersionUtil.isGliding(player)) {
|
||||||
|
this.elytraEffectTicks = 30;
|
||||||
|
} else {
|
||||||
|
if (this.elytraEffectTicks > 0)
|
||||||
|
this.elytraEffectTicks--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.isSneaking())
|
||||||
|
this.sneakingTicks++;
|
||||||
|
else
|
||||||
|
this.sneakingTicks = 0;
|
||||||
|
|
||||||
|
if (player.isBlocking())
|
||||||
|
this.blockingTicks++;
|
||||||
|
else
|
||||||
|
this.blockingTicks = 0;
|
||||||
|
|
||||||
|
if (Utilities.isNearWater(player))
|
||||||
|
this.nearLiquidTicks = 8;
|
||||||
|
else {
|
||||||
|
if (this.nearLiquidTicks > 0)
|
||||||
|
this.nearLiquidTicks--;
|
||||||
|
else
|
||||||
|
this.nearLiquidTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hadSpeedEffect = this.hasSpeedEffect;
|
||||||
|
this.hasSpeedEffect = player.hasPotionEffect(PotionEffectType.SPEED);
|
||||||
|
|
||||||
|
double lastDistanceSq = Math.sqrt(this.lastDistance.getXDifference() * this.lastDistance.getXDifference()
|
||||||
|
+ this.lastDistance.getZDifference() * this.lastDistance.getZDifference());
|
||||||
|
double currentDistanceSq = Math.sqrt(distance.getXDifference() * distance.getXDifference()
|
||||||
|
+ distance.getZDifference() * distance.getZDifference());
|
||||||
|
this.acceleration = currentDistanceSq - lastDistanceSq;
|
||||||
|
|
||||||
|
this.lastMotionY = this.motionY;
|
||||||
|
this.motionY = to.getY() - from.getY();
|
||||||
|
|
||||||
|
Location top = to.clone().add(0, 2, 0);
|
||||||
|
this.topSolid = top.getBlock().getType().isSolid();
|
||||||
|
Location bottom = to.clone().add(0, -1, 0);
|
||||||
|
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
||||||
|
|
||||||
|
if ((this.motionY > 0.42D && this.motionY <= 0.5625D)
|
||||||
|
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||||
|
this.halfMovement = true;
|
||||||
|
this.halfMovementHistoryCounter = 30;
|
||||||
|
} else {
|
||||||
|
if (this.halfMovementHistoryCounter > 0)
|
||||||
|
this.halfMovementHistoryCounter--;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastUpdate = System.currentTimeMillis();
|
||||||
|
// Update "good location"
|
||||||
|
AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId()).setGoodLocation(from);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,10 @@ import com.comphenix.protocol.PacketType;
|
|||||||
import com.comphenix.protocol.events.ListenerPriority;
|
import com.comphenix.protocol.events.ListenerPriority;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
|
import com.comphenix.protocol.injector.server.TemporaryPlayer;
|
||||||
|
import com.comphenix.protocol.wrappers.EnumWrappers.PlayerDigType;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
|
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
|
||||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||||
|
|
||||||
@@ -33,10 +36,13 @@ public class PacketListener {
|
|||||||
public static void listenMovementPackets() {
|
public static void listenMovementPackets() {
|
||||||
AntiCheatReloaded.getProtocolManager()
|
AntiCheatReloaded.getProtocolManager()
|
||||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK}) {
|
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK,
|
||||||
|
PacketType.Play.Server.POSITION }) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
if (player == null || !player.isOnline())
|
||||||
|
return;
|
||||||
|
|
||||||
// Run MorePackets check
|
// Run MorePackets check
|
||||||
MorePacketsCheck.runCheck(player, event);
|
MorePacketsCheck.runCheck(player, event);
|
||||||
@@ -50,7 +56,9 @@ public class PacketListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
// Check if we have an actual player object
|
||||||
|
if (player instanceof TemporaryPlayer)
|
||||||
|
return;
|
||||||
// Compensate for teleport
|
// Compensate for teleport
|
||||||
MorePacketsCheck.compensate(player);
|
MorePacketsCheck.compensate(player);
|
||||||
}
|
}
|
||||||
@@ -63,16 +71,29 @@ public class PacketListener {
|
|||||||
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
|
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(event.getPlayer().getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager()
|
||||||
|
.getUser(event.getPlayer().getUniqueId());
|
||||||
user.onServerPing();
|
user.onServerPing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(event.getPlayer().getUniqueId());
|
User user = AntiCheatReloaded.getManager().getUserManager()
|
||||||
|
.getUser(event.getPlayer().getUniqueId());
|
||||||
user.onClientPong();
|
user.onClientPong();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void listenUseItemPackets() {
|
||||||
|
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(),
|
||||||
|
ListenerPriority.LOWEST, new PacketType[] { PacketType.Play.Client.BLOCK_DIG }) {
|
||||||
|
@Override
|
||||||
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
|
if (event.getPacket().getPlayerDigTypes().read(0) == PlayerDigType.RELEASE_USE_ITEM)
|
||||||
|
NoSlowCheck.runCheck(event.getPlayer(), event);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,13 +23,15 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
public enum Permission {
|
public enum Permission {
|
||||||
/* Check Nodes */
|
/* Check Nodes */
|
||||||
CHECK_FLIGHT, CHECK_ELYTRAFLY, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
CHECK_FLIGHT, CHECK_ELYTRAFLY, CHECK_WATERWALK, CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT,
|
||||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL,
|
||||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
CHECK_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
|
||||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER, CHECK_AIMBOT,
|
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
|
||||||
|
CHECK_AIMBOT, CHECK_STRAFE, CHECK_NOSLOW, CHECK_BOATFLY,
|
||||||
|
|
||||||
/* System Nodes */
|
/* System Nodes */
|
||||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD, SYSTEM_MUTE;
|
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
|
||||||
|
SYSTEM_MUTE;
|
||||||
|
|
||||||
private static final String PERMISSION_ALL = "anticheat.*";
|
private static final String PERMISSION_ALL = "anticheat.*";
|
||||||
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
||||||
|
|||||||
@@ -33,11 +33,15 @@ public class UpdateManager {
|
|||||||
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
|
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
|
||||||
+ RESOURCE_ID;
|
+ RESOURCE_ID;
|
||||||
|
|
||||||
private final String latestVersion;
|
private String latestVersion;
|
||||||
private final boolean isLatest;
|
private boolean isLatest;
|
||||||
private final boolean isAhead;
|
private boolean isAhead;
|
||||||
|
|
||||||
public UpdateManager() {
|
public UpdateManager() {
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
this.latestVersion = this.getOnlineData(SPIGOT_VERSION_URL);
|
this.latestVersion = this.getOnlineData(SPIGOT_VERSION_URL);
|
||||||
if (this.latestVersion == null) {
|
if (this.latestVersion == null) {
|
||||||
this.isLatest = true;
|
this.isLatest = true;
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -30,11 +35,6 @@ import com.rammelkast.anticheatreloaded.check.CheckType;
|
|||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.util.rule.Rule;
|
import com.rammelkast.anticheatreloaded.util.rule.Rule;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
private final String name;
|
private final String name;
|
||||||
@@ -56,6 +56,8 @@ public class User {
|
|||||||
private int ping = -1;
|
private int ping = -1;
|
||||||
private int lastPing = -1;
|
private int lastPing = -1;
|
||||||
|
|
||||||
|
private MovementManager movementManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize an AntiCheat user
|
* Initialize an AntiCheat user
|
||||||
*
|
*
|
||||||
@@ -65,6 +67,8 @@ public class User {
|
|||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
|
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
|
||||||
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
|
||||||
|
this.movementManager = new MovementManager();
|
||||||
|
this.ping = getPlayer() != null && getPlayer().isOnline() ? VersionUtil.getPlayerPing(getPlayer()) : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,11 +218,17 @@ public class User {
|
|||||||
* @return last known valid location
|
* @return last known valid location
|
||||||
*/
|
*/
|
||||||
public Location getGoodLocation(Location location) {
|
public Location getGoodLocation(Location location) {
|
||||||
if (goodLocation == null) {
|
if (goodLocation == null || !location.getWorld().equals(goodLocation.getWorld())
|
||||||
|
|| location.distance(goodLocation) > config.getConfig().maxSetbackDistance.getValue()) {
|
||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
return goodLocation;
|
Location moveTo = goodLocation;
|
||||||
|
if (location != null) {
|
||||||
|
moveTo.setPitch(location.getPitch());
|
||||||
|
moveTo.setYaw(location.getYaw());
|
||||||
|
}
|
||||||
|
return moveTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -228,8 +238,7 @@ public class User {
|
|||||||
* @return true if the location was valid and set properly
|
* @return true if the location was valid and set properly
|
||||||
*/
|
*/
|
||||||
public boolean setGoodLocation(Location location) {
|
public boolean setGoodLocation(Location location) {
|
||||||
if (Utilities.cantStandAtExp(location)
|
if (Utilities.cantStandAtExp(location)) {
|
||||||
|| (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +459,12 @@ public class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLagging() {
|
public boolean isLagging() {
|
||||||
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION();
|
return Math.abs(this.ping - this.lastPing) > config.getMagic().LAG_DETERMINATION()
|
||||||
|
&& this.ping > config.getMagic().LAG_DETERMINATION();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovementManager getMovementManager() {
|
||||||
|
return this.movementManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,17 +37,18 @@ import org.bukkit.entity.Boat;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
|
|
||||||
public final class Utilities {
|
public final class Utilities {
|
||||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||||
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
|
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
|
||||||
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
||||||
|
|
||||||
public static final Material LILY_PAD;
|
public static final double JUMP_MOTION_Y = 0.41999998688697815;
|
||||||
public static final Material COB_WEB;
|
|
||||||
public static final Material IRON_BARS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if only the block beneath them is standable (includes water + lava)
|
* Check if only the block beneath them is standable (includes water + lava)
|
||||||
@@ -114,23 +117,161 @@ public final class Utilities {
|
|||||||
return !(block.isLiquid() || block.getType() == Material.AIR);
|
return !(block.isLiquid() || block.getType() == Material.AIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSlime(Block block) {
|
|
||||||
return block.getType() == Material.SLIME_BLOCK;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isNotNearSlime(Block block) {
|
public static boolean isNotNearSlime(Block block) {
|
||||||
return !isSlime(block.getRelative(BlockFace.NORTH)) && !isSlime(block.getRelative(BlockFace.EAST))
|
return !isSlime(block.getRelative(BlockFace.NORTH)) && !isSlime(block.getRelative(BlockFace.EAST))
|
||||||
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST)) && !isSlime(block.getRelative(BlockFace.DOWN));
|
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST))
|
||||||
|
&& !isSlime(block.getRelative(BlockFace.DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean couldBeOnBoat(Player player) {
|
public static boolean couldBeOnBoat(Player player) {
|
||||||
for (Entity entity : player.getNearbyEntities(0.25, 0.25, 0.25)) {
|
return couldBeOnBoat(player, 0.35, false);
|
||||||
if (entity instanceof Boat)
|
}
|
||||||
|
|
||||||
|
public static boolean couldBeOnBoat(Player player, double range, boolean checkY) {
|
||||||
|
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||||
|
if (entity instanceof Boat) {
|
||||||
|
if (((Boat) entity).getLocation().getY() < player.getLocation().getY() + 0.25) {
|
||||||
|
return true;
|
||||||
|
} else if (!checkY) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a player could be standing on ice
|
||||||
|
*
|
||||||
|
* @param location the location to check
|
||||||
|
* @return true if the player could be standing on ice
|
||||||
|
*/
|
||||||
|
public static boolean couldBeOnIce(Location location) {
|
||||||
|
return isNearIce(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.01D,
|
||||||
|
location.getBlockZ()))
|
||||||
|
|| isNearIce(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.26D,
|
||||||
|
location.getBlockZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a type of ice
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if block is a type of ice
|
||||||
|
*/
|
||||||
|
public static boolean isIce(Block block) {
|
||||||
|
Material type = block.getType();
|
||||||
|
return type.name().endsWith("ICE");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNearIce(Location location) {
|
||||||
|
return isIce(location.getBlock()) || isIce(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||||
|
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a shulker box
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if block is a shulker box
|
||||||
|
*/
|
||||||
|
public static boolean isShulkerBox(Block block) {
|
||||||
|
Material type = block.getType();
|
||||||
|
return type.name().endsWith("SHULKER_BOX");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNearShulkerBox(Location location) {
|
||||||
|
// Shulkers are 1.12+
|
||||||
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.COLOR_UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return isShulkerBox(location.getBlock()) || isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a player could be standing on a halfblock
|
||||||
|
*
|
||||||
|
* @param location the location to check
|
||||||
|
* @return true if the player could be standing on a halfblock
|
||||||
|
*/
|
||||||
|
public static boolean couldBeOnHalfblock(Location location) {
|
||||||
|
return isNearHalfblock(
|
||||||
|
new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getBlockZ()))
|
||||||
|
|| isNearHalfblock(new Location(location.getWorld(), location.getX(), location.getY() - 0.51D,
|
||||||
|
location.getBlockZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNearHalfblock(Location location) {
|
||||||
|
return isHalfblock(location.getBlock()) || isHalfblock(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||||
|
|| isHalfblock(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isHalfblock(Block block) {
|
||||||
|
// getBoundingBox() is only available on 1.14+
|
||||||
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
|
BoundingBox box = block.getBoundingBox();
|
||||||
|
double height = box.getMaxY() - box.getMinY();
|
||||||
|
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW
|
||||||
|
|| block.getType().name().endsWith("HEAD");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a player could be standing on slime
|
||||||
|
*
|
||||||
|
* @param location the location to check
|
||||||
|
* @return true if the player could be standing on slime
|
||||||
|
*/
|
||||||
|
public static boolean couldBeOnSlime(Location location) {
|
||||||
|
return isNearSlime(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.01D,
|
||||||
|
location.getBlockZ()))
|
||||||
|
|| isNearSlime(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.51D,
|
||||||
|
location.getBlockZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a type of slime
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if block is a type of slime
|
||||||
|
*/
|
||||||
|
public static boolean isSlime(Block block) {
|
||||||
|
Material type = block.getType();
|
||||||
|
return type.equals(XMaterial.SLIME_BLOCK.parseMaterial());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNearSlime(Location location) {
|
||||||
|
return isSlime(location.getBlock()) || isSlime(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||||
|
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a player is fully submerged in water
|
* Determine whether a player is fully submerged in water
|
||||||
*
|
*
|
||||||
@@ -242,8 +383,7 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNearBed(Location location) {
|
public static boolean isNearBed(Location location) {
|
||||||
return isBed(location.getBlock())
|
return isBed(location.getBlock()) || isBed(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH))
|
|
||||||
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH))
|
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|| isBed(location.getBlock().getRelative(BlockFace.EAST))
|
|| isBed(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|| isBed(location.getBlock().getRelative(BlockFace.WEST))
|
|| isBed(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
@@ -264,6 +404,17 @@ public final class Utilities {
|
|||||||
return type.name().endsWith("STAIRS");
|
return type.name().endsWith("STAIRS");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a wall
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if wall
|
||||||
|
*/
|
||||||
|
public static boolean isWall(Block block) {
|
||||||
|
Material type = block.getType();
|
||||||
|
return type.name().endsWith("WALL") || type.name().endsWith("FENCE");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a player is sprinting or flying
|
* Determine whether a player is sprinting or flying
|
||||||
*
|
*
|
||||||
@@ -282,10 +433,11 @@ public final class Utilities {
|
|||||||
*/
|
*/
|
||||||
public static boolean isOnLilyPad(Player player) {
|
public static boolean isOnLilyPad(Player player) {
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
return block.getType() == LILY_PAD || block.getRelative(BlockFace.NORTH).getType() == LILY_PAD
|
return block.getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|| block.getRelative(BlockFace.SOUTH).getType() == LILY_PAD
|
|| block.getRelative(BlockFace.NORTH).getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|| block.getRelative(BlockFace.EAST).getType() == LILY_PAD
|
|| block.getRelative(BlockFace.SOUTH).getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|| block.getRelative(BlockFace.WEST).getType() == LILY_PAD;
|
|| block.getRelative(BlockFace.EAST).getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|
|| block.getRelative(BlockFace.WEST).getType() == XMaterial.LILY_PAD.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -308,7 +460,14 @@ public final class Utilities {
|
|||||||
public static boolean isInWater(Player player) {
|
public static boolean isInWater(Player player) {
|
||||||
return player.getLocation().getBlock().isLiquid()
|
return player.getLocation().getBlock().isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
||||||
|
|| (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.AQUATIC_UPDATE)
|
||||||
|
&& (player.getLocation().getBlock().getType() == XMaterial.KELP_PLANT.parseMaterial()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP)
|
||||||
|
.getType() == XMaterial.KELP_PLANT.parseMaterial()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN)
|
||||||
|
.getType() == XMaterial.KELP_PLANT.parseMaterial())
|
||||||
|
&& isNearWater(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,8 +478,8 @@ public final class Utilities {
|
|||||||
*/
|
*/
|
||||||
public static boolean isNearWater(Player player) {
|
public static boolean isNearWater(Player player) {
|
||||||
return player.getLocation().getBlock().isLiquid()
|
return player.getLocation().getBlock().isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.NORTH).isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.EAST).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.EAST).isLiquid()
|
||||||
@@ -331,6 +490,50 @@ public final class Utilities {
|
|||||||
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a player is surrounded by liquid blocks
|
||||||
|
*
|
||||||
|
* @param player player to check
|
||||||
|
* @return true if surrounded by liquid blocks
|
||||||
|
*/
|
||||||
|
public static boolean isSurroundedByWater(Player player) {
|
||||||
|
Location location = player.getLocation().clone().subtract(0, 0.1, 0);
|
||||||
|
return location.getBlock().isLiquid() && location.getBlock().getRelative(BlockFace.NORTH).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.SOUTH).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.EAST).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.WEST).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.NORTH_EAST).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.NORTH_WEST).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|
||||||
|
&& location.getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a player is near a web
|
||||||
|
*
|
||||||
|
* @param player player to check
|
||||||
|
* @return true if near a web
|
||||||
|
*/
|
||||||
|
public static boolean isNearWeb(Player player) {
|
||||||
|
return isWeb(player.getLocation().getBlock())
|
||||||
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.DOWN))
|
||||||
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.UP))
|
||||||
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a web
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if web
|
||||||
|
*/
|
||||||
|
public static boolean isWeb(Block block) {
|
||||||
|
return block.getType() == XMaterial.COBWEB.parseMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a player is in a web
|
* Determine whether a player is in a web
|
||||||
*
|
*
|
||||||
@@ -338,9 +541,11 @@ public final class Utilities {
|
|||||||
* @return true if in web
|
* @return true if in web
|
||||||
*/
|
*/
|
||||||
public static boolean isInWeb(Player player) {
|
public static boolean isInWeb(Player player) {
|
||||||
return player.getLocation().getBlock().getType() == COB_WEB
|
return player.getLocation().getBlock().getType() == XMaterial.COBWEB.parseMaterial()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == COB_WEB
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == XMaterial.COBWEB
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == COB_WEB;
|
.parseMaterial()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == XMaterial.COBWEB
|
||||||
|
.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,6 +564,22 @@ public final class Utilities {
|
|||||||
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
|| isClimbableBlock(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a location is near a climbable block
|
||||||
|
*
|
||||||
|
* @param location location to check
|
||||||
|
* @return true if near climbable block
|
||||||
|
*/
|
||||||
|
public static boolean isNearClimbable(Location location) {
|
||||||
|
return isClimbableBlock(location.getBlock())
|
||||||
|
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.DOWN))
|
||||||
|
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.UP))
|
||||||
|
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isClimbableBlock(location.getBlock().getRelative(BlockFace.WEST));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a block is climbable
|
* Determine whether a block is climbable
|
||||||
*
|
*
|
||||||
@@ -376,7 +597,7 @@ public final class Utilities {
|
|||||||
* @return true if on vine
|
* @return true if on vine
|
||||||
*/
|
*/
|
||||||
public static boolean isOnVine(Player player) {
|
public static boolean isOnVine(Player player) {
|
||||||
return player.getLocation().getBlock().getType() == Material.VINE;
|
return player.getLocation().getBlock().getType() == XMaterial.VINE.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -409,54 +630,6 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate the time in milliseconds that it should take to break the given
|
|
||||||
* block with the given tool
|
|
||||||
*
|
|
||||||
* @param tool tool to check
|
|
||||||
* @param block block to check
|
|
||||||
* @return time in milliseconds to break
|
|
||||||
*/
|
|
||||||
public static long calcSurvivalFastBreak(ItemStack tool, Material block) {
|
|
||||||
if (isInstantBreak(block) || (tool.getType() == Material.SHEARS && block.name().endsWith("LEAVES"))) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
double bhardness = BlockHardness.getBlockHardness(block);
|
|
||||||
double thardness = ToolHardness.getToolHardness(tool.getType());
|
|
||||||
long enchantlvl = (long) tool.getEnchantmentLevel(Enchantment.DIG_SPEED);
|
|
||||||
|
|
||||||
long result = Math.round((bhardness * thardness) * 0.10 * 10000);
|
|
||||||
|
|
||||||
if (enchantlvl > 0) {
|
|
||||||
result /= enchantlvl * enchantlvl + 1L;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = result > 25000 ? 25000 : result < 0 ? 0 : result;
|
|
||||||
|
|
||||||
if (isQuickCombo(tool, block)) {
|
|
||||||
result = result / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the given tool is a combination that makes the breaking of
|
|
||||||
* this block faster
|
|
||||||
*
|
|
||||||
* @param tool tool to check
|
|
||||||
* @param block block to check
|
|
||||||
* @return true if quick combo
|
|
||||||
*/
|
|
||||||
private static boolean isQuickCombo(ItemStack tool, Material block) {
|
|
||||||
for (Material t : COMBO.keySet()) {
|
|
||||||
if (tool.getType() == t && COMBO.get(t) == block) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if a block ISN'T one of the specified types
|
* Determine if a block ISN'T one of the specified types
|
||||||
*
|
*
|
||||||
@@ -583,66 +756,42 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code by Hawk Anticheat
|
* Rounds a float value to a scale
|
||||||
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
|
||||||
*
|
*
|
||||||
* @param a
|
* @param value Value to round
|
||||||
* @param b
|
* @param scale Scale
|
||||||
* @return the greatest common divisor between two floats
|
* @return rounded value
|
||||||
*/
|
*/
|
||||||
public static float gcdRational(float a, float b) {
|
public static float roundFloat(float value, int scale) {
|
||||||
if (a == 0) {
|
return new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP).floatValue();
|
||||||
return b;
|
|
||||||
}
|
|
||||||
int quotient = getIntQuotient(b, a);
|
|
||||||
float remainder = ((b / a) - quotient) * a;
|
|
||||||
if (Math.abs(remainder) < Math.max(a, b) * 1E-3F)
|
|
||||||
remainder = 0;
|
|
||||||
return gcdRational(remainder, a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Code by Hawk Anticheat
|
* Rounds a double value to a scale
|
||||||
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
|
||||||
*
|
*
|
||||||
* @param numbers
|
* @param value Value to round
|
||||||
* @return the greatest common divisor between a list of floats
|
* @param scale Scale
|
||||||
|
* @return rounded value
|
||||||
*/
|
*/
|
||||||
public static float gcdRational(List<Float> numbers) {
|
public static double roundDouble(double value, int scale) {
|
||||||
float result = numbers.get(0);
|
return new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP).doubleValue();
|
||||||
for (int i = 1; i < numbers.size(); i++) {
|
|
||||||
result = gcdRational(numbers.get(i), result);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static int floor(double value) {
|
||||||
* Code by Hawk Anticheat
|
int rounded = (int) value;
|
||||||
* (https://github.com/HawkAnticheat/Hawk/blob/master/src/me/islandscout/hawk/util/MathPlus.java)
|
return value < rounded ? rounded - 1 : rounded;
|
||||||
*
|
|
||||||
* @param dividend
|
|
||||||
* @param divisor
|
|
||||||
*/
|
|
||||||
public static int getIntQuotient(float dividend, float divisor) {
|
|
||||||
float ans = dividend / divisor;
|
|
||||||
float error = Math.max(dividend, divisor) * 1E-3F;
|
|
||||||
return (int) (ans + error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHoneyBlock(Block block) {
|
public static boolean isHoneyBlock(Block block) {
|
||||||
if (!VersionUtil.isOfVersion("v1_15")) {
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return block.getType() == Material.HONEY_BLOCK;
|
return block.getType() == XMaterial.HONEY_BLOCK.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Start 1.8.8
|
// Start 1.8.8
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (VersionUtil.isBountifulUpdate()) {
|
||||||
LILY_PAD = XMaterial.LILY_PAD.parseMaterial();
|
|
||||||
COB_WEB = XMaterial.COBWEB.parseMaterial();
|
|
||||||
IRON_BARS = XMaterial.IRON_BARS.parseMaterial();
|
|
||||||
|
|
||||||
// Start instant break materials
|
// Start instant break materials
|
||||||
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
|
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
|
||||||
INSTANT_BREAK.add(XMaterial.REPEATER.parseMaterial());
|
INSTANT_BREAK.add(XMaterial.REPEATER.parseMaterial());
|
||||||
@@ -659,7 +808,7 @@ public final class Utilities {
|
|||||||
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
||||||
INSTANT_BREAK.add(Material.GRASS);
|
INSTANT_BREAK.add(Material.GRASS);
|
||||||
INSTANT_BREAK.add(XMaterial.TALL_GRASS.parseMaterial());
|
INSTANT_BREAK.add(XMaterial.TALL_GRASS.parseMaterial());
|
||||||
INSTANT_BREAK.add(LILY_PAD);
|
INSTANT_BREAK.add(XMaterial.LILY_PAD.parseMaterial());
|
||||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||||
@@ -708,10 +857,10 @@ public final class Utilities {
|
|||||||
// Start combos
|
// Start combos
|
||||||
COMBO.put(Material.SHEARS, XMaterial.WHITE_WOOL.parseMaterial());
|
COMBO.put(Material.SHEARS, XMaterial.WHITE_WOOL.parseMaterial());
|
||||||
|
|
||||||
COMBO.put(Material.IRON_SWORD, COB_WEB);
|
COMBO.put(Material.IRON_SWORD, XMaterial.COBWEB.parseMaterial());
|
||||||
COMBO.put(Material.DIAMOND_SWORD, COB_WEB);
|
COMBO.put(Material.DIAMOND_SWORD, XMaterial.COBWEB.parseMaterial());
|
||||||
COMBO.put(Material.STONE_SWORD, COB_WEB);
|
COMBO.put(Material.STONE_SWORD, XMaterial.COBWEB.parseMaterial());
|
||||||
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), COB_WEB);
|
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), XMaterial.COBWEB.parseMaterial());
|
||||||
// End combos
|
// End combos
|
||||||
|
|
||||||
// Start climbable
|
// Start climbable
|
||||||
@@ -723,9 +872,7 @@ public final class Utilities {
|
|||||||
// End 1.8.8
|
// End 1.8.8
|
||||||
// Start other version
|
// Start other version
|
||||||
else {
|
else {
|
||||||
LILY_PAD = Material.LILY_PAD;
|
MinecraftVersion currentVersion = MinecraftVersion.getCurrentVersion();
|
||||||
COB_WEB = Material.COBWEB;
|
|
||||||
IRON_BARS = Material.IRON_BARS;
|
|
||||||
|
|
||||||
// Start instant break materials
|
// Start instant break materials
|
||||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||||
@@ -771,13 +918,13 @@ public final class Utilities {
|
|||||||
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
||||||
INSTANT_BREAK.add(Material.WHEAT);
|
INSTANT_BREAK.add(Material.WHEAT);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
||||||
INSTANT_BREAK.add(Material.CORNFLOWER);
|
INSTANT_BREAK.add(Material.CORNFLOWER);
|
||||||
}
|
}
|
||||||
// End 1.14 objects
|
// End 1.14 objects
|
||||||
// Start 1.15 objects
|
// Start 1.15 objects
|
||||||
if (VersionUtil.isOfVersion("v1_15")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||||
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
||||||
}
|
}
|
||||||
// End 1.15 objects
|
// End 1.15 objects
|
||||||
@@ -822,13 +969,13 @@ public final class Utilities {
|
|||||||
FOOD.add(Material.SPIDER_EYE);
|
FOOD.add(Material.SPIDER_EYE);
|
||||||
FOOD.add(Material.TROPICAL_FISH);
|
FOOD.add(Material.TROPICAL_FISH);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
FOOD.add(Material.SUSPICIOUS_STEW);
|
FOOD.add(Material.SUSPICIOUS_STEW);
|
||||||
FOOD.add(Material.SWEET_BERRIES);
|
FOOD.add(Material.SWEET_BERRIES);
|
||||||
}
|
}
|
||||||
// End 1.14 objects
|
// End 1.14 objects
|
||||||
// Start 1.15 objects
|
// Start 1.15 objects
|
||||||
if (VersionUtil.isOfVersion("v1_15")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||||
FOOD.add(Material.HONEY_BOTTLE);
|
FOOD.add(Material.HONEY_BOTTLE);
|
||||||
}
|
}
|
||||||
// End 1.15 objects
|
// End 1.15 objects
|
||||||
@@ -864,10 +1011,20 @@ public final class Utilities {
|
|||||||
CLIMBABLE.add(Material.LADDER);
|
CLIMBABLE.add(Material.LADDER);
|
||||||
CLIMBABLE.add(Material.WATER);
|
CLIMBABLE.add(Material.WATER);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
CLIMBABLE.add(Material.SCAFFOLDING);
|
CLIMBABLE.add(Material.SCAFFOLDING);
|
||||||
|
CLIMBABLE.add(Material.SWEET_BERRY_BUSH);
|
||||||
}
|
}
|
||||||
// End 1.14 objects
|
// End 1.14 objects
|
||||||
|
|
||||||
|
// Start 1.16 objects
|
||||||
|
if (currentVersion.isAtLeast(MinecraftVersion.NETHER_UPDATE)) {
|
||||||
|
CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial());
|
||||||
|
CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial());
|
||||||
|
CLIMBABLE.add(XMaterial.WEEPING_VINES.parseMaterial());
|
||||||
|
CLIMBABLE.add(XMaterial.WEEPING_VINES_PLANT.parseMaterial());
|
||||||
|
}
|
||||||
|
// End 1.16 objects
|
||||||
// End climbable
|
// End climbable
|
||||||
}
|
}
|
||||||
// End other versions
|
// End other versions
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -29,12 +28,16 @@ import org.bukkit.block.Block;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
public class VersionUtil {
|
public class VersionUtil {
|
||||||
|
|
||||||
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
private static final List<String> SUPPORTED_VERSIONS;
|
||||||
.asList(new String[] { "v1_15", "v1_14", "v1_13", "v1_8_R3" });
|
private static final MinecraftVersion CURRENT_VERSION;
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||||
@@ -63,22 +66,23 @@ public class VersionUtil {
|
|||||||
return isOfVersion("v1_8");
|
return isOfVersion("v1_8");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFlying(Player p) {
|
public static boolean isFlying(Player player) {
|
||||||
if (isBountifulUpdate()) {
|
if (isBountifulUpdate()) {
|
||||||
return p.isFlying();
|
return player.isFlying();
|
||||||
}
|
}
|
||||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
return player.isFlying() || player.isGliding() || player.hasPotionEffect(PotionEffectType.LEVITATION)
|
||||||
|
|| AntiCheatReloaded.getManager().getBackend().justLevitated(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRiptiding(Player player) {
|
public static boolean isRiptiding(Player player) {
|
||||||
if (isBountifulUpdate()) {
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return player.isRiptiding();
|
return player.isRiptiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSlowFalling(Player player) {
|
public static boolean isSlowFalling(Player player) {
|
||||||
if (isBountifulUpdate()) {
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
||||||
@@ -116,4 +120,43 @@ public class VersionUtil {
|
|||||||
return player.getTargetBlockExact(distance);
|
return player.getTargetBlockExact(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isGliding(Player player) {
|
||||||
|
if (isBountifulUpdate()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.isGliding();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isLevitationEffect(PotionEffect effect) {
|
||||||
|
if (isBountifulUpdate()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return effect.getType().equals(PotionEffectType.LEVITATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPotionLevel(Player player, PotionEffectType type) {
|
||||||
|
if (isBountifulUpdate()) {
|
||||||
|
for (PotionEffect effect : player.getActivePotionEffects()) {
|
||||||
|
if (effect.getType().equals(type))
|
||||||
|
return effect.getAmplifier() + 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.hasPotionEffect(type))
|
||||||
|
return player.getPotionEffect(type).getAmplifier() + 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSwimming(Player player) {
|
||||||
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return player.isSwimming();
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
SUPPORTED_VERSIONS = Arrays.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_12", "v1_8_R3" });
|
||||||
|
CURRENT_VERSION = MinecraftVersion.getCurrentVersion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,450 @@
|
|||||||
|
# AntiCheatReloaded checks configuration file
|
||||||
|
# Checks that have multiple modules need to be disabled on a per-module basis
|
||||||
|
# If you have a false positive and can't determine what subcheck it's from,
|
||||||
|
# enable debug-mode in config.yml and compare the results against the commented values
|
||||||
|
# Flight check settings
|
||||||
|
# Checks if a player moves wrongly in the air
|
||||||
|
flight:
|
||||||
|
# Checks for prolonged air movement
|
||||||
|
# Debugs as 'tried to fly on the Y-axis' or 'had too little Y dropoff'
|
||||||
|
airFlight:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# How many milliseconds to account for block placement
|
||||||
|
# Increase this if you get false positives when building a tower
|
||||||
|
accountForBlockPlacement: 1200
|
||||||
|
# How many milliseconds to account for TPS drops
|
||||||
|
# Increase this if you get false positives when building a tower during TPS drops
|
||||||
|
accountForTpsDrops: 250
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
# Increase this is you debug 'had too little Y dropoff' after teleports
|
||||||
|
accountForTeleports: 150
|
||||||
|
# Checks for climbing behaviour in air
|
||||||
|
# Debugs as 'tried to climb air'
|
||||||
|
airClimb:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
# Increase this is you debug 'tried to climb air' after teleports
|
||||||
|
accountForTeleports: 50
|
||||||
|
# Checks if a player is faking it's ground status to fly
|
||||||
|
# Debugs as 'faked ground to fly'
|
||||||
|
groundFlight:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Checks if a player ignores gravity
|
||||||
|
# Debugs as 'ignored gravity'
|
||||||
|
gravity:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum offset between predicted and actual gravity
|
||||||
|
maxOffset: 0.005
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
# Increase this is you debug 'ignored gravity' after teleports
|
||||||
|
accountForTeleports: 100
|
||||||
|
# Amount of illegal moves before flagging
|
||||||
|
vlBeforeFlag: 5
|
||||||
|
|
||||||
|
# ElytraFly check settings
|
||||||
|
# Checks for illegal upward elytra movement
|
||||||
|
elytrafly:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Speed check settings
|
||||||
|
# Checks if a player moves too fast
|
||||||
|
speed:
|
||||||
|
# Checks movement speed in the air
|
||||||
|
# Debugs as 'moved too fast in air'
|
||||||
|
airSpeed:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Base unadjusted air speed limit
|
||||||
|
baseLimit: 0.03125
|
||||||
|
# Prediction multiplier for custom walk speeds
|
||||||
|
walkSpeedMultiplier: 1.4
|
||||||
|
|
||||||
|
# Checks movement acceleration in the air
|
||||||
|
# Debugs as 'exceeded acceleration limits'
|
||||||
|
airAcceleration:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Base unadjusted air acceleration limit
|
||||||
|
baseLimit: 0.3725
|
||||||
|
# Limit multiplier for custom walk speeds
|
||||||
|
walkSpeedMultiplier: 1.4
|
||||||
|
|
||||||
|
# Checks movement acceleration in the air
|
||||||
|
# Debugs as 'had unexpected jumping behaviour'
|
||||||
|
jumpBehaviour:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum movement distance needed to flag
|
||||||
|
minimumDistXZ: 0.42
|
||||||
|
|
||||||
|
# Checks movement speed on the ground
|
||||||
|
# Debugs as 'moved too fast on ground'
|
||||||
|
groundSpeed:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Initial speed limit value
|
||||||
|
initialLimit: 0.34
|
||||||
|
|
||||||
|
# Checks movement acceleration in the air
|
||||||
|
# Debugs as 'exceeded vertical speed limit'
|
||||||
|
verticalSpeed:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Extra compensation when moving off a ladder up a slab
|
||||||
|
climbableCompensation: 0.04
|
||||||
|
|
||||||
|
# Strafe check settings
|
||||||
|
# Checks if a player switches movement angle in air
|
||||||
|
strafe:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# How many milliseconds to account for teleports
|
||||||
|
accountForTeleports: 100
|
||||||
|
# Maximum angle change when moving in air
|
||||||
|
maxAngleChange: 0.50
|
||||||
|
# Minimum movement distance for the strafe check to be active
|
||||||
|
minActivationDistance: 0.025
|
||||||
|
|
||||||
|
# WaterWalk check settings
|
||||||
|
# Checks if a player is walking on water
|
||||||
|
waterwalk:
|
||||||
|
# Checks for vanilla water walking/jumping
|
||||||
|
# Debugs as 'tried to walk on water'
|
||||||
|
walk:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum xz distance before flagging
|
||||||
|
# This combats false positives, while giving hackers not much leniency
|
||||||
|
minimumDistXZ: 0.092
|
||||||
|
# Checks for small hops on top of water
|
||||||
|
# Debugs as 'tried to hop on water'
|
||||||
|
hop:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum lunge Y motion to flag
|
||||||
|
maxMotionY: 0.10
|
||||||
|
# Checks for small lunges in water
|
||||||
|
# Debugs as 'tried to lunge in water'
|
||||||
|
lunge:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum xz distance before flagging
|
||||||
|
# This combats false positives, while giving hackers not much leniency
|
||||||
|
minimumDistXZ: 0.098
|
||||||
|
|
||||||
|
# FastLadder check settings
|
||||||
|
# Checks if a player moves too fast on a ladder
|
||||||
|
fastladder:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum speed a player on a ladder can travel upwards
|
||||||
|
speedUpMax: 0.11761
|
||||||
|
# Maximum speed a player on a ladder can travel downwards
|
||||||
|
speedDownMax: 0.15
|
||||||
|
# Amount of illegal ladder moves before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
|
# BoatFly check settings
|
||||||
|
# Checks if the player is flying in a boat
|
||||||
|
boatfly:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Amount of in-boat airborne moments before flagging
|
||||||
|
vlBeforeFlag: 2
|
||||||
|
|
||||||
|
# KillAura check settings
|
||||||
|
# Checks if the player uses a form of kill aura
|
||||||
|
killaura:
|
||||||
|
# Checks reach distance in fights
|
||||||
|
# Debugs as 'reached too far'
|
||||||
|
reach:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum base reach distances
|
||||||
|
baseMaxValue:
|
||||||
|
# Maximum base reach value
|
||||||
|
normal: 3.6
|
||||||
|
# Maximum base reach value when a player has velocity
|
||||||
|
velocitized: 4.0
|
||||||
|
# Settings for lag compensation
|
||||||
|
lagCompensation:
|
||||||
|
# Basic extra allowed reach when a player is lagging
|
||||||
|
lagExtraReach: 0.2
|
||||||
|
# Extra allowed reach distance per millisecond of ping
|
||||||
|
pingCompensation: 0.0025
|
||||||
|
# The multiplier of extra compensation for velocity
|
||||||
|
velocityMultiplier: 1.2
|
||||||
|
|
||||||
|
# Checks if the target it within a players viewing angle
|
||||||
|
# Debugs as 'tried to attack from an illegal angle'
|
||||||
|
angle:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum difference in angle from the players view
|
||||||
|
maxDifference: 50
|
||||||
|
# Amount of illegally angled hits before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
|
# Checks if the player has a suspicious packet order
|
||||||
|
# Debugs as 'suspicious packet order'
|
||||||
|
packetOrder:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for BadPackets to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Minimum elapsed time in milliseconds between a movement packet and a combat packet
|
||||||
|
minElapsedTime: 5
|
||||||
|
# Amount of suspicious combat packet situations before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
|
# Aimbot check settings
|
||||||
|
# Checks if the player is sending aimbot-like movements
|
||||||
|
aimbot:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum yaw difference when repeated
|
||||||
|
minYaw: 30
|
||||||
|
# Maximum yaw difference when repeated
|
||||||
|
maxYaw: 355
|
||||||
|
|
||||||
|
# Criticals check settings
|
||||||
|
# Checks if the player tries to do a crit without needed conditions
|
||||||
|
criticals:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Velocity check settings
|
||||||
|
# Checks if the player ignores knockback
|
||||||
|
velocity:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum percentage of the given knockback a player has to meet
|
||||||
|
minimumPercentage: 75
|
||||||
|
# Amount of low-velocity moments before flagging
|
||||||
|
vlBeforeFlag: 2
|
||||||
|
|
||||||
|
# FastPlace check settings
|
||||||
|
# Checks if the player places blocks too fast
|
||||||
|
fastplace:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum time in milliseconds between block places
|
||||||
|
minimumTime: 50
|
||||||
|
# Amount of fastplace-moments before flagging a survival player
|
||||||
|
vlBeforeFlagSurvival: 2
|
||||||
|
# Amount of fastplace-moments before flagging a creative player
|
||||||
|
vlBeforeFlagCreative: 3
|
||||||
|
# Amount of time in milliseconds to prevent a player from placing blocks after flagging
|
||||||
|
blockPlacementTime: 1000
|
||||||
|
|
||||||
|
# IllegalInteract check settings
|
||||||
|
# Checks if the player is using, placing or breaking blocks from illegal angles
|
||||||
|
illegalinteract:
|
||||||
|
# Maximum difference in angle from the players view
|
||||||
|
maxAngleDifference: 90
|
||||||
|
# Checks angle when breaking a block
|
||||||
|
# Debugs as 'tried to break a block which was out of view'
|
||||||
|
break:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Checks angle when placing a block
|
||||||
|
# Debugs as 'tried to place a block which was out of view'
|
||||||
|
place:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Checks angle when placing a block
|
||||||
|
# Debugs as 'tried to interact out of range' or 'tried to interact out of view'
|
||||||
|
interact:
|
||||||
|
# Should this part of the check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Default survival interact range
|
||||||
|
survivalRange: 5.8
|
||||||
|
# Default creative interact range
|
||||||
|
creativeRange: 6.8
|
||||||
|
# Extra allowed reach distance per millisecond of ping
|
||||||
|
pingCompensation: 0.0045
|
||||||
|
# The multiplier of extra compensation for velocity
|
||||||
|
velocityMultiplier: 1.5
|
||||||
|
|
||||||
|
# BadPackets check settings
|
||||||
|
# Checks for illegal packets
|
||||||
|
badpackets:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for BadPackets to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Maximum distance a player can move between packets
|
||||||
|
maxDistance: 25.0
|
||||||
|
|
||||||
|
# MorePackets check settings
|
||||||
|
# Checks for an extra amount of packets and modified game timers
|
||||||
|
morepackets:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for MorePackets to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Maximum amount of lag compensation a player can acquire (50ms = 1 tick)
|
||||||
|
minimumClamp: 500
|
||||||
|
# The amount of milliseconds offset between packets before flagging (50ms = 1 tick)
|
||||||
|
triggerBalance: 100
|
||||||
|
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
||||||
|
teleportCompensation: 150
|
||||||
|
# Should MorePackets be disabled for 'lagging' players?
|
||||||
|
# This can easily be spoofed by clients!
|
||||||
|
disableForLagging: false
|
||||||
|
# Maximum ping value before MorePackets stops checking a player (-1 to disable)
|
||||||
|
# This can easily be spoofed by clients!
|
||||||
|
maxPing: -1
|
||||||
|
|
||||||
|
# Sneak check settings
|
||||||
|
# Checks if the player toggles sneak too fast
|
||||||
|
sneak:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Should MorePackets be disabled for 'lagging' players?
|
||||||
|
# This can easily be spoofed by clients!
|
||||||
|
disableForLagging: false
|
||||||
|
# Minimum server TPS needed for sneak
|
||||||
|
minimumTps: 12
|
||||||
|
# Minimum time in milliseconds between sneak toggles
|
||||||
|
minToggleTime: 75
|
||||||
|
|
||||||
|
# NoSlow check settings
|
||||||
|
# Checks if the player moves too fast while blocking
|
||||||
|
noslow:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum time difference in milliseconds between toggling use item state
|
||||||
|
minimumDifference: 75
|
||||||
|
# Minimum movement distance needed to flag
|
||||||
|
minimumDistXZ: 0.15
|
||||||
|
# Amount of no slowdown moments before flagging
|
||||||
|
vlBeforeFlag: 3
|
||||||
|
|
||||||
|
# Spider check settings
|
||||||
|
# Checks if the player tries to climb a non-climbable block
|
||||||
|
spider:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# NoFall check settings
|
||||||
|
# Checks if the player tries to ignore fall damage
|
||||||
|
nofall:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Amount of moves with a modified fall distance before flagging
|
||||||
|
vlBeforeFlag: 6
|
||||||
|
|
||||||
|
# Sprint check settings
|
||||||
|
# Checks if the player tries to sprint without the needed conditions
|
||||||
|
sprint:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum food level needed to sprint
|
||||||
|
sprintFoodMin: 6
|
||||||
|
|
||||||
|
# FastBow check settings
|
||||||
|
# Checks if the player fires a bow too fast
|
||||||
|
fastbow:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Maximum percent error between predicted bow force and actual bow force
|
||||||
|
bowError: 0.25
|
||||||
|
|
||||||
|
# FastEat check settings
|
||||||
|
# Checks if the player consumes food too fast
|
||||||
|
fasteat:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum time in milliseconds it takes to consume food
|
||||||
|
eatTimeMin: 1000
|
||||||
|
|
||||||
|
# FastHeal check settings
|
||||||
|
# Checks if the player regains health too fast
|
||||||
|
fastheal:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum server TPS needed for FastHeal to be active
|
||||||
|
minimumTps: 17.5
|
||||||
|
# Should FastHeal be disabled for 'lagging' players?
|
||||||
|
# This can easily be spoofed by clients!
|
||||||
|
disableForLagging: false
|
||||||
|
# The minimum time it takes to regenerate health in milliseconds
|
||||||
|
minHealTime: 495
|
||||||
|
# Amount of milliseconds a player can heal faster per millisecond of ping
|
||||||
|
pingCompensation: 0.15
|
||||||
|
|
||||||
|
# FastProjectile check settings
|
||||||
|
# Checks if the player fires a projectile too fast
|
||||||
|
fastprojectile:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Number of projectiles to wait for before checking how long they took to fire off
|
||||||
|
projectilesToWait: 10
|
||||||
|
# The minimum time in milliseconds it should have taken for the player fire 'projectilesToWait' projectiles
|
||||||
|
minimumTime: 1500
|
||||||
|
|
||||||
|
# ItemSpam check settings
|
||||||
|
# Checks if the player drops items too fast
|
||||||
|
itemspam:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# The number of item drops we should wait before checking if the player has used item spam
|
||||||
|
dropsToWait: 10
|
||||||
|
# The minimum time in milliseconds it should have taken for the player to drop items 'dropsToWait' times
|
||||||
|
minimumTime: 800
|
||||||
|
|
||||||
|
# FastInventory check settings
|
||||||
|
# Checks if the player moves items in the inventory too fast
|
||||||
|
fastinventory:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# The number of clicks we should wait before checking if the player has used fast inventory
|
||||||
|
clicksToWait: 10
|
||||||
|
# The minimum time in milliseconds it should have taken for the player to click 'clicksToWait' times
|
||||||
|
minimumTime: 50
|
||||||
|
|
||||||
|
# vClip check settings
|
||||||
|
# Checks if the player is clipping
|
||||||
|
vclip:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# ChatUnicode check settings
|
||||||
|
# Checks for illegal unicode characters in the chat
|
||||||
|
chatunicode:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# ChatSpam check settings
|
||||||
|
# Checks for a spam of chat messages
|
||||||
|
chatspam:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum time between chats
|
||||||
|
timeMin: 500
|
||||||
|
# Time in milliseconds after which repeating yourself in chat is ignored
|
||||||
|
repeatIgnore: 600
|
||||||
|
# Number of chat spam violations before action one (see config.yml) is executed
|
||||||
|
levelActionOne: 5
|
||||||
|
# Number of chat spam violations before action two (see config.yml) is executed
|
||||||
|
levelActionTwo: 10
|
||||||
|
|
||||||
|
# CommandSpam check settings
|
||||||
|
# Checks for a spam of commands
|
||||||
|
commandspam:
|
||||||
|
# Should this check be enabled?
|
||||||
|
enabled: true
|
||||||
|
# Minimum time between commands
|
||||||
|
timeMin: 400
|
||||||
|
# Time in milliseconds after which repeating a command is ignored
|
||||||
|
repeatIgnore: 500
|
||||||
|
# Number of command spam violations before action one (see config.yml) is executed
|
||||||
|
levelActionOne: 5
|
||||||
|
# Number of command spam violations before action two (see config.yml) is executed
|
||||||
|
levelActionTwo: 10
|
||||||
@@ -24,6 +24,8 @@ system:
|
|||||||
# If silent mode is on, players will not be stopped when they try to hack, and AntiCheatReloaded will do everything possible to keep them unaware of their rising hack level.
|
# If silent mode is on, players will not be stopped when they try to hack, and AntiCheatReloaded will do everything possible to keep them unaware of their rising hack level.
|
||||||
# However, alerts will still be sent to console and to admins online, and events will still take place.
|
# However, alerts will still be sent to console and to admins online, and events will still take place.
|
||||||
silent-mode: false
|
silent-mode: false
|
||||||
|
# Disable broadcasts about why a player was kicked
|
||||||
|
disable-broadcast: false
|
||||||
# Should ops be exempt from all checks?
|
# Should ops be exempt from all checks?
|
||||||
exempt-op: false
|
exempt-op: false
|
||||||
# Should AntiCheatReloaded track plugins in its own registered events?
|
# Should AntiCheatReloaded track plugins in its own registered events?
|
||||||
@@ -35,12 +37,14 @@ system:
|
|||||||
# Do NOT enable this in a production environment!
|
# Do NOT enable this in a production environment!
|
||||||
debug-mode: false
|
debug-mode: false
|
||||||
# To prevent spamming, staff and the console will only be notified every x violations
|
# To prevent spamming, staff and the console will only be notified every x violations
|
||||||
# Minimum value is 1, default is 5
|
# Minimum value is 1, default is 8
|
||||||
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
|
||||||
notify-every-vl: 5
|
notify-every-vl: 8
|
||||||
# Use /AntiCheatReloaded check for a list of valid checks
|
# Maximum distance a player can be set back
|
||||||
disabled-checks:
|
# If the last known valid location is further away than this,
|
||||||
- EXAMPLE_CHECK
|
# the player will be rubberbanded at their current location
|
||||||
|
# Minimum value is 5, default is 50
|
||||||
|
max-setback-distance: 50
|
||||||
disable-in:
|
disable-in:
|
||||||
- example-world
|
- example-world
|
||||||
- example-world-2
|
- example-world-2
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
# AntiCheatReloaded configuration file
|
# AntiCheatReloaded configuration file
|
||||||
|
# Options; WARN, KICK, COMMAND[your command here] or NONE
|
||||||
|
# To disable warnings or kicking, change WARN and/or KICK to NONE
|
||||||
groups:
|
groups:
|
||||||
- 'Medium : 20 : YELLOW : WARN'
|
- 'Low : 50 : GREEN : NONE'
|
||||||
- 'High : 50 : RED : KICK'
|
- 'Medium : 60 : YELLOW : WARN'
|
||||||
|
- 'High : 75 : RED : KICK'
|
||||||
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
|
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
|
||||||
@@ -1,17 +1,35 @@
|
|||||||
# AntiCheatReloaded language file
|
# AntiCheatReloaded language file
|
||||||
|
# The alert message when a player enters a higher group
|
||||||
ALERT:
|
ALERT:
|
||||||
- '&c%player% has just entered the %group% hack group.'
|
- '&6&lACR &8> &7%player% has just entered the %group% hack group.'
|
||||||
- '&c%player%''s last failed check was: %check%.'
|
- '&6&lACR &8> &7%player%''s last failed check was: %check%.'
|
||||||
- '&cType ''/acr report %player%'' for more information.'
|
- '&6&lACR &8> &7Type ''/acr report %player%'' for more information.'
|
||||||
|
# The warning a player receives when reaching a certain level
|
||||||
|
# Only sent when enabled in groups.yml
|
||||||
WARNING:
|
WARNING:
|
||||||
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
- '&6&lACR &8>&7 You have been flagged for using cheats.'
|
||||||
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
|
||||||
BAN_REASON: '&6&lACR &8> &7Banned by AntiCheatReloaded'
|
# Ban message
|
||||||
|
BAN_REASON: '&6&lACR &8> &7Banned for unfair advantage'
|
||||||
|
# Message to broadcast when banned
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
BAN_BROADCAST: '&6&lACR &8> &7%player% was banned for cheating'
|
||||||
KICK_REASON: '&6&lACR &8> &7Kicked for cheating'
|
# Kick message
|
||||||
|
KICK_REASON: '&6&lACR &8> &7Kicked for unfair advantage'
|
||||||
|
# Message to broadcast when kicked
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for cheating'
|
||||||
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
|
# The warning message to send when a player is spamming
|
||||||
SPAM_KICK_REASON: '&cKicked for spamming'
|
SPAM_WARNING: '&6&lACR &8> &7Stop spamming the server or you will be kicked!'
|
||||||
SPAM_KICK_BROADCAST: '&c%player% was kicked for spamming'
|
# Kick reason when spamming
|
||||||
SPAM_BAN_REASON: '&cBanned for spamming'
|
SPAM_KICK_REASON: '&6&lACR &8> &7Kicked for spamming'
|
||||||
|
# Message to broadcast when kicked for spamming
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
|
SPAM_KICK_BROADCAST: '&6&lACR &8> &7%player% was kicked for spamming'
|
||||||
|
# Ban reason when spamming
|
||||||
|
SPAM_BAN_REASON: '&6&lACR &8> &7Banned for spamming'
|
||||||
|
# Message to broadcast when banned for spamming
|
||||||
|
# Only sent when enabled in config.yml
|
||||||
SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
|
SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
|
||||||
|
# The prefix for staff and debug alerts
|
||||||
|
ALERT_PREFIX: "&6&lACR &8> &7"
|
||||||
+19
-262
@@ -1,279 +1,36 @@
|
|||||||
# Maximum times a player can interact between animations
|
|
||||||
# Changing this value of almost never required
|
|
||||||
ANIMATION_INTERACT_MAX: 3
|
|
||||||
# Minimum time between animations
|
|
||||||
# Changing this value is almost never required
|
|
||||||
ANIMATION_MIN: 200
|
|
||||||
# Number of times a player can fail the ascension check before being considered a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
ASCENSION_COUNT_MAX: 8
|
|
||||||
# Minimum time in between block breaks
|
|
||||||
# Decrease in case of false positives
|
|
||||||
BLOCK_BREAK_MIN: 0.1
|
|
||||||
# Maximum distance a player can break a block from
|
|
||||||
# Changing this value is almost never required
|
|
||||||
BLOCK_MAX_DISTANCE: 5.5
|
|
||||||
# Maximum distance a player can break a block from when in creative mode
|
|
||||||
# Changing this value is almost never required
|
|
||||||
BLOCK_MAX_DISTANCE_CREATIVE: 6.0
|
|
||||||
# Minimum time in between block placing
|
|
||||||
# Decrease in case of false positives
|
|
||||||
BLOCK_PLACE_MIN: 0.1
|
|
||||||
# Number of times required to punch a block before it breaks
|
|
||||||
# Changing this value is almost never required
|
|
||||||
BLOCK_PUNCH_MIN: 5
|
|
||||||
# Maximum percent error between predicted bow force and actual bow force
|
|
||||||
# Increase in case of false positives
|
|
||||||
BOW_ERROR: 0.25
|
|
||||||
# Number of chat spam violations before action one is executed
|
|
||||||
# Should be changed to personal preference
|
|
||||||
CHAT_ACTION_ONE_LEVEL: 5
|
|
||||||
# Number of chat spam violations before action two is executed
|
|
||||||
# Should be changed to personal preference
|
|
||||||
CHAT_ACTION_TWO_LEVEL: 10
|
|
||||||
# Minimum time between chats in milliseconds
|
|
||||||
# Should be changed to personal preference
|
|
||||||
CHAT_MIN: 500
|
|
||||||
# Time before repeating yourself in chat is ignored in milliseconds
|
|
||||||
# Should be changed to personal preference
|
|
||||||
CHAT_REPEAT_MIN: 600
|
|
||||||
# Number of command spam violations before action one is executed
|
|
||||||
# Should be changed to personal preference
|
|
||||||
COMMAND_ACTION_ONE_LEVEL: 5
|
|
||||||
# Number of command spam violations before action two is executed
|
|
||||||
# Should be changed to personal preference
|
|
||||||
COMMAND_ACTION_TWO_LEVEL: 10
|
|
||||||
# Minimum time between commands in milliseconds
|
|
||||||
# Should be changed to personal preference
|
|
||||||
COMMAND_MIN: 400
|
|
||||||
# Time before repeating a command in milliseconds
|
|
||||||
# Should be changed to personal preference
|
|
||||||
COMMAND_REPEAT_MIN: 500
|
|
||||||
# Time to exempt a player from moving because of taking damage
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increasing in case of false positives is almost never necessary and is not advised
|
|
||||||
DAMAGE_TIME: 3000
|
|
||||||
# Number of item drops to wait for before checking how long they took to drop
|
|
||||||
# Changing this value is almost never required
|
|
||||||
DROP_CHECK: 10
|
|
||||||
# Minimum time it takes to drop X items
|
|
||||||
# Changing this value is almost never required
|
|
||||||
DROP_TIME_MIN: 800
|
|
||||||
# Minimum time in between eating
|
|
||||||
# Decrease in case of false positives
|
|
||||||
EAT_TIME_MIN: 1000
|
|
||||||
# Time to exempt a player from moving because of entering/exiting a vehicle
|
# Time to exempt a player from moving because of entering/exiting a vehicle
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
ENTERED_EXITED_TIME: 1000
|
ENTERED_EXITED_TIME: 2500
|
||||||
# Maximum distance a player can damage an entity from
|
# Time to exempt a player from moving because of teleporting
|
||||||
# Changing this value is almost never required
|
|
||||||
ENTITY_MAX_DISTANCE: 5.9
|
|
||||||
# Maximum distance a player can damage an entity from when in creative mode
|
|
||||||
# Changing this value is almost never required
|
|
||||||
ENTITY_MAX_DISTANCE_CREATIVE: 6.5
|
|
||||||
# Time to exempt a player from moving because of exiting fly mode
|
|
||||||
# Changing this value is almost never required
|
|
||||||
EXIT_FLY_TIME: 2000
|
|
||||||
# Time to exempt a player from moving because of taking damage from an explosion
|
|
||||||
# Can be decreased very slightly to increase detection
|
|
||||||
# Increasing in case of false positives is almost never necessary and is not advised
|
|
||||||
EXPLOSION_DAMAGE_TIME: 5000
|
|
||||||
# Max number of blocks that can be broken in a given time
|
|
||||||
# Increase in case of false positives
|
# Increase in case of false positives
|
||||||
FASTBREAK_LIMIT: 2
|
TELEPORT_TIME: 1500
|
||||||
# Number of times fastbreak can be observed before considering a player a cheater
|
|
||||||
# Can be increased in case of false positives, but shouldn't be required
|
|
||||||
FASTBREAK_MAXVIOLATIONS: 2
|
|
||||||
# Number of times fastbreak can be observed before considering a creative player a cheater
|
|
||||||
# Can be increased in case of false positives, but shouldn't be required
|
|
||||||
FASTBREAK_MAXVIOLATIONS_CREATIVE: 4
|
|
||||||
# Time a player is forced to wait after fastbreak has been detected
|
|
||||||
# Should be changed to personal preference
|
|
||||||
FASTBREAK_MAXVIOLATIONTIME: 10000
|
|
||||||
# Time to wait before checking block breaks
|
|
||||||
# Increase in case of false positives
|
|
||||||
FASTBREAK_TIMEMAX: 1000
|
|
||||||
# Time to wait before checking block breaks for creative mode users
|
|
||||||
# Increase in case of false positives
|
|
||||||
FASTBREAK_TIMEMAX_CREATIVE: 100
|
|
||||||
# Number of times fastplace can be observed before considering a player a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
FASTPLACE_MAXVIOLATIONS: 2
|
|
||||||
# Number of times fastplace can be observed before considering a creative player a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
FASTPLACE_MAXVIOLATIONS_CREATIVE: 3
|
|
||||||
# Time a player is forced to wait after fastplace has been detected
|
|
||||||
# Should be changed to personal preference
|
|
||||||
FASTPLACE_MAXVIOLATIONTIME: 10000
|
|
||||||
# Minimum time in between block places
|
|
||||||
# Decrease in case of false positives, but shouldn't be required
|
|
||||||
FASTPLACE_TIMEMIN: 50
|
|
||||||
# Number of blocks that can be broken without being hit before considering a player a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
FASTPLACE_ZEROLIMIT: 3
|
|
||||||
# How many blocks you can travel before being considered a cheater
|
|
||||||
# Can be decreased to increase detection with the risk of false positives
|
|
||||||
# Can be increased to decrease false positives, but shouldn't be necesary
|
|
||||||
FLIGHT_BLOCK_LIMIT: 5.5
|
|
||||||
# Time to exempt a player from fastbreak check because of using instant break
|
|
||||||
# Increase in case of false positives, but shouldn't be necessary
|
|
||||||
INSTANT_BREAK_TIME: 2
|
|
||||||
# The number of clicks we should wait before checking if the player has used fast inventory
|
|
||||||
# Increase in case of false positives
|
|
||||||
INVENTORY_CHECK: 10
|
|
||||||
# The minimum time it should have taken for the player to click X times
|
|
||||||
# Increase in case of false positives
|
|
||||||
INVENTORY_TIMEMIN: 50
|
|
||||||
# Time to exempt a player from moving because of joining the server
|
# Time to exempt a player from moving because of joining the server
|
||||||
# If your server is slow when a player joins, increasing this value is important
|
# If your server is slow when a player joins, increasing this value is important
|
||||||
# Shouldn't be lower than 1500 or higher than 5000
|
# Shouldn't be lower than 1500 or higher than 5000
|
||||||
JOIN_TIME: 2000
|
JOIN_TIME: 2000
|
||||||
|
# Time to exempt a player from moving because of taking damage
|
||||||
|
# Can be decreased very slightly to increase detection
|
||||||
|
# Increase in case of false positives after taking damage
|
||||||
|
DAMAGE_TIME: 500
|
||||||
# Time to exempt a player from moving because of taking damage with knockback effects
|
# Time to exempt a player from moving because of taking damage with knockback effects
|
||||||
# Can be decreased very slightly to increase detection
|
# Can be decreased very slightly to increase detection
|
||||||
# Increase in case of false positives, but shouldn't be necessary
|
# Increase in case of false positives after knockback
|
||||||
KNOCKBACK_DAMAGE_TIME: 4000
|
KNOCKBACK_DAMAGE_TIME: 2000
|
||||||
# Maximum speed a player on a ladder can travel
|
# Time to exempt a player from moving because of taking damage from an explosion
|
||||||
|
# Can be decreased very slightly to increase detection
|
||||||
|
# Increasing in case of false positives after explosions
|
||||||
|
EXPLOSION_DAMAGE_TIME: 2500
|
||||||
|
# Amount of seconds to extend a players velocitized state after receiving velocity again
|
||||||
|
VELOCITY_EXTENSION: 2
|
||||||
|
# Time a player is considered to have a change in velocity
|
||||||
|
VELOCITY_TIME: 1000
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
LADDER_Y_MAX: 0.11761
|
VELOCITY_PREVENT: 2000
|
||||||
# Minimum speed a player on a ladder can travel
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
LADDER_Y_MIN: 0.11759
|
VELOCITY_MAXTIMES: 2
|
||||||
# Maximum speed a player on a ladder can travel downwards
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
LADDER_DOWN_MAX: 0.15
|
|
||||||
# Number of times a player can fail the nofall check before being considered a cheater
|
|
||||||
# Can be decreased to improve detenction with the risk of false positives
|
|
||||||
# Increase in case of false positives
|
|
||||||
NOFALL_LIMIT: 8
|
|
||||||
# Number of projectiles to wait for before checking how long they took to fire off
|
|
||||||
# Do not decrease this value
|
|
||||||
PROJECTILE_CHECK: 10
|
|
||||||
# Minimum time it takes to fire X projectiles
|
|
||||||
# Decrease in case of false positives
|
|
||||||
PROJECTILE_TIME_MIN: 1500
|
|
||||||
# Time to exempt a player from moving because of entering/exiting sneak mode
|
|
||||||
# Increase in case of false positives, shouldn't be necessary
|
|
||||||
SNEAK_TIME: 250
|
|
||||||
# Maximum times a player can fail the speed check before being considered a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
SPEED_MAX: 3
|
|
||||||
# Number of times a player can sprint without proper food level before being considered a cheater
|
|
||||||
# Can either be increased or decreased to your liking. Shouldn't make a massive difference.
|
|
||||||
SPRINT_FOOD_MIN: 6
|
|
||||||
# Maximum speed you can travel while sprinting
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
SPRINT_MAX: 0.2
|
|
||||||
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
# This is a set value and shouldn't be changed unless you know what you're doing
|
||||||
TELEPORT_MIN: 400
|
TELEPORT_MIN: 400
|
||||||
# Time to exempt a player from moving because of teleporting
|
|
||||||
# Increase in case of false positives
|
|
||||||
TELEPORT_TIME: 1000
|
|
||||||
# Maximum time a player is considered to have a change in velocity
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_CHECKTIME: 2100
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_MAXTIMES: 2
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_PREVENT: 5000
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_SCHETIME: 2
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
VELOCITY_TIME: 3
|
|
||||||
# Number of times a player can fail the ascension check while in water before being considered a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
WATER_ASCENSION_VIOLATION_MAX: 8
|
|
||||||
# Maximum speed that a player can climb a waterfall
|
|
||||||
# Can be increased in case of false positives, shouldn't be necesary
|
|
||||||
WATER_CLIMB_MAX: 0.15
|
|
||||||
# Number of times a player can be caught speeding in water before being considered a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
WATER_SPEED_VIOLATION_MAX: 6
|
|
||||||
# Maximum speed a player can travel forwards or backwards
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX: 0.25
|
|
||||||
# aximum speed a player can travel forwards or backwards while flying
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_FLY: 0.56
|
|
||||||
# Maximum speed a player can travel forwards or backwards while under the influence
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_POTION: 0.7
|
|
||||||
# Maximum speed a player can travel forwards or backwards while sprinting while under the influence
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_POTION_SPRINT: 0.95
|
|
||||||
# Maximum speed a player can travel forwards or backwards while sneaking
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_SNEAK: 0.15
|
|
||||||
# Maximum speed a player can travel forwards or backwards on soul sand
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_SOULSAND: 0.13
|
|
||||||
# Maximum speed a player can travel forwards or backwards on soul sand while under the influenc
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_SOULSAND_POTION: 0.16
|
|
||||||
# Maximum speed a player can travel forwards or backwards on soul sand while sprintin
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_SOULSAND_SPRINT: 0.2
|
|
||||||
# Maximum speed a player can travel forwards or backwards while sprinting
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_SPRINT: 0.65
|
|
||||||
# Maximum speed a player can travel forwards or backwards in water
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_WATER: 0.19
|
|
||||||
# Maximum speed a player can travel forwards or backwards in water while sprinting
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
XZ_SPEED_MAX_WATER_SPRINT: 0.3
|
|
||||||
# Maximum difference between the player's last two Y values when traveling up
|
|
||||||
# Can be decreased slightly to improve detection with the risk of false positives
|
|
||||||
# Increase in case of false positives
|
|
||||||
Y_MAXDIFF: 5.0
|
|
||||||
# Number of times a player can fly on the y-axis before being considered a cheater
|
|
||||||
# Increase in case of false positives
|
|
||||||
Y_MAXVIOLATIONS: 1
|
|
||||||
# Time a player is forced to wait after flyhacking on the y-axis
|
|
||||||
# Should be changed to personal preference
|
|
||||||
Y_MAXVIOTIME: 5500
|
|
||||||
# Maximum speed a player can travel up
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
Y_SPEED_MAX: 0.5175
|
|
||||||
# Time in between Y difference measures
|
|
||||||
# This is a set value and shouldn't be changed unless you know what you're doing
|
|
||||||
Y_TIME: 800
|
|
||||||
# Amount of suspicious mid-air movements before a player is suspected of glide
|
|
||||||
# Increase this in case of false positives
|
|
||||||
GLIDE_LIMIT: 5
|
|
||||||
# The amount of milliseconds to compensate for a teleport (50ms = 1 tick)
|
|
||||||
# Increase this in case of false positives
|
|
||||||
# Can be decreased in to tighten check
|
|
||||||
MOREPACKETS_TELEPORT_COMPENSATION: 200
|
|
||||||
# The amount of milliseconds that were offset to flag for MorePackets (50ms = 1 tick)
|
|
||||||
# Increase this in case of false positives
|
|
||||||
# Can be decreased in to tighten check
|
|
||||||
MOREPACKETS_TRIGGER_BALANCE: 100
|
|
||||||
# The maximum amount of overall lag compensating in milliseconds (50ms = 1 tick)
|
|
||||||
# Increase this in case of false positives
|
|
||||||
# Can be decreased in to tighten check
|
|
||||||
MOREPACKETS_MINIMUM_CLAMP: 200
|
|
||||||
# Maximum amount zero-velocity moments before a player is suspected
|
|
||||||
# Increase this in case of false positives
|
|
||||||
VELOCITY_MAX_FLAGS: 3
|
|
||||||
# The maximum angle difference allowed when attacking
|
|
||||||
# Increase this in case of false positives
|
|
||||||
KILLAURA_MAX_ANGLE_DIFFERENCE: 50
|
|
||||||
# The maximum amount of violations before flagging player as a cheater
|
|
||||||
# Increase this in case of false positives
|
|
||||||
KILLAURA_MAX_ANGLE_VIOLATIONS: 3
|
|
||||||
# The maximum angle difference allowed when placing or breaking a block
|
|
||||||
# Increase this in case of false positives, can be slightly decreased to tighten check
|
|
||||||
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
|
||||||
# The minimum time it takes to regenerate health
|
|
||||||
# Decrease this in case of false positives
|
|
||||||
MIN_HEAL_TIME: 490
|
|
||||||
# Maximum distance allowed between two movement packets
|
|
||||||
# Increase this in case of false positives
|
|
||||||
BADPACKETS_MAX_DISTANCE: 25.0
|
|
||||||
# Maximum amount of fastladder movements before flagging
|
|
||||||
# Increase this in case of false positives
|
|
||||||
FASTLADDER_MAX_FLAGS: 3
|
|
||||||
# The change milliseconds between two keepalives before considering a player to be lagging
|
# The change milliseconds between two keepalives before considering a player to be lagging
|
||||||
# Decrease this in case of clientside lag-related false positives
|
# Decrease this in case of clientside lag-related false positives
|
||||||
# Do not lower below 50 or increase above 75
|
# Do not lower below 50 or increase above 75
|
||||||
|
|||||||
@@ -55,12 +55,6 @@ permissions:
|
|||||||
anticheat.check.waterwalk:
|
anticheat.check.waterwalk:
|
||||||
description: Allow players to walk on water
|
description: Allow players to walk on water
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.noswing:
|
|
||||||
description: Allow players to not ever swing their arm
|
|
||||||
default: false
|
|
||||||
anticheat.check.fastbreak:
|
|
||||||
description: Allow players to quickly break blocks
|
|
||||||
default: false
|
|
||||||
anticheat.check.fastplace:
|
anticheat.check.fastplace:
|
||||||
description: Allow players to use build hacks and fastplace
|
description: Allow players to use build hacks and fastplace
|
||||||
default: false
|
default: false
|
||||||
@@ -100,9 +94,6 @@ permissions:
|
|||||||
anticheat.check.killaura:
|
anticheat.check.killaura:
|
||||||
description: Allow players to use killaura
|
description: Allow players to use killaura
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.longreach:
|
|
||||||
description: Allow players to use longreaching hacks
|
|
||||||
default: false
|
|
||||||
anticheat.check.unicode:
|
anticheat.check.unicode:
|
||||||
description: Allow players to use unicode in chat
|
description: Allow players to use unicode in chat
|
||||||
default: false
|
default: false
|
||||||
@@ -115,9 +106,6 @@ permissions:
|
|||||||
anticheat.check.fastinventory:
|
anticheat.check.fastinventory:
|
||||||
description: Allow players to use fastloot and similar inventory hacks
|
description: Allow players to use fastloot and similar inventory hacks
|
||||||
default: false
|
default: false
|
||||||
anticheat.check.autotool:
|
|
||||||
description: Allow players to use autotool to switch tools quickly
|
|
||||||
default: false
|
|
||||||
anticheat.check.morepackets:
|
anticheat.check.morepackets:
|
||||||
description: Allow players to send lots of movement packets or modify their timer
|
description: Allow players to send lots of movement packets or modify their timer
|
||||||
default: false
|
default: false
|
||||||
@@ -139,6 +127,15 @@ permissions:
|
|||||||
anticheat.check.aimbot:
|
anticheat.check.aimbot:
|
||||||
description: Allow players to use aimbot
|
description: Allow players to use aimbot
|
||||||
default: false
|
default: false
|
||||||
|
anticheat.check.strafe:
|
||||||
|
description: Allow players to use strafe hacks
|
||||||
|
default: false
|
||||||
|
anticheat.check.noslow:
|
||||||
|
description: Allow players to use NoSlow hacks
|
||||||
|
default: false
|
||||||
|
anticheat.check.boatfly:
|
||||||
|
description: Allow players to use boat fly hacks
|
||||||
|
default: false
|
||||||
anticheat.check.exempt:
|
anticheat.check.exempt:
|
||||||
description: Total exemption from checks
|
description: Total exemption from checks
|
||||||
default: false
|
default: false
|
||||||
@@ -146,8 +143,6 @@ permissions:
|
|||||||
anticheat.check.flight: true
|
anticheat.check.flight: true
|
||||||
anticheat.check.elytrafly: true
|
anticheat.check.elytrafly: true
|
||||||
anticheat.check.waterwalk: true
|
anticheat.check.waterwalk: true
|
||||||
anticheat.check.noswing: true
|
|
||||||
anticheat.check.fastbreak: true
|
|
||||||
anticheat.check.fastplace: true
|
anticheat.check.fastplace: true
|
||||||
anticheat.check.chatspam: true
|
anticheat.check.chatspam: true
|
||||||
anticheat.check.commandspam: true
|
anticheat.check.commandspam: true
|
||||||
@@ -161,16 +156,17 @@ permissions:
|
|||||||
anticheat.check.fasteat: true
|
anticheat.check.fasteat: true
|
||||||
anticheat.check.fastheal: true
|
anticheat.check.fastheal: true
|
||||||
anticheat.check.killaura: true
|
anticheat.check.killaura: true
|
||||||
anticheat.check.longreach: true
|
|
||||||
anticheat.check.unicode: true
|
|
||||||
anticheat.check.fastprojectile: true
|
anticheat.check.fastprojectile: true
|
||||||
anticheat.check.itemspam: true
|
anticheat.check.itemspam: true
|
||||||
anticheat.check.fastinventory: true
|
anticheat.check.fastinventory: true
|
||||||
anticheat.check.autotool: true
|
|
||||||
anticheat.check.morepackets: true
|
anticheat.check.morepackets: true
|
||||||
anticheat.check.badpackets: true
|
anticheat.check.badpackets: true
|
||||||
anticheat.check.velocity: true
|
anticheat.check.velocity: true
|
||||||
anticheat.check.criticals: true
|
anticheat.check.criticals: true
|
||||||
|
anticheat.check.unicode: true
|
||||||
anticheat.check.illegalinteract: true
|
anticheat.check.illegalinteract: true
|
||||||
anticheat.check.fastladder: true
|
anticheat.check.fastladder: true
|
||||||
anticheat.check.aimbot: true
|
anticheat.check.aimbot: true
|
||||||
|
anticheat.check.strafe: true
|
||||||
|
anticheat.check.noslow: true
|
||||||
|
anticheat.check.boatfly: true
|
||||||
Reference in new issue
Block a user