Compare commits

...
39 Commits
Author SHA1 Message Date
Rammelkast 0c91ec7ba4 Prepare for release 2020-10-19 18:31:21 +02:00
Rammelkast abff433510 Fix Speed bypass 2020-10-19 16:55:43 +02:00
Rammelkast fad298086c Fix speed false positive 2020-10-19 16:10:00 +02:00
Rammelkast 8b413a382a Fixes for 1.12.2 support 2020-10-18 12:15:25 +02:00
Rammelkast 1428b55591 Added 1.12.x compatibility, not tested yet (#90) 2020-10-18 12:05:54 +02:00
Rammelkast a84b573fa8 Allow /acr report for offline players & small multiversion improvements 2020-10-17 18:46:07 +02:00
Rammelkast 9211003d6d Added #78, magic.yml changes 2020-10-17 14:24:37 +02:00
Rammelkast 01df416236 Fix #112 2020-10-17 14:00:50 +02:00
Rammelkast 619c8efae1 Add BoatFly check, fix WaterWalk false positive 2020-10-17 13:46:54 +02:00
Rammelkast ab2fcc5521 Update to 1.16.3, update dependencies & plugins 2020-10-16 13:57:21 +02:00
Rammelkast 8843725ede Update README 2020-10-16 13:49:44 +02:00
Rammelkast 0d9b8707dd Merge pull request #109 from gcurtiss/master
Add disable broadcast
2020-09-15 13:34:58 +02:00
Gabriel Curtiss 6e2eae7d1e Fix logic error and remove unnecessary line 2020-09-14 16:34:52 -05:00
Gabriel Curtiss ef5b4069ce Add disable broadcast
Prevents public embarassment. Some anarchy server owners like myself want to kick those who have certain hacks but don't want their kick to be publicly known.
2020-09-13 23:39:01 -05:00
Rammelkast 3b9b39c49a Fix error with temporary players, continue work on BoatFly 2020-09-13 20:30:34 +02:00
Rammelkast 09c42905d0 Fixed falses with sweet berry bushes 2020-08-27 14:38:21 +02:00
Rammelkast 8de7ae1c59 Fix #108, update XMaterial, start BoatFly 2020-08-27 11:11:47 +02:00
Rammelkast 768331011e Update to 1.16.2, fix #102, fix #104, fix strafe & reach false positives 2020-08-27 11:05:28 +02:00
Rammelkast 1f48785d1d Changes to update checking, add subcheck in alerts 2020-08-09 17:24:51 +02:00
Rammelkast 7cd90cfb61 Add NoSlow check, fix broken strafe check, fix false positives with speed check, fix BadPackets false positive. 2020-08-06 15:45:25 +02:00
Rammelkast 5f181c556e Fix #101, small change to lag determination and fix 1.8.8 combat checks not working 2020-08-06 13:48:38 +02:00
Rammelkast 16c778c17f Fix WaterWalk false positive 2020-08-04 16:27:31 +02:00
Rammelkast 97534e5df0 Fix false positive with weeping vines 2020-08-04 16:22:00 +02:00
Rammelkast e770d0e01c Fix 1.8.8 support, fix false positive with scaffolding 2020-08-04 10:52:23 +02:00
Rammelkast a59a4baf28 Unchecked attempt at fixing 1.8 compat issues 2020-08-04 10:16:21 +02:00
Rammelkast 7caf7376ba Fix riptide false, small change to lag determination 2020-08-03 20:04:11 +02:00
Rammelkast a6a39e352a Add Strafe check, improve KillAura, fix Elytra false positive, fix BadPackets false positive, 2020-08-03 19:50:18 +02:00
Rammelkast 700c0145f3 Fix #97 and fix #87 2020-08-02 13:08:09 +02:00
Rammelkast c74fc92da9 Fix #96, introduce Strafe check and fix flight, speed false positives 2020-08-01 22:35:51 +02:00
Rammelkast 3bc49141fc Change default velocity minimum percentage, seems to act weird in 1.8.8? 2020-07-30 16:59:09 +02:00
Rammelkast cffd6d07ae Gamebreaking flight false hotfix for 1.8.8 2020-07-30 13:39:02 +02:00
Rammelkast e9a99f0463 False positive fixes: Nofall false with shulkers, flight false positive with snow, speed false positive with snow, waterwalk false positive with boats and KillAura false positive with thorns 2020-07-30 13:26:46 +02:00
Rammelkast 4deb8ae0fb Fixed two WaterWalk falses 2020-07-29 14:26:08 +02:00
Rammelkast 07f957cf35 Fix false positive with horse and jump boost, added "max-setback-distance". 2020-07-29 14:06:49 +02:00
Rammelkast 9850f48a4e Small change to checks.yml, prepare for release 2020-07-28 14:04:44 +02:00
Rammelkast 656841b046 Fixed config issues, enabled/disabled info in /acr checks 2020-07-28 11:12:50 +02:00
Rammelkast fc006c39f2 Fixe false positive when coming out of water 2020-07-27 15:54:26 +02:00
Rammelkast f4ca2ea8bf Fixed issue with config reloading and false positives 2020-07-22 11:16:01 +02:00
Rammelkast 6966582e4c Fixed 3 false positives in water, one with beds and returned to old "getGoodLocation" 2020-07-21 13:19:35 +02:00
49 changed files with 1468 additions and 755 deletions

No files matched your search

+11 -9
View File
@@ -1,4 +1,4 @@
AntiCheatReloaded
AntiCheatReloaded ![Latest Release](https://img.shields.io/github/v/release/Rammelkast/AntiCheatReloaded) ![Downloads](https://img.shields.io/github/downloads/Rammelkast/AntiCheatReloaded/total) ![Last Commit](https://img.shields.io/github/last-commit/Rammelkast/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.
@@ -14,7 +14,7 @@ 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;
* 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
* Whether or not you are using protocol hacks (ViaVersion etc.)
* Any logs relating to the issue
@@ -24,7 +24,6 @@ Hacks blocked
* Flight/Glide
* ElytraFly
* WaterWalk/Jesus
* NoSwing
* FastBreak
* FastPlace
* Chat spam
@@ -38,14 +37,17 @@ Hacks blocked
* FastBow
* FastEat
* FastHeal
* KillAura (Aimbot)
* KillAura
* Aimbot
* Reach
* Unicode chat
* FastProjectile
* ItemSpam
* FastInventory
* MorePackets/Timer
* BadPackets
* Velocity/Anti-Knockback
* IllegalInteract (Scaffold)
* FastLadder
* Timer
* Blink
* Anti-Knockback
* Scaffold
* FastLadder
* Strafe
* NoSlow
+5 -6
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId>
<version>1.9.0-PRE</version>
<version>1.9.4</version>
<name>AntiCheatReloaded</name>
<url>https://www.spigotmc.org/resources/anticheatreloaded.23799/</url>
<properties>
@@ -22,7 +22,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@@ -31,7 +31,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
@@ -44,7 +44,6 @@
<artifactSet>
<includes>
<include>com.rammelkast.*</include>
<include>com.cryptomorin.*</include>
</includes>
</artifactSet>
</configuration>
@@ -55,7 +54,7 @@
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-file</artifactId>
<version>2.2</version>
<version>3.4.1</version>
</extension>
</extensions>
<resources>
@@ -80,7 +79,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<version>1.16.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -40,6 +40,7 @@ import com.rammelkast.anticheatreloaded.event.BlockListener;
import com.rammelkast.anticheatreloaded.event.EntityListener;
import com.rammelkast.anticheatreloaded.event.InventoryListener;
import com.rammelkast.anticheatreloaded.event.PlayerListener;
import com.rammelkast.anticheatreloaded.event.PotionEffectListener;
import com.rammelkast.anticheatreloaded.event.VehicleListener;
import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import com.rammelkast.anticheatreloaded.metrics.Metrics;
@@ -76,6 +77,10 @@ public class AntiCheatReloaded extends JavaPlugin {
eventList.add(new EntityListener());
eventList.add(new VehicleListener());
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
// needed, especially config
this.setupConfig();
@@ -101,8 +106,9 @@ public class AntiCheatReloaded extends JavaPlugin {
: (ChatColor.RED + "(NOT SUPPORTED!)")));
getLogger().info("Enabling packet listeners");
PacketListener.listenKeepAlivePackets();
PacketListener.listenMovementPackets();
PacketListener.listenKeepAlivePackets();
PacketListener.listenUseItemPackets();
updateManager = new UpdateManager();
@@ -164,6 +170,10 @@ public class AntiCheatReloaded extends JavaPlugin {
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
ticks = 1;
}
// Check for updates every 12 hours
if (ticks % 864000 == 0)
updateManager.update();
}
}.runTaskTimer(this, 40L, 1L);
}
@@ -152,5 +152,4 @@ public class AntiCheatAPI {
return AntiCheatReloaded.getManager();
}
}
@@ -18,10 +18,8 @@
*/
package com.rammelkast.anticheatreloaded.check;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -29,6 +27,7 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.potion.PotionEffectType;
@@ -40,6 +39,7 @@ import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
import com.rammelkast.anticheatreloaded.check.movement.AimbotCheck;
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import com.rammelkast.anticheatreloaded.check.movement.NoSlowCheck;
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.providers.Checks;
@@ -54,7 +54,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class Backend {
public Map<UUID, Long> velocitized = new HashMap<UUID, Long>();
private Map<UUID, Long> levitatingEnd = new HashMap<UUID, Long>();
private List<UUID> isAscending = new ArrayList<UUID>();
private Map<UUID, Integer> chatLevel = new HashMap<UUID, Integer>();
private Map<UUID, Integer> commandLevel = new HashMap<UUID, Integer>();
private Map<UUID, Integer> nofallViolation = new HashMap<UUID, Integer>();
@@ -120,7 +119,6 @@ public class Backend {
startEat.remove(uuid);
lastHeal.remove(uuid);
sprinted.remove(uuid);
isAscending.remove(uuid);
nofallViolation.remove(uuid);
blockBreakHolder.remove(uuid);
fastPlaceViolation.remove(uuid);
@@ -153,7 +151,10 @@ public class Backend {
MorePacketsCheck.EXEMPT_TIMINGS.remove(uuid);
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
KillAuraCheck.PACKETORDER_FLAGS.remove(uuid);
FlightCheck.MOVING_EXEMPT.remove(uuid);
NoSlowCheck.LAST_RELEASE.remove(uuid);
NoSlowCheck.VIOLATIONS.remove(uuid);
}
public CheckResult checkFastBow(Player player, float force) {
@@ -216,7 +217,8 @@ public class Backend {
public CheckResult checkSpider(Player player, double y) {
if (y <= 0.11761 && y >= 0.11759 && !Utilities.isClimbableBlock(player.getLocation().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,
"tried to climb a non-climbable block (" + player.getLocation().getBlock().getType() + ")");
} else {
@@ -229,7 +231,8 @@ public class Backend {
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
&& !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 (nofallViolation.get(uuid) == null) {
nofallViolation.put(uuid, 1);
@@ -304,15 +307,6 @@ public class Backend {
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 checkFastPlace(Player player) {
int vlBeforeFlagSurvival = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagSurvival");
int vlBeforeFlagCreative = checksConfig.getInteger(CheckType.FAST_PLACE, "vlBeforeFlagCreative");
@@ -613,10 +607,6 @@ public class Backend {
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) {
// TODO config??
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + 100 /* 2 ticks */);
@@ -631,10 +621,6 @@ public class Backend {
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) {
if (map.containsKey(player.getUniqueId())) {
if (max != -1) {
@@ -26,6 +26,7 @@ public class CheckResult {
}
private Result result;
private String subCheck;
private String message;
private int data;
@@ -34,6 +35,12 @@ public class CheckResult {
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) {
this(result);
this.message = message;
@@ -46,11 +53,15 @@ public class CheckResult {
public boolean failed() {
return result == Result.FAILED;
}
public String getSubCheck() {
return subCheck;
}
public String getMessage() {
return message;
}
public Result getResult() {
return result;
}
@@ -62,7 +62,10 @@ public enum CheckType {
CHAT_UNICODE(Permission.CHECK_UNICODE, "ChatUnicode"),
ILLEGAL_INTERACT(Permission.CHECK_ILLEGALINTERACT, "IllegalInteract"),
FASTLADDER(Permission.CHECK_FASTLADDER, "FastLadder"),
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot");
AIMBOT(Permission.CHECK_AIMBOT, "Aimbot"),
STRAFE(Permission.CHECK_STRAFE, "Strafe"),
NOSLOW(Permission.CHECK_NOSLOW, "NoSlow"),
BOATFLY(Permission.CHECK_BOATFLY, "BoatFly");
private final Permission permission;
private final String displayName;
@@ -41,7 +41,7 @@ public class CriticalsCheck {
event.setCancelled(true);
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
.getMessage(),
player, CheckType.CRITICALS);
player, CheckType.CRITICALS, null);
}
}
}
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -32,7 +33,9 @@ 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.User;
import com.rammelkast.anticheatreloaded.util.Utilities;
@@ -40,6 +43,8 @@ public class KillAuraCheck {
// Angle check
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);
public static CheckResult checkReach(Player player, Entity target) {
@@ -55,6 +60,8 @@ public class KillAuraCheck {
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",
@@ -74,7 +81,7 @@ public class KillAuraCheck {
double reachedDistance = ((LivingEntity) target).getLocation().toVector()
.distance(player.getLocation().toVector());
if (reachedDistance > allowedReach)
return new CheckResult(CheckResult.Result.FAILED,
return new CheckResult(CheckResult.Result.FAILED, "Reach",
"reached too far (distance=" + Utilities.roundDouble(reachedDistance, 6) + ", max=" + Utilities.roundDouble(allowedReach, 6) + ")");
return PASS;
}
@@ -107,7 +114,7 @@ public class KillAuraCheck {
int vlBeforeFlag = checksConfig.getInteger(CheckType.KILLAURA, "angle", "vlBeforeFlag");
if (flags >= vlBeforeFlag) {
ANGLE_FLAGS.remove(uuid);
return new CheckResult(CheckResult.Result.FAILED,
return new CheckResult(CheckResult.Result.FAILED, "Angle",
"tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
}
@@ -118,6 +125,39 @@ public class KillAuraCheck {
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;
}
public static double calculateYawDifference(Location from, Location to) {
Location clonedFrom = from.clone();
Vector startVector = clonedFrom.toVector();
@@ -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.check.CheckResult;
import com.rammelkast.anticheatreloaded.util.Distance;
import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class ElytraCheck {
@@ -38,10 +39,9 @@ public class ElytraCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult runCheck(Player player, Distance distance) {
// No elytra in server version
if (VersionUtil.isBountifulUpdate()) {
// No elytra in server version or not relevant
if (VersionUtil.isBountifulUpdate() || Utilities.isNearWater(player))
return PASS;
}
UUID uuid = player.getUniqueId();
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
@@ -49,8 +49,10 @@ public class FlightCheck {
public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() >= AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()
|| VersionUtil.isFlying(player)) {
// This was a teleport or user is flying/using elytra, so we don't care
|| VersionUtil.isFlying(player) || player.getVehicle() != null
|| 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.
return PASS;
}
@@ -60,23 +62,19 @@ public class FlightCheck {
Backend backend = AntiCheatReloaded.getManager().getBackend();
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (Utilities.isNearWater(player) || movementManager.halfMovement
|| Utilities.isClimbableBlock(distance.getFrom().getBlock())
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN))
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.UP)))
if (movementManager.nearLiquidTicks > 0 || movementManager.halfMovement || Utilities.isNearClimbable(player))
return PASS;
int minAirTicks = 13;
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
minAirTicks += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 3;
}
if (player.hasPotionEffect(PotionEffectType.JUMP))
minAirTicks += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 3;
if (movementManager.halfMovementHistoryCounter > 25)
minAirTicks += 5;
// Start AirFlight
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airFlight") && movementManager.airTicks > minAirTicks
&& !backend.justVelocity(player)) {
&& !backend.justVelocity(player) && movementManager.elytraEffectTicks <= 25) {
// Config default base is 1200ms
// Ping clamped to max. 1000 to prevent spoofing for an advantage
int blockPlaceAccountingTime = (int) (checksConfig.getInteger(CheckType.FLIGHT, "airFlight",
@@ -90,50 +88,64 @@ public class FlightCheck {
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
: (blockPlaceAccountingTime + 1);
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
return new CheckResult(CheckResult.Result.FAILED,
// 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.isInWeb(player))
return new CheckResult(CheckResult.Result.FAILED, "had too little Y dropoff (diff="
&& !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 two hardcoded values here shouldn't be there, temp against false
// 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")))
return new CheckResult(CheckResult.Result.FAILED,
.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")))
return new CheckResult(CheckResult.Result.FAILED,
.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))
&& movementManager.groundTicks > 2) {
return new CheckResult(CheckResult.Result.FAILED,
&& Utilities.cantStandAt(distance.getTo().getBlock())) {
return new CheckResult(CheckResult.Result.FAILED, "GroundFlight",
"faked ground to fly (mY=" + movementManager.motionY + ", gt=" + movementManager.groundTicks + ")");
}
// End GroundFlight
@@ -143,7 +155,8 @@ public class FlightCheck {
&& movementManager.motionY < 0 && !backend.justVelocity(player)
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
.getInteger(CheckType.FLIGHT, "gravity", "accountForTeleports"))
&& !Utilities.isInWeb(player)) {
&& !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");
@@ -152,7 +165,7 @@ public class FlightCheck {
GRAVITY_VIOLATIONS.put(player.getUniqueId(), vl);
int vlBeforeFlag = checksConfig.getInteger(CheckType.FLIGHT, "gravity", "vlBeforeFlag");
if (vl >= vlBeforeFlag)
return new CheckResult(CheckResult.Result.FAILED,
return new CheckResult(CheckResult.Result.FAILED, "Gravity",
"ignored gravity (offset=" + offset + ", at=" + movementManager.airTicks + ")");
} else {
GRAVITY_VIOLATIONS.remove(player.getUniqueId());
@@ -163,31 +176,4 @@ public class FlightCheck {
return PASS;
}
public static boolean isMovingExempt(Player player) {
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
}
private static boolean isDoing(Player player, Map<UUID, Long> map, double max) {
if (map.containsKey(player.getUniqueId())) {
if (max != -1) {
if (((System.currentTimeMillis() - map.get(player.getUniqueId())) / 1000) > max) {
map.remove(player.getUniqueId());
return false;
} else {
return true;
}
} else {
// Termination time has already been calculated
if (map.get(player.getUniqueId()) < System.currentTimeMillis()) {
map.remove(player.getUniqueId());
return false;
} else {
return true;
}
}
} else {
return false;
}
}
}
@@ -0,0 +1,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());
}
});
}
}
@@ -34,8 +34,7 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
/**
* @author Rammelkast
* TODO soulsand speed
* @author Rammelkast TODO soulsand speed
*/
public class SpeedCheck {
@@ -55,9 +54,10 @@ public class SpeedCheck {
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
double distanceXZ = movementManager.distanceXZ;
boolean boxedIn = movementManager.topSolid && movementManager.bottomSolid;
// AirSpeed
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1 && movementManager.elytraEffectTicks <= 0) {
if (checksConfig.isSubcheckEnabled(CheckType.SPEED, "airSpeed") && movementManager.airTicks > 1
&& movementManager.elytraEffectTicks <= 0 && !Utilities.isNearClimbable(player)) {
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
@@ -70,12 +70,12 @@ public class SpeedCheck {
if (boxedIn)
iceIncrement += 0.45D;
if (!Utilities.couldBeOnIce(movingTowards))
iceIncrement *= 2.5D;
iceIncrement *= 2.5D;
predict += iceIncrement;
}
// Leniency when boxed in
if (boxedIn && movementManager.airTicks < 3)
limit *= 1.2D;
predict *= 1.2D;
// Adjust for slime
if (movementManager.slimeInfluenceTicks > 0) {
double slimeIncrement = 0.022 * Math.pow(1.0375, movementManager.slimeInfluenceTicks);
@@ -85,13 +85,16 @@ public class SpeedCheck {
predict += slimeIncrement;
}
// Adjust for speed effects
if (player.hasPotionEffect(PotionEffectType.SPEED))
predict += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
if (movementManager.hasSpeedEffect)
predict += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
if (movementManager.hadSpeedEffect && !movementManager.hasSpeedEffect)
limit *= 1.2D;
// Adjust for jump boost effects
if (player.hasPotionEffect(PotionEffectType.JUMP))
predict += (player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() + 1) * 0.05D;
predict += VersionUtil.getPotionLevel(player, PotionEffectType.JUMP) * 0.05D;
// Adjust for custom walking speed
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default 1.4
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airSpeed", "walkSpeedMultiplier"); // Default
// 1.4
predict += walkSpeedMultiplier * (Math.pow(1.1, ((player.getWalkSpeed() / 0.20) - 1)) - 1);
// Slabs sometimes allow for a slight boost after jump
if (movementManager.halfMovementHistoryCounter > 0)
@@ -99,24 +102,33 @@ public class SpeedCheck {
if (Utilities.couldBeOnHalfblock(movingTowards) && movementManager.halfMovementHistoryCounter == 0)
predict *= 1.25D;
// Boats sometimes give a false positive
if (Utilities.couldBeOnBoat(player, 0.5))
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
// 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.06)
predict *= 1.5D;
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
// TODO better way for this
if (player.isBlocking() && movementManager.airTicks > 2)
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, "moved too fast in air (speed=" + distanceXZ
+ ", limit=" + predict + ", block=" + player.isBlocking() + ", box=" + boxedIn + ", at=" + movementManager.airTicks + ")");
return new CheckResult(CheckResult.Result.FAILED, "AirSpeed",
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ", block="
+ movementManager.blockingTicks + ", box=" + boxedIn + ", at="
+ movementManager.airTicks + ")");
}
}
@@ -129,21 +141,22 @@ public class SpeedCheck {
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
// Slight increase when boxed in
if (boxedIn)
limit *= 1.05D;
limit *= 1.08D;
// Adjust for speed effects
if (player.hasPotionEffect(PotionEffectType.SPEED))
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.0225D;
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
// Adjust for slabs
if (movementManager.halfMovementHistoryCounter > 15)
limit *= 2.0D;
// Adjust for custom walking speed
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "walkSpeedMultiplier"); // Default 1.4
double walkSpeedMultiplier = checksConfig.getDouble(CheckType.SPEED, "airAcceleration",
"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,
return new CheckResult(CheckResult.Result.FAILED, "AirAcceleration",
"exceeded acceleration limits (acceleration=" + initialAcceleration + ", max=" + limit + ")");
}
}
@@ -154,16 +167,20 @@ public class SpeedCheck {
&& !boxedIn && movementManager.slimeInfluenceTicks <= 10) {
// This happens naturally
if (movementManager.airTicksBeforeGrounded == movementManager.groundTicks) {
double minimumDistXZ = checksConfig.getDouble(CheckType.SPEED, "jumpBehaviour", "minimumDistXZ"); // Default 0.42
if (distanceXZ >= minimumDistXZ) {
return new CheckResult(CheckResult.Result.FAILED, "had unexpected jumping behaviour");
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 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)
@@ -171,12 +188,19 @@ public class SpeedCheck {
// 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 (player.hasPotionEffect(PotionEffectType.SPEED))
limit += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.06D;
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))
@@ -207,51 +231,57 @@ public class SpeedCheck {
limit *= 0.65D;
// Sneak speed check
// TODO config
if (player.isSneaking())
if (movementManager.sneakingTicks > 1)
limit *= 0.68D;
if (distanceXZ - limit > 0) {
return new CheckResult(CheckResult.Result.FAILED,
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking=" + player.isBlocking() + ")");
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();
if (isSpeedExempt(player, backend) || player.getVehicle() != null || player.isSleeping()
|| VersionUtil.isRiptiding(player) || Utilities.isNearWater(player))
return PASS;
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
.getMovementManager();
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
if (!checksConfig.isSubcheckEnabled(CheckType.SPEED, "verticalSpeed"))
return PASS;
if (player.isInsideVehicle() || player.isSleeping()
|| backend.isDoing(player, backend.velocitized, backend.getMagic().VELOCITY_EXTENSION()) || VersionUtil.isFlying(player)
|| VersionUtil.isRiptiding(player)) {
return PASS;
}
double maxMotionY = getMaxAcceptableMotionY(player, Utilities.isNearBed(distance.getTo()),
Utilities.couldBeOnBoat(player), Utilities.isClimbableBlock(distance.getFrom().getBlock())
|| Utilities.isClimbableBlock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN)), movementManager.halfMovement, checksConfig);
Utilities.couldBeOnBoat(player),
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,
return new CheckResult(CheckResult.Result.FAILED, "VerticalSpeed",
"exceeded vertical speed limit (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
}
return PASS;
}
private static double getMaxAcceptableMotionY(Player player, boolean nearBed, boolean couldBeOnBoat, boolean fromClimbable, boolean halfMovement, Checks checksConfig) {
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 ? 0.6 : 0.42));
// 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 += player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() * 0.2D;
}
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;
}
}
@@ -32,6 +32,7 @@ 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.VersionUtil;
public class WaterWalkCheck {
@@ -42,34 +43,38 @@ public class WaterWalkCheck {
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
MovementManager movementManager = user.getMovementManager();
if (movementManager.distanceXZ <= 0)
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null || Utilities.isOnLilyPad(player)
|| VersionUtil.isRiptiding(player) || VersionUtil.isSwimming(player) || VersionUtil.isFlying(player))
return PASS;
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
Block blockBeneath = player.getLocation().clone().subtract(0, 0.1, 0).getBlock();
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "walk") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player)
&& (movementManager.motionY == 0 || movementManager.motionY == Utilities.JUMP_MOTION_Y)
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ"))
return new CheckResult(Result.FAILED,
&& ((movementManager.motionY == 0 && movementManager.lastMotionY == 0)
|| movementManager.motionY == Utilities.JUMP_MOTION_Y)
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "walk", "minimumDistXZ")
&& !movementManager.topSolid && !Utilities.couldBeOnBoat(player, 3, false))
return new CheckResult(Result.FAILED, "Walk",
"tried to walk on water (xz=" + Utilities.roundDouble(movementManager.distanceXZ, 5) + ")");
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "hop") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player) && movementManager.onGround
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "maxMotionY"))
return new CheckResult(Result.FAILED,
&& Math.abs(movementManager.motionY) < checksConfig.getDouble(CheckType.WATER_WALK, "hop", "maxMotionY")
&& !Utilities.couldBeOnBoat(player, 0.3, false))
return new CheckResult(Result.FAILED, "Hop",
"tried to hop on water (mY=" + Utilities.roundDouble(movementManager.motionY, 5) + ")");
double minAbsMotionY = 0.08D;
double minAbsMotionY = 0.12D;
if (player.hasPotionEffect(PotionEffectType.SPEED))
minAbsMotionY += (player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() + 1) * 0.05D;
minAbsMotionY += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.05D;
if (checksConfig.isSubcheckEnabled(CheckType.WATER_WALK, "lunge") && blockBeneath.isLiquid()
&& Utilities.isSurroundedByWater(player)
&& Math.abs(movementManager.lastMotionY - movementManager.motionY) > minAbsMotionY
&& movementManager.distanceXZ > checksConfig.getDouble(CheckType.WATER_WALK, "lunge", "minimumDistXZ")
&& movementManager.lastMotionY > -0.25)
return new CheckResult(Result.FAILED, "tried to lunge in water (xz="
&& 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) + ")");
@@ -32,6 +32,7 @@ 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 BadPacketsCheck {
@@ -39,9 +40,10 @@ public class BadPacketsCheck {
public static void runCheck(Player player, PacketEvent event) {
Backend backend = AntiCheatReloaded.getManager().getBackend();
// Confirm if we should even check for BadPackets
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS) || backend.isMovingExempt(player)) {
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.BADPACKETS)
|| backend.isMovingExempt(player) || player.isDead())
return;
}
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
PacketContainer packet = event.getPacket();
float pitch = packet.getFloat().read(1);
@@ -50,13 +52,15 @@ public class BadPacketsCheck {
flag(player, event, "had an illegal pitch");
return;
}
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
double tps = AntiCheatReloaded.getPlugin().getTPS();
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")) {
MovementManager movementManager = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId())
.getMovementManager();
if (user.isLagging() || tps < checksConfig.getDouble(CheckType.MOREPACKETS, "minimumTps")
|| (System.currentTimeMillis() - movementManager.lastTeleport <= 150))
return;
}
double x = packet.getDoubles().read(0);
double y = packet.getDoubles().read(1);
double z = packet.getDoubles().read(2);
@@ -66,14 +70,18 @@ public class BadPacketsCheck {
Location current = new Location(previous.getWorld(), x, y, z, yaw, pitch);
double distance = previous.distanceSquared(current);
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);
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;
} else if (distance < 1E-10 && !hasNewLocation) {
// TODO this gives false positives when teleporting
// Only found this in 1.8.8 though
//flag(player, event, "sent the same packet twice");
// flag(player, event, "sent the same packet twice");
return;
}
}
@@ -85,7 +93,7 @@ public class BadPacketsCheck {
@Override
public void run() {
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
CheckType.BADPACKETS);
CheckType.BADPACKETS, null);
player.teleport(player.getLocation());
}
});
@@ -88,7 +88,7 @@ public class MorePacketsCheck {
@Override
public void run() {
EventListener.log(new CheckResult(CheckResult.Result.FAILED, message).getMessage(), player,
CheckType.MOREPACKETS);
CheckType.MOREPACKETS, null);
player.teleport(player.getLocation());
}
});
@@ -47,7 +47,8 @@ public class IllegalInteract {
} else if (event instanceof BlockBreakEvent
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "break")) {
return checkBlockBreak(player, (BlockBreakEvent) event);
} else if (event instanceof PlayerInteractEvent && checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
} else if (event instanceof PlayerInteractEvent
&& checksConfig.isSubcheckEnabled(CheckType.ILLEGAL_INTERACT, "interact")) {
return checkInteract(player, (PlayerInteractEvent) event);
}
return PASS;
@@ -67,21 +68,22 @@ public class IllegalInteract {
maxDistance += player.getVelocity().length()
* checksConfig.getDouble(CheckType.ILLEGAL_INTERACT, "interact", "velocityMultiplier");
if (distance > maxDistance) {
return new CheckResult(CheckResult.Result.FAILED, "tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
return new CheckResult(CheckResult.Result.FAILED, "Interact",
"tried to interact out of range (dist=" + distance + ", max=" + maxDistance + ")");
}
return PASS;
}
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
if (!isValidTarget(player, event.getBlock())) {
return new CheckResult(CheckResult.Result.FAILED, "tried to break a block which was out of view");
return new CheckResult(CheckResult.Result.FAILED, "Break", "tried to break a block which was out of view");
}
return PASS;
}
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
if (!isValidTarget(player, event.getBlock())) {
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block out of their view");
return new CheckResult(CheckResult.Result.FAILED, "Place", "tried to place a block out of their view");
}
return PASS;
}
@@ -89,8 +91,7 @@ public class IllegalInteract {
private static boolean isValidTarget(Player player, Block block) {
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
double distance = player.getGameMode() == GameMode.CREATIVE ? 6.0
: player.getLocation().getDirection().getY() > 0.9 ? 6.0
: 5.5;
: player.getLocation().getDirection().getY() > 0.9 ? 6.0 : 5.5;
Block targetBlock = VersionUtil.getTargetBlock(player, ((int) Math.ceil(distance)));
if (targetBlock == null) {
// TODO better check here
@@ -66,7 +66,7 @@ public class CommandBase {
execute(cs, args);
} else {
if (args == null) {
cs.sendMessage(GOLD + "" + ChatColor.BOLD + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
cs.sendMessage(GRAY + "Running " + GOLD + "" + "AntiCheatReloaded " + GRAY + "version " + AntiCheatReloaded.getVersion());
} else {
cs.sendMessage(PERMISSIONS_ERROR + " (" + WHITE + permission.toString() + RED + ")");
}
@@ -19,39 +19,44 @@
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];
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();
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[1] = builder.toString();
}
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);
}
public CommandChecks() {
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
}
@Override
protected void execute(CommandSender cs, String[] args) {
sendHelp(cs);
}
@Override
protected void execute(CommandSender cs, String[] args) {
sendHelp(cs);
}
}
@@ -19,6 +19,7 @@
package com.rammelkast.anticheatreloaded.command.executors;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import com.rammelkast.anticheatreloaded.command.CommandBase;
@@ -41,6 +42,6 @@ public class CommandReload extends CommandBase {
@Override
protected void execute(CommandSender cs, String[] args) {
CONFIG.load();
cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
cs.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + "The configuration was reloaded");
}
}
@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded.command.executors;
import java.util.ArrayList;
@@ -25,8 +24,8 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckType;
@@ -38,153 +37,158 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
public class CommandReport extends CommandBase {
private static final String NAME = "AntiCheatReloaded Reports";
private static final String COMMAND = "report";
private static final String USAGE = "anticheat report [group/user]";
private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
private static final String[] HELP = {
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
};
private static final String NAME = "AntiCheatReloaded Reports";
private static final String COMMAND = "report";
private static final String USAGE = "anticheat report [group/user]";
private static final Permission PERMISSION = Permission.SYSTEM_REPORT;
private static final String[] HELP = {
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report", };
public CommandReport() {
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
}
public CommandReport() {
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
}
@Override
protected void execute(CommandSender cs, String[] args) {
if (args.length >= 1) {
int page = 1;
if (args.length == 2) {
if (Utilities.isInt(args[1])) {
page = Integer.parseInt(args[1]);
} else {
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[1]);
}
}
@Override
protected void execute(CommandSender cs, String[] args) {
if (args.length >= 1) {
int page = 1;
if (args.length == 2) {
if (Utilities.isInt(args[1])) {
page = Integer.parseInt(args[1]);
} else {
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[1]);
}
}
if ("low".equalsIgnoreCase(args[0])) {
groupReport(cs, null, page);
}
else if ("all".equalsIgnoreCase(args[0])) {
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
for (Group g : CONFIG.getGroups().getGroups()) {
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
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.");
} else {
// Test groups
for (Group group : CONFIG.getGroups().getGroups()) {
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0]) || "all".equalsIgnoreCase(args[0])) {
groupReport(cs, group, page);
return;
}
}
Player targetPlayer = Bukkit.getPlayer(args[0]);
if (targetPlayer == null) {
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
return;
}
if ("low".equalsIgnoreCase(args[0])) {
groupReport(cs, null, page);
} else if ("all".equalsIgnoreCase(args[0])) {
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
for (Group g : CONFIG.getGroups().getGroups()) {
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
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.");
} else {
// Test groups
for (Group group : CONFIG.getGroups().getGroups()) {
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0])
|| "all".equalsIgnoreCase(args[0])) {
groupReport(cs, group, page);
return;
}
}
// Test users
for (Player player : Bukkit.getOnlinePlayers()) {
if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) {
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
playerReport(cs, user, page);
return;
}
}
@SuppressWarnings("deprecation")
OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[0]);
if (targetPlayer == null) {
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
return;
}
// Neither of these
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
}
} else {
sendHelp(cs);
}
}
User user = AntiCheatReloaded.getManager().getUserManager().getUser(targetPlayer.getUniqueId());
if (user != null) {
playerReport(cs, user, page);
return;
}
private void groupReport(CommandSender cs, Group group, int page) {
List<User> users = USER_MANAGER.getUsersInGroup(group);
ChatColor color = group == null ? GREEN : group.getColor();
String groupName = group == null ? "Low" : group.getName();
int pages = (int) Math.ceil(((float) users.size()) / 7);
if (page <= pages && page > 0) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Group: " + color + groupName);
for (int x = 0; x < 7; x++) {
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
if (index < users.size()) {
String player = users.get(index).getName();
cs.sendMessage(GRAY + player);
}
}
cs.sendMessage(MENU_END);
} else {
if (pages == 0) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Group: " + color + groupName);
cs.sendMessage(GRAY + "There are no users in this group.");
cs.sendMessage(MENU_END);
} else {
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
}
}
}
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
}
} else {
sendHelp(cs);
}
}
private void playerReport(CommandSender cs, User user, int page) {
List<CheckType> types = new ArrayList<CheckType>();
for (CheckType type : CheckType.values()) {
if (type.getUses(user.getUUID()) > 0) {
types.add(type);
}
}
private void groupReport(CommandSender cs, Group group, int page) {
List<User> users = USER_MANAGER.getUsersInGroup(group);
ChatColor color = group == null ? GREEN : group.getColor();
String groupName = group == null ? "Low" : group.getName();
int pages = (int) Math.ceil(((float) users.size()) / 7);
if (page <= pages && page > 0) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD
+ "]----------------------");
cs.sendMessage(GRAY + "Group: " + color + groupName);
for (int x = 0; x < 7; x++) {
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
if (index < users.size()) {
String player = users.get(index).getName();
cs.sendMessage(GRAY + player);
}
}
cs.sendMessage(MENU_END);
} else {
if (pages == 0) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Group: " + color + groupName);
cs.sendMessage(GRAY + "There are no users in this group.");
cs.sendMessage(MENU_END);
} else {
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages);
}
}
}
UUID uuid = user.getUUID();
String name = user.getName();
int pages = (int) Math.ceil(((float) types.size()) / 6);
private void playerReport(CommandSender cs, User user, int page) {
List<CheckType> types = new ArrayList<CheckType>();
for (CheckType type : CheckType.values()) {
if (type.getUses(user.getUUID()) > 0) {
types.add(type);
}
}
Group group = user.getGroup();
String groupString = GREEN + "Low";
UUID uuid = user.getUUID();
String name = user.getName();
int pages = (int) Math.ceil(((float) types.size()) / 6);
if (group != null) {
groupString = group.getColor() + group.getName();
}
groupString += " (" + user.getLevel() + ")";
Group group = user.getGroup();
String groupString = GREEN + "Low";
if (page <= pages && page > 0) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + name);
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
cs.sendMessage(GRAY + "Group: " + groupString);
for (int x = 0; x < 6; x++) {
int index = ((page - 1) * 5) + (x + ((page - 1)));
if (index < types.size()) {
CheckType type = types.get(index);
int use = type.getUses(uuid);
ChatColor color = WHITE;
if (use >= 20) {
color = YELLOW;
} else if (use > 50) {
color = RED;
}
cs.sendMessage(GRAY + type.getName() + ": " + color + use);
}
}
cs.sendMessage(MENU_END);
} else {
if (pages == 0 && page == 1) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + name);
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
cs.sendMessage(GRAY + "Group: " + groupString);
cs.sendMessage(GRAY + "This user has not failed any checks.");
cs.sendMessage(MENU_END);
} else {
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
}
}
}
if (group != null) {
groupString = group.getColor() + group.getName();
}
groupString += " (" + user.getLevel() + ")";
if (page <= pages && page > 0) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD
+ "]----------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + name);
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);
for (int x = 0; x < 6; x++) {
int index = ((page - 1) * 5) + (x + ((page - 1)));
if (index < types.size()) {
CheckType type = types.get(index);
int use = type.getUses(uuid);
ChatColor color = WHITE;
if (use >= 20) {
color = YELLOW;
} else if (use > 50) {
color = RED;
}
cs.sendMessage(GRAY + type.getName() + ": " + color + use);
}
}
cs.sendMessage(MENU_END);
} else {
if (pages == 0 && page == 1) {
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + name);
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 + "This user has not failed any checks.");
cs.sendMessage(MENU_END);
} else {
cs.sendMessage(RED + "Page not found. Requested " + WHITE + page + RED + ", Max " + WHITE + pages + 1);
}
}
}
}
@@ -151,12 +151,15 @@ public class Configuration {
file.load();
checkReload(file);
}
for (ConfigurationTable table : dbfiles) {
for (ConfigurationTable table : dbfiles)
table.load();
}
if (manager.getBackend() != null) {
if (manager.getBackend() != null)
manager.getBackend().updateConfig(this);
}
if (manager.getCheckManager() != null)
manager.getCheckManager().loadCheckIgnoreList(this);
}
private void checkReload(ConfigurationFile file) {
@@ -36,6 +36,7 @@ public class Config extends ConfigurationFile {
public ConfigValue<Boolean> eventChains;
public ConfigValue<Boolean> enterprise;
public ConfigValue<Boolean> debugMode;
public ConfigValue<Boolean> disableBroadcast;
public ConfigValue<Boolean> blockChatSpamSpeed;
public ConfigValue<Boolean> blockCommandSpamSpeed;
@@ -51,6 +52,7 @@ public class Config extends ConfigurationFile {
public ConfigValue<List<String>> disabledWorlds;
public ConfigValue<Integer> notifyEveryVl;
public ConfigValue<Integer> maxSetbackDistance;
public Config(AntiCheatReloaded plugin, Configuration config) {
super(plugin, config, FILENAME);
@@ -66,6 +68,7 @@ public class Config extends ConfigurationFile {
eventChains = new ConfigValue<Boolean>("system.event-chains");
enterprise = new ConfigValue<Boolean>("system.enterprise");
debugMode = new ConfigValue<Boolean>("system.debug-mode");
disableBroadcast = new ConfigValue<Boolean>("system.disable-broadcast");
blockChatSpamSpeed = new ConfigValue<Boolean>("spam.chat.block-speed");
blockChatSpamRepetition = new ConfigValue<Boolean>("spam.chat.block-repetition");
@@ -85,5 +88,9 @@ public class Config extends ConfigurationFile {
if (notifyEveryVl.getValue() < 1) {
notifyEveryVl.setValue(5);
}
maxSetbackDistance = new ConfigValue<Integer>("system.max-setback-distance");
if (maxSetbackDistance.getValue() < 5) {
maxSetbackDistance.setValue(50);
}
}
}
@@ -99,4 +99,12 @@ public interface Lang {
* @return Kicking broadcast.
*/
public String KICK_BROADCAST();
/**
* Get the alert prefix for staff and debug.
*
* @return Alert prefix.
*/
public String ALERT_PREFIX();
}
@@ -46,10 +46,6 @@ public interface Magic {
* Time to exempt a player from moving because of teleporting; Type=SYSTEM, Leniency=INCREASE.
*/
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.
*/
@@ -38,7 +38,7 @@ public class BlockListener extends EventListener {
CheckResult result = getBackend().checkFastPlace(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_PLACE);
log(result.getMessage(), player, CheckType.FAST_PLACE, result.getSubCheck());
noHack = false;
}
}
@@ -47,7 +47,7 @@ public class BlockListener extends EventListener {
CheckResult result = IllegalInteract.performCheck(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
noHack = false;
}
}
@@ -67,7 +67,7 @@ public class BlockListener extends EventListener {
result = IllegalInteract.performCheck(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
noHack = false;
}
}
@@ -27,7 +27,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.EntityShootBowEvent;
@@ -42,17 +42,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class EntityListener 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());
}
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event) {
if (event.getEntity() instanceof Player) {
@@ -61,7 +50,7 @@ public class EntityListener extends EventListener {
CheckResult result = getBackend().checkFastBow(player, event.getForce());
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_BOW);
log(result.getMessage(), player, CheckType.FAST_BOW, result.getSubCheck());
} else {
decrease(player);
}
@@ -79,7 +68,7 @@ public class EntityListener extends EventListener {
CheckResult result = getBackend().checkFastHeal(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_HEAL);
log(result.getMessage(), player, CheckType.FAST_HEAL, result.getSubCheck());
} else {
decrease(player);
getBackend().logHeal(player);
@@ -99,7 +88,7 @@ public class EntityListener extends EventListener {
CheckResult result = getBackend().checkFastEat(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.FAST_EAT);
log(result.getMessage(), player, CheckType.FAST_EAT, result.getSubCheck());
} else {
decrease(player);
}
@@ -134,29 +123,36 @@ public class EntityListener extends EventListener {
}
}
}
if (e.getDamager() instanceof Player) {
Player player = (Player) e.getDamager();
getBackend().logDamage(player, 1);
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = KillAuraCheck.checkAngle(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.KILLAURA);
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);
noHack = false;
}
}
if (noHack) {
decrease(player);
}
}
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
Player player = (Player) e.getDamager();
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
CheckResult result = KillAuraCheck.checkAngle(player, event);
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.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;
}
}
if (noHack) {
decrease(player);
}
}
}
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded.event;
import java.text.DecimalFormat;
@@ -48,7 +47,7 @@ public class EventListener implements Listener {
private static final Configuration CONFIG = AntiCheatReloaded.getManager().getConfiguration();
private static final DecimalFormat TPS_FORMAT = new DecimalFormat("##.##");
public static void log(String message, Player player, CheckType type) {
public static void log(String message, Player player, CheckType type, String subcheck) {
User user = getUserManager().getUser(player.getUniqueId());
if (user == null)
return;
@@ -56,23 +55,26 @@ public class EventListener implements Listener {
boolean debugMode = CONFIG.getConfig().debugMode.getValue();
int vlForType = type.getUses(player.getUniqueId()) + 1;
int notifyEveryVl = CONFIG.getConfig().notifyEveryVl.getValue();
String prefix = ChatColor.translateAlternateColorCodes('&', CONFIG.getLang().ALERT_PREFIX());
if (message == null || message.equals("")) {
if (debugMode) {
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
message = prefix + player.getName() + " failed "
+ type.getName();
} else {
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
message = prefix + player.getName() + " failed "
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")";
}
} else {
if (debugMode) {
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
message = prefix + player.getName() + " failed "
+ type.getName() + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message
+ ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
+ ", tps: " + TPS_FORMAT.format(AntiCheatReloaded.getPlugin().getTPS());
} else {
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY + player.getName() + " failed "
+ type.getName() + ChatColor.GOLD + " (x" + vlForType + ")" + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + user.getPing() + "ms"
message = prefix
+ 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());
}
}
@@ -45,7 +45,7 @@ public class InventoryListener extends EventListener {
player.getInventory().clear();
event.setCancelled(true);
}
log(result.getMessage(), player, CheckType.FAST_INVENTORY);
log(result.getMessage(), player, CheckType.FAST_INVENTORY, result.getSubCheck());
} else {
decrease(player);
}
@@ -46,7 +46,6 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.event.player.PlayerToggleSprintEvent;
@@ -61,10 +60,12 @@ import com.rammelkast.anticheatreloaded.check.CheckResult;
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.BoatFlyCheck;
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
import com.rammelkast.anticheatreloaded.check.movement.FastLadderCheck;
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
import com.rammelkast.anticheatreloaded.check.movement.StrafeCheck;
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
import com.rammelkast.anticheatreloaded.util.Distance;
@@ -86,7 +87,7 @@ public class PlayerListener extends EventListener {
if (!silentMode())
player.sendMessage(ChatColor.translateAlternateColorCodes('&', result.getMessage()));
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);
if (result.failed()) {
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
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());
}
@@ -156,7 +154,7 @@ public class PlayerListener extends EventListener {
CheckResult result = getBackend().checkSneakToggle(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.SNEAK);
log(result.getMessage(), player, CheckType.SNEAK, result.getSubCheck());
}
}
// getBackend().logToggleSneak(event.getPlayer());
@@ -203,7 +201,7 @@ public class PlayerListener extends EventListener {
AntiCheatReloaded.sendToMainThread(new Runnable() {
@Override
public void run() {
log(null, player, CheckType.CHAT_SPAM);
log(null, player, CheckType.CHAT_SPAM, result.getSubCheck());
}
});
}
@@ -217,7 +215,7 @@ public class PlayerListener extends EventListener {
AntiCheatReloaded.sendToMainThread(new Runnable() {
@Override
public void run() {
log(null, player, CheckType.CHAT_UNICODE);
log(null, player, CheckType.CHAT_UNICODE, result.getSubCheck());
}
});
}
@@ -256,14 +254,11 @@ public class PlayerListener extends EventListener {
@EventHandler
public void onPlayerToggleSprint(PlayerToggleSprintEvent event) {
Player player = event.getPlayer();
if (!event.isSprinting()) {
getBackend().logEnterExit(player);
}
if (getCheckManager().willCheck(player, CheckType.SPRINT)) {
CheckResult result = getBackend().checkSprintHungry(event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.SPRINT);
log(result.getMessage(), player, CheckType.SPRINT, result.getSubCheck());
} else {
decrease(player);
}
@@ -309,7 +304,7 @@ public class PlayerListener extends EventListener {
CheckResult result = IllegalInteract.performCheck(player, event);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT, result.getSubCheck());
}
}
}
@@ -324,7 +319,7 @@ public class PlayerListener extends EventListener {
CheckResult result = getBackend().checkFastDrop(player);
if (result.failed()) {
event.setCancelled(!silentMode());
log(result.getMessage(), player, CheckType.ITEM_SPAM);
log(result.getMessage(), player, CheckType.ITEM_SPAM, result.getSubCheck());
}
}
@@ -383,7 +378,6 @@ public class PlayerListener extends EventListener {
final Distance distance = new Distance(from, to);
final double y = distance.getYDifference();
getBackend().logAscension(player, from.getY(), to.getY());
final User user = getUserManager().getUser(player.getUniqueId());
user.setTo(to.getX(), to.getY(), to.getZ());
@@ -395,13 +389,23 @@ public class PlayerListener extends EventListener {
if (!silentMode()) {
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.ELYTRAFLY)) {
CheckResult result = ElytraCheck.runCheck(player, distance);
if (result.failed()) {
log(result.getMessage(), player, CheckType.ELYTRAFLY);
log(result.getMessage(), player, CheckType.ELYTRAFLY, result.getSubCheck());
}
}
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)
@@ -419,7 +423,7 @@ public class PlayerListener extends EventListener {
}
player.damage(3);
}
log(result.getMessage(), player, CheckType.VCLIP);
log(result.getMessage(), player, CheckType.VCLIP, result.getSubCheck());
}
}
if (getCheckManager().willCheckQuick(player, CheckType.NOFALL)
@@ -432,11 +436,10 @@ public class PlayerListener extends EventListener {
event.setTo(user.getGoodLocation(from.clone()));
// 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()) {
double x = distance.getXDifference();
double z = distance.getZDifference();
@@ -448,8 +451,7 @@ public class PlayerListener extends EventListener {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.SPEED);
changed = true;
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
}
}
CheckResult result = SpeedCheck.checkXZSpeed(player, x, z, event.getTo());
@@ -457,8 +459,7 @@ public class PlayerListener extends EventListener {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.SPEED);
changed = true;
log(result.getMessage(), player, CheckType.SPEED, result.getSubCheck());
}
}
if (getCheckManager().willCheckQuick(player, CheckType.WATER_WALK)) {
@@ -468,8 +469,7 @@ public class PlayerListener extends EventListener {
// TODO check this
player.teleport(player.getLocation().clone().subtract(0, 0.52, 0));
}
log(result.getMessage(), player, CheckType.WATER_WALK);
changed = true;
log(result.getMessage(), player, CheckType.WATER_WALK, result.getSubCheck());
}
}
if (getCheckManager().willCheckQuick(player, CheckType.SPIDER)) {
@@ -478,8 +478,7 @@ public class PlayerListener extends EventListener {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.SPIDER);
changed = true;
log(result.getMessage(), player, CheckType.SPIDER, result.getSubCheck());
}
}
if (getCheckManager().willCheckQuick(player, CheckType.FASTLADDER)) {
@@ -490,24 +489,29 @@ public class PlayerListener extends EventListener {
if (!silentMode()) {
event.setTo(user.getGoodLocation(from.clone()));
}
log(result.getMessage(), player, CheckType.FASTLADDER);
changed = true;
log(result.getMessage(), player, CheckType.FASTLADDER, result.getSubCheck());
}
}
if (!changed) {
user.setGoodLocation(event.getFrom());
if (getCheckManager().willCheckQuick(player, CheckType.STRAFE)) {
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)) {
CheckResult result = AimbotCheck.runCheck(player, event);
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);
log(result.getMessage(), player, CheckType.VELOCITY, result.getSubCheck());
}
}
}
@@ -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());
}
}
@@ -47,11 +47,14 @@ public class CheckManager {
public CheckManager(AntiCheatManager manager) {
this.manager = manager;
this.config = manager.getConfiguration();
this.loadCheckIgnoreList(this.config);
}
public void loadCheckIgnoreList(Configuration configuration) {
checkIgnoreList.clear();
for (CheckType type : CheckType.values()) {
if (!config.getChecks().isEnabled(type)) {
if (!configuration.getChecks().isEnabled(type)) {
checkIgnoreList.add(type);
break;
}
}
@@ -60,7 +63,7 @@ public class CheckManager {
+ checkIgnoreList.size() + " check(s) have been disabled");
}
}
/**
* Turn a check on
*
@@ -89,6 +89,7 @@ public class LoggingManager {
}
public void logToPlayers(String message) {
if(config.getConfig().disableBroadcast.getValue()) return;
for(Player player : Bukkit.getOnlinePlayers()) {
if (Permission.SYSTEM_NOTICE.get(player)) {
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));
}
@@ -20,6 +20,9 @@ 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 {
@@ -43,8 +46,16 @@ public class MovementManager {
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
@@ -67,6 +78,18 @@ public class MovementManager {
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) {
@@ -74,16 +97,20 @@ public class MovementManager {
// 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;
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))
if (Utilities.couldBeOnBoat(player, 0.25, true) && !Utilities.isSubmersed(player))
this.onGround = true;
this.touchedGroundThisTick = false;
this.halfMovement = false;
if (!this.onGround) {
@@ -96,7 +123,7 @@ public class MovementManager {
this.airTicks = 0;
this.groundTicks++;
}
if (Utilities.couldBeOnIce(to)) {
this.iceTicks++;
this.iceInfluenceTicks = 60;
@@ -105,7 +132,7 @@ public class MovementManager {
if (this.iceInfluenceTicks > 0)
this.iceInfluenceTicks--;
}
if (Utilities.couldBeOnSlime(to)) {
this.slimeTicks++;
this.slimeInfluenceTicks = 40;
@@ -114,34 +141,61 @@ public class MovementManager {
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.464D && this.motionY <= 0.5625D) && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
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.PacketAdapter;
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.check.movement.NoSlowCheck;
import com.rammelkast.anticheatreloaded.check.packet.BadPacketsCheck;
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
@@ -38,6 +41,8 @@ public class PacketListener {
@Override
public void onPacketReceiving(PacketEvent event) {
Player player = event.getPlayer();
if (player == null || !player.isOnline())
return;
// Run MorePackets check
MorePacketsCheck.runCheck(player, event);
@@ -51,6 +56,9 @@ public class PacketListener {
@Override
public void onPacketSending(PacketEvent event) {
Player player = event.getPlayer();
// Check if we have an actual player object
if (player instanceof TemporaryPlayer)
return;
// Compensate for teleport
MorePacketsCheck.compensate(player);
}
@@ -76,5 +84,16 @@ public class PacketListener {
}
});
}
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);
}
});
}
}
@@ -27,7 +27,7 @@ public enum Permission {
CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP, CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL,
CHECK_KILLAURA, CHECK_UNICODE, CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_FASTINVENTORY,
CHECK_MOREPACKETS, CHECK_BADPACKETS, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGALINTERACT, CHECK_FASTLADDER,
CHECK_AIMBOT,
CHECK_AIMBOT, CHECK_STRAFE, CHECK_NOSLOW, CHECK_BOATFLY,
/* System Nodes */
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_HELP, SYSTEM_VERSION, SYSTEM_REPORT, SYSTEM_NOTICE, SYSTEM_CHECK, SYSTEM_RELOAD,
@@ -33,11 +33,15 @@ public class UpdateManager {
public static final String SPIGOT_VERSION_URL = "https://api.spigotmc.org/legacy/update.php?resource="
+ RESOURCE_ID;
private final String latestVersion;
private final boolean isLatest;
private final boolean isAhead;
private String latestVersion;
private boolean isLatest;
private boolean isAhead;
public UpdateManager() {
this.update();
}
public void update() {
this.latestVersion = this.getOnlineData(SPIGOT_VERSION_URL);
if (this.latestVersion == null) {
this.isLatest = true;
@@ -26,7 +26,6 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -69,6 +68,7 @@ public class User {
this.name = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getName() : "";
this.id = getPlayer() != null && getPlayer().isOnline() ? getPlayer().getEntityId() : -1;
this.movementManager = new MovementManager();
this.ping = getPlayer() != null && getPlayer().isOnline() ? VersionUtil.getPlayerPing(getPlayer()) : -1;
}
/**
@@ -218,7 +218,8 @@ public class User {
* @return last known valid 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;
}
@@ -237,9 +238,7 @@ public class User {
* @return true if the location was valid and set properly
*/
public boolean setGoodLocation(Location location) {
if (Utilities.cantStandAtExp(location)
|| (location.getBlock().isLiquid() && !Utilities.isFullyInWater(location))
|| (!location.getBlock().getType().isSolid() && location.getBlock().getType() != Material.AIR)) {
if (Utilities.cantStandAtExp(location)) {
return false;
}
@@ -460,7 +459,8 @@ public class User {
}
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() {
@@ -37,18 +37,17 @@ import org.bukkit.entity.Boat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.BoundingBox;
import org.bukkit.util.NumberConversions;
import com.comphenix.protocol.utility.MinecraftVersion;
public final class Utilities {
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
private static final List<Material> FOOD = new ArrayList<Material>();
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
public static final Material LILY_PAD;
public static final Material COB_WEB;
public static final Material IRON_BARS;
public static final double JUMP_MOTION_Y = 0.41999998688697815;
/**
@@ -117,24 +116,30 @@ public final class Utilities {
public static boolean canStand(Block block) {
return !(block.isLiquid() || block.getType() == Material.AIR);
}
public static boolean isNotNearSlime(Block block) {
return !isSlime(block.getRelative(BlockFace.NORTH)) && !isSlime(block.getRelative(BlockFace.EAST))
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST)) && !isSlime(block.getRelative(BlockFace.DOWN));
&& !isSlime(block.getRelative(BlockFace.SOUTH)) && !isSlime(block.getRelative(BlockFace.WEST))
&& !isSlime(block.getRelative(BlockFace.DOWN));
}
public static boolean couldBeOnBoat(Player player) {
return couldBeOnBoat(player, 0.35);
return couldBeOnBoat(player, 0.35, false);
}
public static boolean couldBeOnBoat(Player player, double range) {
public static boolean couldBeOnBoat(Player player, double range, boolean checkY) {
for (Entity entity : player.getNearbyEntities(range, range, range)) {
if (entity instanceof Boat)
return true;
if (entity instanceof Boat) {
if (((Boat) entity).getLocation().getY() < player.getLocation().getY() + 0.25) {
return true;
} else if (!checkY) {
return true;
}
}
}
return false;
}
/**
* Determine whether a player could be standing on ice
*
@@ -143,11 +148,11 @@ public final class Utilities {
*/
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()))
|| isNearIce(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.26D,
location.getBlockZ()));
}
/**
* Determine whether a block is a type of ice
*
@@ -158,10 +163,9 @@ public final class Utilities {
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))
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))
@@ -170,7 +174,33 @@ public final class Utilities {
|| 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
*
@@ -178,14 +208,14 @@ public final class Utilities {
* @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,
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))
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))
@@ -194,12 +224,19 @@ public final class Utilities {
|| isHalfblock(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|| isHalfblock(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
}
public static boolean isHalfblock(Block block) {
return isSlab(block) || isStair(block) || isWall(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
*
@@ -208,11 +245,11 @@ public final class Utilities {
*/
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()))
|| isNearSlime(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.51D,
location.getBlockZ()));
}
/**
* Determine whether a block is a type of slime
*
@@ -223,10 +260,9 @@ public final class Utilities {
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))
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))
@@ -235,7 +271,7 @@ public final class Utilities {
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
}
/**
* Determine whether a player is fully submerged in water
*
@@ -334,7 +370,7 @@ public final class Utilities {
Material type = block.getType();
return type.name().endsWith("SLAB");
}
/**
* Determine whether a block is a bed
*
@@ -345,10 +381,9 @@ public final class Utilities {
Material type = block.getType();
return type.name().endsWith("BED");
}
public static boolean isNearBed(Location location) {
return isBed(location.getBlock())
|| isBed(location.getBlock().getRelative(BlockFace.NORTH))
return isBed(location.getBlock()) || isBed(location.getBlock().getRelative(BlockFace.NORTH))
|| isBed(location.getBlock().getRelative(BlockFace.SOUTH))
|| isBed(location.getBlock().getRelative(BlockFace.EAST))
|| isBed(location.getBlock().getRelative(BlockFace.WEST))
@@ -368,7 +403,7 @@ public final class Utilities {
Material type = block.getType();
return type.name().endsWith("STAIRS");
}
/**
* Determine whether a block is a wall
*
@@ -377,7 +412,7 @@ public final class Utilities {
*/
public static boolean isWall(Block block) {
Material type = block.getType();
return type.name().endsWith("WALL");
return type.name().endsWith("WALL") || type.name().endsWith("FENCE");
}
/**
@@ -398,10 +433,11 @@ public final class Utilities {
*/
public static boolean isOnLilyPad(Player player) {
Block block = player.getLocation().getBlock();
return block.getType() == LILY_PAD || block.getRelative(BlockFace.NORTH).getType() == LILY_PAD
|| block.getRelative(BlockFace.SOUTH).getType() == LILY_PAD
|| block.getRelative(BlockFace.EAST).getType() == LILY_PAD
|| block.getRelative(BlockFace.WEST).getType() == LILY_PAD;
return block.getType() == XMaterial.LILY_PAD.parseMaterial()
|| block.getRelative(BlockFace.NORTH).getType() == XMaterial.LILY_PAD.parseMaterial()
|| block.getRelative(BlockFace.SOUTH).getType() == XMaterial.LILY_PAD.parseMaterial()
|| block.getRelative(BlockFace.EAST).getType() == XMaterial.LILY_PAD.parseMaterial()
|| block.getRelative(BlockFace.WEST).getType() == XMaterial.LILY_PAD.parseMaterial();
}
/**
@@ -424,9 +460,16 @@ public final class Utilities {
public static boolean isInWater(Player player) {
return player.getLocation().getBlock().isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|| player.getLocation().getBlock().getRelative(BlockFace.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));
}
/**
* Determine whether a player is near a liquid block
*
@@ -446,7 +489,7 @@ public final class Utilities {
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_EAST).isLiquid()
|| player.getLocation().getBlock().getRelative(BlockFace.SOUTH_WEST).isLiquid();
}
/**
* Determine whether a player is surrounded by liquid blocks
*
@@ -455,8 +498,7 @@ public final class Utilities {
*/
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()
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()
@@ -466,6 +508,32 @@ public final class Utilities {
&& 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
*
@@ -473,11 +541,13 @@ public final class Utilities {
* @return true if in web
*/
public static boolean isInWeb(Player player) {
return player.getLocation().getBlock().getType() == COB_WEB
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == COB_WEB
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == COB_WEB;
return player.getLocation().getBlock().getType() == XMaterial.COBWEB.parseMaterial()
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == XMaterial.COBWEB
.parseMaterial()
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == XMaterial.COBWEB
.parseMaterial();
}
/**
* Determine whether a player is near a climbable block
*
@@ -494,6 +564,22 @@ public final class Utilities {
|| 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
*
@@ -671,6 +757,7 @@ public final class Utilities {
/**
* Rounds a float value to a scale
*
* @param value Value to round
* @param scale Scale
* @return rounded value
@@ -678,9 +765,10 @@ public final class Utilities {
public static float roundFloat(float value, int scale) {
return new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP).floatValue();
}
/**
* Rounds a double value to a scale
*
* @param value Value to round
* @param scale Scale
* @return rounded value
@@ -688,14 +776,14 @@ public final class Utilities {
public static double roundDouble(double value, int scale) {
return new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP).doubleValue();
}
public static int floor(double value) {
int rounded = (int) value;
return value < rounded ? rounded - 1 : rounded;
}
int rounded = (int) value;
return value < rounded ? rounded - 1 : rounded;
}
public static boolean isHoneyBlock(Block block) {
if (!VersionUtil.isOfVersion("v1_15")) {
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.BEE_UPDATE)) {
return false;
}
return block.getType() == XMaterial.HONEY_BLOCK.parseMaterial();
@@ -704,10 +792,6 @@ public final class Utilities {
static {
// Start 1.8.8
if (VersionUtil.isBountifulUpdate()) {
LILY_PAD = XMaterial.LILY_PAD.parseMaterial();
COB_WEB = XMaterial.COBWEB.parseMaterial();
IRON_BARS = XMaterial.IRON_BARS.parseMaterial();
// Start instant break materials
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
INSTANT_BREAK.add(XMaterial.REPEATER.parseMaterial());
@@ -724,7 +808,7 @@ public final class Utilities {
INSTANT_BREAK.add(Material.DEAD_BUSH);
INSTANT_BREAK.add(Material.GRASS);
INSTANT_BREAK.add(XMaterial.TALL_GRASS.parseMaterial());
INSTANT_BREAK.add(LILY_PAD);
INSTANT_BREAK.add(XMaterial.LILY_PAD.parseMaterial());
INSTANT_BREAK.add(Material.MELON_STEM);
INSTANT_BREAK.add(Material.MELON_STEM);
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
@@ -773,12 +857,12 @@ public final class Utilities {
// Start combos
COMBO.put(Material.SHEARS, XMaterial.WHITE_WOOL.parseMaterial());
COMBO.put(Material.IRON_SWORD, COB_WEB);
COMBO.put(Material.DIAMOND_SWORD, COB_WEB);
COMBO.put(Material.STONE_SWORD, COB_WEB);
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), COB_WEB);
COMBO.put(Material.IRON_SWORD, XMaterial.COBWEB.parseMaterial());
COMBO.put(Material.DIAMOND_SWORD, XMaterial.COBWEB.parseMaterial());
COMBO.put(Material.STONE_SWORD, XMaterial.COBWEB.parseMaterial());
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), XMaterial.COBWEB.parseMaterial());
// End combos
// Start climbable
CLIMBABLE.add(Material.VINE);
CLIMBABLE.add(Material.LADDER);
@@ -788,10 +872,8 @@ public final class Utilities {
// End 1.8.8
// Start other version
else {
LILY_PAD = Material.LILY_PAD;
COB_WEB = Material.COBWEB;
IRON_BARS = Material.IRON_BARS;
MinecraftVersion currentVersion = MinecraftVersion.getCurrentVersion();
// Start instant break materials
INSTANT_BREAK.add(Material.COMPARATOR);
INSTANT_BREAK.add(Material.REPEATER);
@@ -836,13 +918,13 @@ public final class Utilities {
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
INSTANT_BREAK.add(Material.WHEAT);
// Start 1.14 objects
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
INSTANT_BREAK.add(Material.CORNFLOWER);
}
// End 1.14 objects
// Start 1.15 objects
if (VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
if (currentVersion.isAtLeast(MinecraftVersion.BEE_UPDATE)) {
INSTANT_BREAK.add(Material.HONEY_BLOCK);
}
// End 1.15 objects
@@ -887,13 +969,13 @@ public final class Utilities {
FOOD.add(Material.SPIDER_EYE);
FOOD.add(Material.TROPICAL_FISH);
// Start 1.14 objects
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
FOOD.add(Material.SUSPICIOUS_STEW);
FOOD.add(Material.SWEET_BERRIES);
}
// End 1.14 objects
// Start 1.15 objects
if (VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
if (currentVersion.isAtLeast(MinecraftVersion.BEE_UPDATE)) {
FOOD.add(Material.HONEY_BOTTLE);
}
// End 1.15 objects
@@ -923,23 +1005,24 @@ public final class Utilities {
COMBO.put(Material.STONE_SWORD, Material.COBWEB);
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
// End combos
// Start climbable
CLIMBABLE.add(Material.VINE);
CLIMBABLE.add(Material.LADDER);
CLIMBABLE.add(Material.WATER);
// Start 1.14 objects
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
CLIMBABLE.add(Material.SCAFFOLDING);
CLIMBABLE.add(Material.SWEET_BERRY_BUSH);
}
// End 1.14 objects
// Start 1.16 objects
if (VersionUtil.isOfVersion("v1_16")) {
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.TWISTING_VINES_PLANT.parseMaterial());
CLIMBABLE.add(XMaterial.WEEPING_VINES_PLANT.parseMaterial());
}
// End 1.16 objects
// End climbable
@@ -16,7 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.rammelkast.anticheatreloaded.util;
import java.util.Arrays;
@@ -32,12 +31,13 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.comphenix.protocol.utility.MinecraftVersion;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
public class VersionUtil {
private static final List<String> SUPPORTED_VERSIONS = Arrays
.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_8_R3" });
private static final List<String> SUPPORTED_VERSIONS;
private static final MinecraftVersion CURRENT_VERSION;
public static String getVersion() {
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
@@ -75,14 +75,14 @@ public class VersionUtil {
}
public static boolean isRiptiding(Player player) {
if (isBountifulUpdate()) {
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
return false;
}
return player.isRiptiding();
}
public static boolean isSlowFalling(Player player) {
if (isBountifulUpdate()) {
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
return false;
}
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
@@ -134,4 +134,29 @@ public class VersionUtil {
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();
}
}
@@ -22,12 +22,26 @@
*/
package com.rammelkast.anticheatreloaded.util;
import com.google.common.base.Enums;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang.WordUtils;
@@ -35,19 +49,18 @@ import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import com.google.common.base.Enums;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
/**
* <b>XMaterial</b> - Data Values/Pre-flattening<br>
* 1.13 and above as priority.
* <p>
* This class is mainly designed to support ItemStacks.
* If you want to use it on blocks you'll have to
* use <a href="https://github.com/CryptoMorin/XSeries/blob/master/XBlock.java">XBlock</a>
* This class is mainly designed to support ItemStacks. If you want to use it on blocks, you'll have to use
* <a href="https://github.com/CryptoMorin/XSeries/blob/master/src/main/java/com/cryptomorin/xseries/XBlock.java">XBlock</a>
* <p>
* Pre-flattening: https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening
* Materials: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
@@ -55,9 +68,13 @@ import java.util.regex.Pattern;
* Material IDs: https://minecraft-ids.grahamedgecombe.com/
* Material Source Code: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Material.java
* XMaterial v1: https://www.spigotmc.org/threads/329630/
* <p>
* This class will throw a "unsupported material" error if someone tries to use an item with an invalid data value which can only happen in 1.12 servers and below.
* To get an invalid item, (aka <a href="https://minecraft.fandom.com/wiki/Missing_Texture_Block">Missing Texture Block</a>) you can use the command
* <b>/give @p minecraft:dirt 1 10</b> where 1 is the item amount, and 10 is the data value. The material {@link #DIRT} with a data value of {@code 10} doesn't exist.
*
* @author Crypto Morin
* @version 5.0.1
* @version 6.0.2
* @see Material
* @see ItemStack
*/
@@ -72,11 +89,11 @@ public enum XMaterial {
ACACIA_PLANKS(4, "WOOD"),
ACACIA_PRESSURE_PLATE("WOOD_PLATE"),
ACACIA_SAPLING(4, "SAPLING"),
ACACIA_SIGN("SIGN"),
ACACIA_SIGN("SIGN_POST", "SIGN"),
ACACIA_SLAB(4, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"),
ACACIA_STAIRS,
ACACIA_TRAPDOOR("TRAP_DOOR"),
ACACIA_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
ACACIA_WALL_SIGN("WALL_SIGN"),
ACACIA_WOOD("LOG_2"),
ACTIVATOR_RAIL,
/**
@@ -132,22 +149,22 @@ public enum XMaterial {
BIRCH_PLANKS(2, "WOOD"),
BIRCH_PRESSURE_PLATE("WOOD_PLATE"),
BIRCH_SAPLING(2, "SAPLING"),
BIRCH_SIGN("SIGN"),
BIRCH_SIGN("SIGN_POST", "SIGN"),
BIRCH_SLAB(2, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"),
BIRCH_STAIRS("BIRCH_WOOD_STAIRS"),
BIRCH_TRAPDOOR("TRAP_DOOR"),
BIRCH_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
BIRCH_WALL_SIGN("WALL_SIGN"),
BIRCH_WOOD(2, "LOG"),
BLACKSTONE("1.16"),
BLACKSTONE_SLAB("1.16"),
BLACKSTONE_STAIRS("1.16"),
BLACKSTONE_WALL("1.16"),
BLACK_BANNER("BANNER", "STANDING_BANNER"),
BLACK_BANNER("STANDING_BANNER", "BANNER"),
BLACK_BED(15, "BED_BLOCK", "BED"),
BLACK_CARPET(15, "CARPET"),
BLACK_CONCRETE(15, "CONCRETE"),
BLACK_CONCRETE_POWDER(15, "CONCRETE_POWDER"),
BLACK_DYE("1.14", "INK_SACK"),
BLACK_DYE("1.14", "INK_SACK", "INK_SAC"),
BLACK_GLAZED_TERRACOTTA(15, "1.12", "HARD_CLAY", "STAINED_CLAY", "BLACK_TERRACOTTA"),
BLACK_SHULKER_BOX,
BLACK_STAINED_GLASS(15, "STAINED_GLASS"),
@@ -159,7 +176,7 @@ public enum XMaterial {
BLAZE_POWDER,
BLAZE_ROD,
BLAZE_SPAWN_EGG(61, "MONSTER_EGG"),
BLUE_BANNER(4, "BANNER", "STANDING_BANNER"),
BLUE_BANNER(4, "STANDING_BANNER", "BANNER"),
BLUE_BED(11, "BED_BLOCK", "BED"),
BLUE_CARPET(11, "CARPET"),
BLUE_CONCRETE(11, "CONCRETE"),
@@ -192,7 +209,7 @@ public enum XMaterial {
BRICK_SLAB(4, "STEP"),
BRICK_STAIRS,
BRICK_WALL,
BROWN_BANNER(3, "BANNER", "STANDING_BANNER"),
BROWN_BANNER(3, "STANDING_BANNER", "BANNER"),
BROWN_BED(12, "BED_BLOCK", "BED"),
BROWN_CARPET(12, "CARPET"),
BROWN_CONCRETE(12, "CONCRETE"),
@@ -309,19 +326,19 @@ public enum XMaterial {
CRIMSON_PLANKS("1.16"),
CRIMSON_PRESSURE_PLATE("1.16"),
CRIMSON_ROOTS("1.16"),
CRIMSON_SIGN("1.16"),
CRIMSON_SIGN("1.16", "SIGN_POST"),
CRIMSON_SLAB("1.16"),
CRIMSON_STAIRS("1.16"),
CRIMSON_STEM("1.16"),
CRIMSON_TRAPDOOR("1.16"),
CRIMSON_WALL_SIGN("1.16"),
CRIMSON_WALL_SIGN("1.16", "WALL_SIGN"),
CROSSBOW,
CRYING_OBSIDIAN("1.16"),
CUT_RED_SANDSTONE("1.13"),
CUT_RED_SANDSTONE_SLAB("STONE_SLAB2"),
CUT_SANDSTONE("1.13"),
CUT_SANDSTONE_SLAB("STEP"),
CYAN_BANNER(6, "BANNER", "STANDING_BANNER"),
CYAN_BANNER(6, "STANDING_BANNER", "BANNER"),
CYAN_BED(9, "BED_BLOCK", "BED"),
CYAN_CARPET(9, "CARPET"),
CYAN_CONCRETE(9, "CONCRETE"),
@@ -346,11 +363,11 @@ public enum XMaterial {
DARK_OAK_PLANKS(5, "WOOD"),
DARK_OAK_PRESSURE_PLATE("WOOD_PLATE"),
DARK_OAK_SAPLING(5, "SAPLING"),
DARK_OAK_SIGN("SIGN"),
DARK_OAK_SIGN("SIGN_POST", "SIGN"),
DARK_OAK_SLAB(5, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"),
DARK_OAK_STAIRS,
DARK_OAK_TRAPDOOR("TRAP_DOOR"),
DARK_OAK_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
DARK_OAK_WALL_SIGN("WALL_SIGN"),
DARK_OAK_WOOD(1, "LOG", "LOG_2"),
DARK_PRISMARINE(1, "PRISMARINE"),
DARK_PRISMARINE_SLAB("1.13"),
@@ -437,7 +454,7 @@ public enum XMaterial {
FARMLAND("SOIL"),
FEATHER,
FERMENTED_SPIDER_EYE,
FERN(1, "LONG_GRASS"),
FERN(2, "LONG_GRASS"),
/**
* For some reasons filled map items are really special.
* Their data value starts from 0 and every time a player
@@ -467,6 +484,7 @@ public enum XMaterial {
FURNACE_MINECART("POWERED_MINECART"),
GHAST_SPAWN_EGG(56, "MONSTER_EGG"),
GHAST_TEAR,
GILDED_BLACKSTONE("1.16"),
GLASS,
GLASS_BOTTLE,
GLASS_PANE("THIN_GLASS"),
@@ -494,11 +512,11 @@ public enum XMaterial {
GRANITE_SLAB,
GRANITE_STAIRS,
GRANITE_WALL,
GRASS,
GRASS(1, "LONG_GRASS"),
GRASS_BLOCK("GRASS"),
GRASS_PATH,
GRAVEL,
GRAY_BANNER(8, "BANNER", "STANDING_BANNER"),
GRAY_BANNER(8, "STANDING_BANNER", "BANNER"),
GRAY_BED(7, "BED_BLOCK", "BED"),
GRAY_CARPET(7, "CARPET"),
GRAY_CONCRETE(7, "CONCRETE"),
@@ -511,7 +529,7 @@ public enum XMaterial {
GRAY_TERRACOTTA(7, "HARD_CLAY", "STAINED_CLAY"),
GRAY_WALL_BANNER(8, "WALL_BANNER"),
GRAY_WOOL(7, "WOOL"),
GREEN_BANNER(2, "BANNER", "STANDING_BANNER"),
GREEN_BANNER(2, "STANDING_BANNER", "BANNER"),
GREEN_BED(13, "BED_BLOCK", "BED"),
GREEN_CARPET(13, "CARPET"),
GREEN_CONCRETE(13, "CONCRETE"),
@@ -550,6 +568,11 @@ public enum XMaterial {
INFESTED_MOSSY_STONE_BRICKS(3, "MONSTER_EGGS"),
INFESTED_STONE("MONSTER_EGGS"),
INFESTED_STONE_BRICKS(2, "MONSTER_EGGS", "SMOOTH_BRICK"),
/**
* We will only add "INK_SAC" for {@link #BLACK_DYE} since it's
* the only material (linked with this material) that is added
* after 1.13, which means it can use both INK_SACK and INK_SAC.
*/
INK_SAC("INK_SACK"),
IRON_AXE,
IRON_BARS("IRON_FENCE"),
@@ -582,11 +605,11 @@ public enum XMaterial {
JUNGLE_PLANKS(3, "WOOD"),
JUNGLE_PRESSURE_PLATE("WOOD_PLATE"),
JUNGLE_SAPLING(3, "SAPLING"),
JUNGLE_SIGN("SIGN"),
JUNGLE_SIGN("SIGN_POST", "SIGN"),
JUNGLE_SLAB(3, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"),
JUNGLE_STAIRS("JUNGLE_WOOD_STAIRS"),
JUNGLE_TRAPDOOR("TRAP_DOOR"),
JUNGLE_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
JUNGLE_WALL_SIGN("WALL_SIGN"),
JUNGLE_WOOD(3, "LOG"),
KELP("1.13"),
KELP_PLANT("1.13"),
@@ -608,7 +631,7 @@ public enum XMaterial {
LEATHER_LEGGINGS,
LECTERN("1.14", "BOOKSHELF", ""),
LEVER,
LIGHT_BLUE_BANNER(12, "BANNER", "STANDING_BANNER"),
LIGHT_BLUE_BANNER(12, "STANDING_BANNER", "BANNER"),
LIGHT_BLUE_BED(3, "BED_BLOCK", "BED"),
LIGHT_BLUE_CARPET(3, "CARPET"),
LIGHT_BLUE_CONCRETE(3, "CONCRETE"),
@@ -619,9 +642,9 @@ public enum XMaterial {
LIGHT_BLUE_STAINED_GLASS(3, "STAINED_GLASS"),
LIGHT_BLUE_STAINED_GLASS_PANE(3, "THIN_GLASS", "STAINED_GLASS_PANE"),
LIGHT_BLUE_TERRACOTTA(3, "STAINED_CLAY"),
LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "BANNER", "STANDING_BANNER"),
LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "STANDING_BANNER", "BANNER"),
LIGHT_BLUE_WOOL(3, "WOOL"),
LIGHT_GRAY_BANNER(7, "BANNER", "STANDING_BANNER"),
LIGHT_GRAY_BANNER(7, "STANDING_BANNER", "BANNER"),
LIGHT_GRAY_BED(8, "BED_BLOCK", "BED"),
LIGHT_GRAY_CARPET(8, "CARPET"),
LIGHT_GRAY_CONCRETE(8, "CONCRETE"),
@@ -642,7 +665,7 @@ public enum XMaterial {
LILAC(1, "DOUBLE_PLANT"),
LILY_OF_THE_VALLEY(15, "1.14", "WHITE_DYE", ""),
LILY_PAD("WATER_LILY"),
LIME_BANNER(10, "BANNER", "STANDING_BANNER"),
LIME_BANNER(10, "STANDING_BANNER", "BANNER"),
LIME_BED(5, "BED_BLOCK", "BED"),
LIME_CARPET(5, "CARPET"),
LIME_CONCRETE(5, "CONCRETE"),
@@ -659,7 +682,7 @@ public enum XMaterial {
LLAMA_SPAWN_EGG(103, "MONSTER_EGG"),
LODESTONE("1.16"),
LOOM("1.14"),
MAGENTA_BANNER(13, "BANNER", "STANDING_BANNER"),
MAGENTA_BANNER(13, "STANDING_BANNER", "BANNER"),
MAGENTA_BED(2, "BED_BLOCK", "BED"),
MAGENTA_CARPET(2, "CARPET"),
MAGENTA_CONCRETE(2, "CONCRETE"),
@@ -711,6 +734,7 @@ public enum XMaterial {
MUSIC_DISC_FAR("RECORD_6"),
MUSIC_DISC_MALL("RECORD_7"),
MUSIC_DISC_MELLOHI("RECORD_8"),
MUSIC_DISC_PIGSTEP("1.16"),
MUSIC_DISC_STAL("RECORD_9"),
MUSIC_DISC_STRAD("RECORD_10"),
MUSIC_DISC_WAIT("RECORD_11"),
@@ -761,16 +785,16 @@ public enum XMaterial {
OAK_PLANKS("WOOD"),
OAK_PRESSURE_PLATE("WOOD_PLATE"),
OAK_SAPLING("SAPLING"),
OAK_SIGN("SIGN"),
OAK_SIGN("SIGN_POST", "SIGN"),
OAK_SLAB("WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"),
OAK_STAIRS("WOOD_STAIRS"),
OAK_TRAPDOOR("TRAP_DOOR"),
OAK_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
OAK_WALL_SIGN("WALL_SIGN"),
OAK_WOOD("LOG"),
OBSERVER,
OBSIDIAN,
OCELOT_SPAWN_EGG(98, "MONSTER_EGG"),
ORANGE_BANNER(14, "BANNER", "STANDING_BANNER"),
ORANGE_BANNER(14, "STANDING_BANNER", "BANNER"),
ORANGE_BED(1, "BED_BLOCK", "BED"),
ORANGE_CARPET(1, "CARPET"),
ORANGE_CONCRETE(1, "CONCRETE"),
@@ -794,9 +818,11 @@ public enum XMaterial {
PETRIFIED_OAK_SLAB("WOOD_STEP"),
PHANTOM_MEMBRANE("1.13"),
PHANTOM_SPAWN_EGG("1.13", "MONSTER_EGG", ""),
PIGLIN_BANNER_PATTERN("1.16"),
PIGLIN_SPAWN_EGG(57, "MONSTER_EGG"),
PIG_SPAWN_EGG(90, "MONSTER_EGG"),
PILLAGER_SPAWN_EGG("1.14"),
PINK_BANNER(9, "BANNER", "STANDING_BANNER"),
PINK_BANNER(9, "STANDING_BANNER", "BANNER"),
PINK_BED(6, "BED_BLOCK", "BED"),
PINK_CARPET(6, "CARPET"),
PINK_CONCRETE(6, "CONCRETE"),
@@ -852,6 +878,8 @@ public enum XMaterial {
POTTED_BROWN_MUSHROOM("FLOWER_POT"),
POTTED_CACTUS("FLOWER_POT"),
POTTED_CORNFLOWER,
POTTED_CRIMSON_FUNGUS("1.16"),
POTTED_CRIMSON_ROOTS("1.16"),
POTTED_DANDELION("YELLOW_FLOWER", "FLOWER_POT"),
POTTED_DARK_OAK_SAPLING(5, "SAPLING", "FLOWER_POT"),
POTTED_DEAD_BUSH("FLOWER_POT"),
@@ -866,6 +894,8 @@ public enum XMaterial {
POTTED_RED_MUSHROOM("FLOWER_POT"),
POTTED_RED_TULIP(4, "RED_ROSE", "FLOWER_POT"),
POTTED_SPRUCE_SAPLING(1, "SAPLING", "FLOWER_POT"),
POTTED_WARPED_FUNGUS("1.16"),
POTTED_WARPED_ROOTS("1.16"),
POTTED_WHITE_TULIP(6, "RED_ROSE", "FLOWER_POT"),
POTTED_WITHER_ROSE,
POWERED_RAIL,
@@ -885,7 +915,7 @@ public enum XMaterial {
PUMPKIN_PIE,
PUMPKIN_SEEDS,
PUMPKIN_STEM,
PURPLE_BANNER(5, "BANNER", "STANDING_BANNER"),
PURPLE_BANNER(5, "STANDING_BANNER", "BANNER"),
PURPLE_BED(10, "BED_BLOCK", "BED"),
PURPLE_CARPET(10, "CARPET"),
PURPLE_CONCRETE(10, "CONCRETE"),
@@ -904,6 +934,7 @@ public enum XMaterial {
PURPUR_STAIRS,
QUARTZ,
QUARTZ_BLOCK,
QUARTZ_BRICKS("1.16"),
QUARTZ_PILLAR(2, "QUARTZ_BLOCK"),
QUARTZ_SLAB(7, "STEP"),
QUARTZ_STAIRS,
@@ -932,7 +963,7 @@ public enum XMaterial {
REDSTONE_TORCH("REDSTONE_TORCH_OFF", "REDSTONE_TORCH_ON"),
REDSTONE_WALL_TORCH,
REDSTONE_WIRE,
RED_BANNER(1, "BANNER", "STANDING_BANNER"),
RED_BANNER(1, "STANDING_BANNER", "BANNER"),
/**
* Data value 14 or 0
*/
@@ -940,10 +971,7 @@ public enum XMaterial {
RED_CARPET(14, "CARPET"),
RED_CONCRETE(14, "CONCRETE"),
RED_CONCRETE_POWDER(14, "CONCRETE_POWDER"),
/**
* Data value 0 or 1?
*/
RED_DYE(0, "INK_SACK", "ROSE_RED"),
RED_DYE(1, "INK_SACK", "ROSE_RED"),
RED_GLAZED_TERRACOTTA(14, "1.12", "HARD_CLAY", "STAINED_CLAY", "RED_TERRACOTTA"),
RED_MUSHROOM,
RED_MUSHROOM_BLOCK("RED_MUSHROOM", "HUGE_MUSHROOM_2"),
@@ -963,7 +991,7 @@ public enum XMaterial {
RED_TULIP(4, "RED_ROSE"),
RED_WALL_BANNER(1, "WALL_BANNER"),
RED_WOOL(14, "WOOL"),
REPEATER("DIODE", "DIODE_BLOCK_ON", "DIODE_BLOCK_OFF"),
REPEATER("DIODE_BLOCK_ON", "DIODE_BLOCK_OFF", "DIODE"),
REPEATING_COMMAND_BLOCK("COMMAND", "COMMAND_REPEATING"),
RESPAWN_ANCHOR("1.16"),
ROSE_BUSH(4, "DOUBLE_PLANT"),
@@ -1032,16 +1060,16 @@ public enum XMaterial {
SPRUCE_DOOR("SPRUCE_DOOR_ITEM", "SPRUCE_DOOR"),
SPRUCE_FENCE,
SPRUCE_FENCE_GATE,
SPRUCE_LEAVES(1, "LEAVES"),
SPRUCE_LEAVES(1, "LEAVES", "LEAVES_2"),
SPRUCE_LOG(1, "LOG"),
SPRUCE_PLANKS(1, "WOOD"),
SPRUCE_PRESSURE_PLATE("WOOD_PLATE"),
SPRUCE_SAPLING(1, "SAPLING"),
SPRUCE_SIGN("SIGN"),
SPRUCE_SIGN("SIGN_POST", "SIGN"),
SPRUCE_SLAB(1, "WOOD_STEP", "WOODEN_SLAB", "WOOD_DOUBLE_STEP"),
SPRUCE_STAIRS("SPRUCE_WOOD_STAIRS"),
SPRUCE_TRAPDOOR("TRAP_DOOR"),
SPRUCE_WALL_SIGN("SIGN_POST", "WALL_SIGN"),
SPRUCE_WALL_SIGN("WALL_SIGN"),
SPRUCE_WOOD(1, "LOG"),
SQUID_SPAWN_EGG(94, "MONSTER_EGG"),
STICK,
@@ -1062,6 +1090,7 @@ public enum XMaterial {
STONE_STAIRS,
STONE_SWORD,
STRAY_SPAWN_EGG(6, "MONSTER_EGG"),
STRIDER_SPAWN_EGG("1.16"),
STRING,
STRIPPED_ACACIA_LOG("LOG_2"),
STRIPPED_ACACIA_WOOD("LOG_2"),
@@ -1144,12 +1173,12 @@ public enum XMaterial {
WARPED_PLANKS("1.16"),
WARPED_PRESSURE_PLATE("1.16"),
WARPED_ROOTS("1.16"),
WARPED_SIGN("1.16"),
WARPED_SIGN("1.16", "SIGN_POST"),
WARPED_SLAB("1.16"),
WARPED_STAIRS("1.16"),
WARPED_STEM("1.16"),
WARPED_TRAPDOOR("1.16"),
WARPED_WALL_SIGN("1.16"),
WARPED_WALL_SIGN("1.16", "WALL_SIGN"),
WARPED_WART_BLOCK("1.16"),
/**
* This is used for blocks only.
@@ -1169,7 +1198,7 @@ public enum XMaterial {
*/
WHEAT("CROPS"),
WHEAT_SEEDS("SEEDS"),
WHITE_BANNER(15, "BANNER", "STANDING_BANNER"),
WHITE_BANNER(15, "STANDING_BANNER", "BANNER"),
WHITE_BED("BED_BLOCK", "BED"),
WHITE_CARPET("CARPET"),
WHITE_CONCRETE("CONCRETE"),
@@ -1196,7 +1225,7 @@ public enum XMaterial {
WOODEN_SWORD("WOOD_SWORD"),
WRITABLE_BOOK("BOOK_AND_QUILL"),
WRITTEN_BOOK,
YELLOW_BANNER(11, "BANNER", "STANDING_BANNER"),
YELLOW_BANNER(11, "STANDING_BANNER", "BANNER"),
YELLOW_BED(4, "BED_BLOCK", "BED"),
YELLOW_CARPET(4, "CARPET"),
YELLOW_CONCRETE(4, "CONCRETE"),
@@ -1209,22 +1238,31 @@ public enum XMaterial {
YELLOW_TERRACOTTA(4, "HARD_CLAY", "STAINED_CLAY"),
YELLOW_WALL_BANNER(11, "WALL_BANNER"),
YELLOW_WOOL(4, "WOOL"),
ZOGLIN_SPAWN_EGG("1.16"),
ZOMBIE_HEAD(2, "SKULL", "SKULL_ITEM"),
ZOMBIE_HORSE_SPAWN_EGG(29, "MONSTER_EGG"),
ZOMBIE_SPAWN_EGG(54, "MONSTER_EGG"),
ZOMBIE_VILLAGER_SPAWN_EGG(27, "MONSTER_EGG"),
ZOMBIE_WALL_HEAD(2, "SKULL", "SKULL_ITEM"),
PIGLIN_SPAWN_EGG(57, "MONSTER_EGG"),
ZOMBIFIED_PIGLIN_SPAWN_EGG(57, "MONSTER_EGG", "ZOMBIE_PIGMAN_SPAWN_EGG");
/**
* An immutable cached set of {@link XMaterial#values()} to avoid allocating memory for
* Cached set of {@link XMaterial#values()} to avoid allocating memory for
* calling the method every time.
* This list is unmodifiable.
*
* @since 2.0.0
*/
public static final EnumSet<XMaterial> VALUES = EnumSet.allOf(XMaterial.class);
public static final List<XMaterial> VALUES = Collections.unmodifiableList(Arrays.asList(values()));
/**
* We don't want to use {@link Enums#getIfPresent(Class, String)} to avoid a few checks.
*
* @since 5.1.0
*/
private static final Map<String, XMaterial> NAMES = new HashMap<>();
/**
* A set of material names that can be damaged.
* <p>
@@ -1233,13 +1271,13 @@ public enum XMaterial {
*
* @since 1.0.0
*/
private static final ImmutableSet<String> DAMAGEABLE = ImmutableSet.of(
private static final Set<String> DAMAGEABLE = new HashSet<>(Arrays.asList(
"HELMET", "CHESTPLATE", "LEGGINGS", "BOOTS",
"SWORD", "AXE", "PICKAXE", "SHOVEL", "HOE",
"ELYTRA", "TRIDENT", "HORSE_ARMOR", "BARDING",
"SHEARS", "FLINT_AND_STEEL", "BOW", "FISHING_ROD",
"CARROT_ON_A_STICK", "CARROT_STICK", "SPADE", "SHIELD"
);
));
/**
* <b>XMaterial Paradox (Duplication Check)</b>
* <p>
@@ -1250,29 +1288,25 @@ public enum XMaterial {
*
* @since 3.0.0
*/
private static final ImmutableMap<XMaterial, XMaterial> duplicated = Maps.immutableEnumMap(ImmutableMap.<XMaterial, XMaterial>builder()
.put(MELON, MELON_SLICE)
.put(CARROT, CARROTS)
.put(POTATO, POTATOES)
.put(BEETROOT, BEETROOTS)
.put(BROWN_MUSHROOM, BROWN_MUSHROOM_BLOCK)
.put(BRICK, BRICKS)
.put(NETHER_BRICK, NETHER_BRICKS)
// Illegal Elements
// Since both 1.12 and 1.13 have <type>_DOOR XMaterial will use it
// for 1.12 to parse the material, but it needs <type>_DOOR_ITEM.
// We'll trick XMaterial into thinking this needs to be parsed
// using the old methods.
// These materials have their enum name added to the legacy list as well.
.put(DARK_OAK_DOOR, DARK_OAK_DOOR)
.put(ACACIA_DOOR, ACACIA_DOOR)
.put(BIRCH_DOOR, BIRCH_DOOR)
.put(JUNGLE_DOOR, JUNGLE_DOOR)
.put(SPRUCE_DOOR, SPRUCE_DOOR)
.build()
);
private static final EnumMap<XMaterial, XMaterial> DUPLICATED = new EnumMap<XMaterial, XMaterial>(XMaterial.class);
/**
* Guava (Google Core Libraries for Java)'s cache for performance and timed caches.
* For strings that match a certain XMaterial. Mostly cached for configs.
*
* @since 1.0.0
*/
private static final Cache<String, XMaterial> NAME_CACHE = CacheBuilder.newBuilder()
.expireAfterAccess(15, TimeUnit.MINUTES)
.build();
/**
* Guava (Google Core Libraries for Java)'s cache for performance and timed caches.
* For XMaterials that are already parsed once.
*
* @since 3.0.0
*/
private static final Cache<XMaterial, Optional<Material>> PARSED_CACHE = CacheBuilder.newBuilder()
.expireAfterAccess(10, TimeUnit.MINUTES)
.build();
/*
* A set of all the legacy names without duplicates.
* <p>
@@ -1287,36 +1321,24 @@ public enum XMaterial {
.filter(m -> m.charAt(1) == '.')
.collect(Collectors.collectingAndThen(Collectors.toSet(), ImmutableSet::copyOf));
*/
/**
* Guava (Google Core Libraries for Java)'s cache for performance and timed caches.
* For strings that match a certain XMaterial. Mostly cached for configs.
* This is used for {@link #isOneOf(Collection)}
*
* @since 1.0.0
* @since 3.4.0
*/
private static final Cache<String, XMaterial> NAME_CACHE = CacheBuilder.newBuilder()
.softValues()
.expireAfterAccess(15, TimeUnit.MINUTES)
.build();
/**
* Guava (Google Core Libraries for Java)'s cache for performance and timed caches.
* For XMaterials that are already parsed once.
*
* @since 3.0.0
*/
private static final Cache<XMaterial, Optional<Material>> PARSED_CACHE = CacheBuilder.newBuilder()
.softValues()
.expireAfterAccess(10, TimeUnit.MINUTES)
.concurrencyLevel(Runtime.getRuntime().availableProcessors())
.build();
/**
* Pre-compiled RegEx pattern.
* Include both replacements to avoid recreating string multiple times with multiple RegEx checks.
*
* @since 3.0.0
*/
private static final Pattern FORMAT_PATTERN = Pattern.compile("\\W+");
private static final LoadingCache<String, Pattern> CACHED_REGEX = CacheBuilder.newBuilder()
.expireAfterAccess(1, TimeUnit.HOURS)
.build(new CacheLoader<String, Pattern>() {
@Override
public Pattern load(@Nonnull String str) {
try {
return Pattern.compile(str);
} catch (PatternSyntaxException ex) {
ex.printStackTrace();
return null;
}
}
});
/**
* The current version of the server in the a form of a major version.
*
@@ -1330,6 +1352,35 @@ public enum XMaterial {
* @since 3.0.0
*/
private static final boolean ISFLAT = supports(13);
static {
DUPLICATED.put(MELON, MELON_SLICE);
DUPLICATED.put(CARROT, CARROTS);
DUPLICATED.put(POTATO, POTATOES);
DUPLICATED.put(BEETROOT, BEETROOTS);
DUPLICATED.put(BROWN_MUSHROOM, BROWN_MUSHROOM_BLOCK);
DUPLICATED.put(BRICK, BRICKS);
DUPLICATED.put(NETHER_BRICK, NETHER_BRICKS);
// Illegal Elements
// Since both 1.12 and 1.13 have <type>_DOOR XMaterial will use it
// for 1.12 to parse the material, but it needs <type>_DOOR_ITEM.
// We'll trick XMaterial into thinking this needs to be parsed
// using the old methods.
// Some of these materials have their enum name added to the legacy list as well.
DUPLICATED.put(DARK_OAK_DOOR, DARK_OAK_DOOR);
DUPLICATED.put(ACACIA_DOOR, ACACIA_DOOR);
DUPLICATED.put(BIRCH_DOOR, BIRCH_DOOR);
DUPLICATED.put(JUNGLE_DOOR, JUNGLE_DOOR);
DUPLICATED.put(SPRUCE_DOOR, SPRUCE_DOOR);
DUPLICATED.put(CAULDRON, CAULDRON);
DUPLICATED.put(BREWING_STAND, BREWING_STAND);
}
static {
for (XMaterial material : VALUES) NAMES.put(material.name(), material);
}
/**
* The data value of this material https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening
*
@@ -1382,7 +1433,7 @@ public enum XMaterial {
* An invocation of this method yields exactly the same result as the expression:
* <p>
* <blockquote>
* {@link #getVersion()} == 1.8
* !{@link #supports(int)} 9
* </blockquote>
*
* @since 2.0.0
@@ -1391,6 +1442,18 @@ public enum XMaterial {
return !supports(9);
}
/**
* Gets the {@link XMaterial} with this name without throwing an exception.
*
* @param name the name of the material.
* @return an optional that can be empty.
* @since 5.1.0
*/
@Nonnull
private static Optional<XMaterial> getIfPresent(@Nonnull String name) {
return Optional.ofNullable(NAMES.get(name));
}
/**
* The current version of the server.
*
@@ -1442,8 +1505,9 @@ public enum XMaterial {
Validate.notEmpty(name, "Cannot check for null or empty material name");
name = format(name);
for (XMaterial materials : VALUES)
for (XMaterial materials : VALUES) {
if (materials.name().equals(name)) return true;
}
return false;
}
@@ -1463,13 +1527,13 @@ public enum XMaterial {
/**
* Parses material name and data value from the specified string.
* The seperators are: <b>, or :</b>
* The separator for the material name and its data value is {@code :}
* Spaces are allowed. Mostly used when getting materials from config for old school minecrafters.
* <p>
* <b>Examples</b>
* <p><pre>
* {@code INK_SACK:1 -> RED_DYE}
* {@code WOOL, 14 -> RED_WOOL}
* {@code WOOL: 14 -> RED_WOOL}
* </pre>
*
* @param name the material string that consists of the material name, data and separator character.
@@ -1477,14 +1541,17 @@ public enum XMaterial {
* @see #matchXMaterial(String)
* @since 3.0.0
*/
@Nonnull
private static Optional<XMaterial> matchXMaterialWithData(String name) {
for (char separator : new char[]{',', ':'}) {
int index = name.indexOf(separator);
if (index == -1) continue;
int index = name.indexOf(':');
if (index != -1) {
String mat = format(name.substring(0, index));
byte data = Byte.parseByte(StringUtils.deleteWhitespace(name.substring(index + 1)));
return matchDefinedXMaterial(mat, data);
try {
byte data = (byte) Integer.parseInt(StringUtils.deleteWhitespace(name.substring(index + 1)));
return matchDefinedXMaterial(mat, data);
} catch (NumberFormatException ignored) {
}
}
return Optional.empty();
@@ -1502,7 +1569,7 @@ public enum XMaterial {
public static XMaterial matchXMaterial(@Nonnull Material material) {
Objects.requireNonNull(material, "Cannot match null material");
return matchDefinedXMaterial(material.name(), (byte) -1)
.orElseThrow(() -> new IllegalArgumentException("Unsupported Material With No Bytes: " + material.name()));
.orElseThrow(() -> new IllegalArgumentException("Unsupported material with no data value: " + material.name()));
}
/**
@@ -1522,7 +1589,7 @@ public enum XMaterial {
byte data = (byte) (ISFLAT || isDamageable(material) ? 0 : item.getDurability());
return matchDefinedXMaterial(material, data)
.orElseThrow(() -> new IllegalArgumentException("Unsupported Material: " + material + " (" + data + ')'));
.orElseThrow(() -> new IllegalArgumentException("Unsupported material: " + material + " (" + data + ')'));
}
/**
@@ -1544,11 +1611,12 @@ public enum XMaterial {
// Do basic number and boolean checks before accessing more complex enum stuff.
// Maybe we can simplify (ISFLAT || !duplicated) with the (!ISFLAT && duplicated) under it to save a few nanoseconds?
// if (!Boolean.valueOf(Boolean.getBoolean(Boolean.TRUE.toString())).equals(Boolean.FALSE.booleanValue())) return null;
if (data <= 0 && !duplicated) {
Optional<XMaterial> xMaterial = null;
if (data <= 0 && (ISFLAT || !duplicated)) {
// Apparently the transform method is more efficient than toJavaUtil()
// toJavaUtil isn't even supported in older versions.
Optional<XMaterial> xMat = Enums.getIfPresent(XMaterial.class, name).transform(Optional::of).or(Optional.empty());
if (xMat.isPresent()) return xMat;
xMaterial = getIfPresent(name);
if (xMaterial.isPresent()) return xMaterial;
}
// XMaterial Paradox (Duplication Check)
@@ -1566,7 +1634,7 @@ public enum XMaterial {
// A solution for XMaterial Paradox.
// Manually parses the duplicated materials to find the exact material based on the server version.
// If ends with "S" -> Plural Form Material
return Enums.getIfPresent(XMaterial.class, name).transform(Optional::of).or(Optional.empty());
return xMaterial == null ? getIfPresent(name) : xMaterial;
}
return Optional.ofNullable(xMat);
}
@@ -1585,7 +1653,7 @@ public enum XMaterial {
*/
private static boolean isDuplicated(@Nonnull String name) {
// Don't use matchXMaterial() since this method is being called from matchXMaterial() itself and will cause a StackOverflowError.
for (Map.Entry<XMaterial, XMaterial> duplicated : duplicated.entrySet()) {
for (Map.Entry<XMaterial, XMaterial> duplicated : DUPLICATED.entrySet()) {
XMaterial material = duplicated.getKey();
if (material.name().equals(name) || material.anyMatchLegacy(name)) return true;
}
@@ -1614,16 +1682,41 @@ public enum XMaterial {
/**
* Attempts to build the string like an enum name.
* Removes all the spaces, numbers and extra non-English characters. Also removes some config/in-game based strings.
* Removes all the spaces, and extra non-English characters. Also removes some config/in-game based strings.
* While this method is hard to maintain, it's extremely efficient. It's approximately more than x5 times faster than
* the normal RegEx + String Methods approach for both formatted and unformatted material names.
*
* @param name the material name to modify.
* @return a Material enum name.
* @since 2.0.0
*/
@Nonnull
private static String format(@Nonnull String name) {
return FORMAT_PATTERN.matcher(
name.trim().replace('-', '_').replace(' ', '_')).replaceAll("").toUpperCase(Locale.ENGLISH);
protected static String format(@Nonnull String name) {
int len = name.length();
char[] chs = new char[len];
int count = 0;
boolean appendUnderline = false;
for (int i = 0; i < len; ++i) {
char ch = name.charAt(i);
if (!appendUnderline && count != 0 && (ch == '-' || ch == ' ' || ch == '_') && chs[count] != '_') appendUnderline = true;
else {
boolean number = false;
// Old materials have numbers in them.
if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (number = (ch >= '0' && ch <= '9'))) {
if (appendUnderline) {
chs[count++] = '_';
appendUnderline = false;
}
if (number) chs[count++] = ch;
else chs[count++] = (char) (ch & 0x5f);
}
}
}
return new String(chs, 0, count);
}
/**
@@ -1709,8 +1802,9 @@ public enum XMaterial {
*/
public static boolean isDamageable(@Nonnull String name) {
Objects.requireNonNull(name, "Material name cannot be null");
for (String damageable : DAMAGEABLE)
for (String damageable : DAMAGEABLE) {
if (name.contains(damageable)) return true;
}
return false;
}
@@ -1750,32 +1844,31 @@ public enum XMaterial {
* <p>
* Want to learn RegEx? You can mess around in <a href="https://regexr.com/">RegExr</a> website.
*
* @param material the base material to match other materials with.
* @param materials the material names to check base material on.
* @return true if one of the given material names is similar to the base material.
* @since 3.1.1
*/
public static boolean isOneOf(@Nonnull Material material, @Nullable List<String> materials) {
public boolean isOneOf(@Nullable Collection<String> materials) {
if (materials == null || materials.isEmpty()) return false;
Objects.requireNonNull(material, "Cannot match materials with a null material");
String name = material.name();
String name = this.name();
for (String comp : materials) {
comp = comp.toUpperCase();
if (comp.startsWith("CONTAINS:")) {
comp = format(comp.substring(9));
String checker = comp.toUpperCase(Locale.ENGLISH);
if (checker.startsWith("CONTAINS:")) {
comp = format(checker.substring(9));
if (name.contains(comp)) return true;
continue;
}
if (comp.startsWith("REGEX:")) {
if (checker.startsWith("REGEX:")) {
comp = comp.substring(6);
if (name.matches(comp)) return true;
Pattern pattern = CACHED_REGEX.getUnchecked(comp);
if (pattern != null && pattern.matcher(name).matches()) return true;
continue;
}
// Direct Object Equals
Optional<XMaterial> mat = matchXMaterial(comp);
if (mat.isPresent() && mat.get().parseMaterial() == material) return true;
Optional<XMaterial> xMat = matchXMaterial(comp);
if (xMat.isPresent() && xMat.get() == this) return true;
}
return false;
}
@@ -1809,27 +1902,14 @@ public enum XMaterial {
@SuppressWarnings("deprecation")
public ItemStack setType(@Nonnull ItemStack item) {
Objects.requireNonNull(item, "Cannot set material for null ItemStack");
Material material = this.parseMaterial();
Objects.requireNonNull(material, "Unsupported material: " + this.name());
item.setType(this.parseMaterial());
item.setType(material);
if (!ISFLAT && !this.isDamageable()) item.setDurability(this.data);
return item;
}
/**
* Checks if the list of given material names matches the given base material.
* Mostly used for configs.
*
* @param materials the material names to check base material on.
* @return true if one of the given material names is similar to the base material.
* @see #isOneOf(Material, List)
* @since 3.0.0
*/
public boolean isOneOf(@Nullable List<String> materials) {
Material material = this.parseMaterial();
if (material == null) return false;
return isOneOf(material, materials);
}
/**
* Checks if the given string matches any of this material's legacy material names.
* All the values passed to this method will not be null or empty and are formatted correctly.
@@ -1868,7 +1948,7 @@ public enum XMaterial {
*/
@SuppressWarnings("deprecation")
public int getId() {
if (this.data != 0 || (this.legacy.length != 0 && Integer.parseInt(this.legacy[0].substring(2)) >= 13)) return -1;
if (this.data != 0 || (this.legacy.length != 0 && this.legacy[0].charAt(1) == '.' && Integer.parseInt(this.legacy[0].substring(2)) >= 13)) return -1;
Material material = this.parseMaterial();
return material == null ? -1 : material.getId();
}
@@ -1881,7 +1961,7 @@ public enum XMaterial {
* @since 2.0.0
*/
public boolean isDuplicated() {
return duplicated.containsKey(this);
return DUPLICATED.containsKey(this);
}
/**
@@ -1984,7 +2064,8 @@ public enum XMaterial {
if (mat == null) mat = requestOldMaterial(suggest);
}
if (mat != null) PARSED_CACHE.put(this, Optional.ofNullable(mat));
Optional<Material> opt = Optional.ofNullable(mat);
PARSED_CACHE.put(this, opt);
return mat;
}
+52 -7
View File
@@ -1,4 +1,7 @@
# 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:
@@ -15,7 +18,7 @@ flight:
accountForTpsDrops: 250
# How many milliseconds to account for teleports
# Increase this is you debug 'had too little Y dropoff' after teleports
accountForTeleports: 100
accountForTeleports: 150
# Checks for climbing behaviour in air
# Debugs as 'tried to climb air'
airClimb:
@@ -95,11 +98,21 @@ speed:
# 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:
# Should this check be enabled?
enabled: true
# Checks for vanilla water walking/jumping
# Debugs as 'tried to walk on water'
walk:
@@ -109,20 +122,20 @@ waterwalk:
# 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 lunge on 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 walk on 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.0642
minimumDistXZ: 0.098
# FastLadder check settings
# Checks if a player moves too fast on a ladder
@@ -136,6 +149,14 @@ fastladder:
# 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:
@@ -169,6 +190,18 @@ killaura:
# 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:
@@ -191,7 +224,7 @@ velocity:
# Should this check be enabled?
enabled: true
# Minimum percentage of the given knockback a player has to meet
minimumPercentage: 98
minimumPercentage: 75
# Amount of low-velocity moments before flagging
vlBeforeFlag: 2
@@ -281,6 +314,18 @@ sneak:
# 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:
+9 -3
View File
@@ -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.
# However, alerts will still be sent to console and to admins online, and events will still take place.
silent-mode: false
# Disable broadcasts about why a player was kicked
disable-broadcast: false
# Should ops be exempt from all checks?
exempt-op: false
# Should AntiCheatReloaded track plugins in its own registered events?
@@ -35,10 +37,14 @@ system:
# Do NOT enable this in a production environment!
debug-mode: false
# To prevent spamming, staff and the console will only be notified every x violations
# Minimum value is 1, default is 10
# Minimum value is 1, default is 8
# Example with 5: notifications after 5 vl, 10vl, 15vl, etc.
notify-every-vl: 10
# Use /AntiCheatReloaded checks for a list of valid checks
notify-every-vl: 8
# Maximum distance a player can be set back
# If the last known valid location is further away than this,
# the player will be rubberbanded at their current location
# Minimum value is 5, default is 50
max-setback-distance: 50
disable-in:
- example-world
- example-world-2
+2 -2
View File
@@ -3,6 +3,6 @@
# To disable warnings or kicking, change WARN and/or KICK to NONE
groups:
- 'Low : 50 : GREEN : NONE'
- 'Medium : 100 : YELLOW : WARN'
- 'High : 175 : RED : KICK'
- 'Medium : 60 : YELLOW : WARN'
- 'High : 75 : RED : KICK'
- 'Custom : -1 : GREEN : COMMAND[ban %player%;]'
+28 -10
View File
@@ -1,17 +1,35 @@
# AntiCheatReloaded language file
# The alert message when a player enters a higher group
ALERT:
- '&c%player% has just entered the %group% hack group.'
- '&c%player%''s last failed check was: %check%.'
- '&cType ''/acr report %player%'' for more information.'
- '&6&lACR &8> &7%player% has just entered the %group% hack group.'
- '&6&lACR &8> &7%player%''s last failed check was: %check%.'
- '&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:
- '&6&lACR &8>&7 You have been flagged for using cheats.'
- '&6&lACR &8>&7 If you continue to cheat, action will be taken.'
BAN_REASON: '&6&lACR &8> &7Banned by AntiCheatReloaded'
# Ban 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'
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'
SPAM_WARNING: '&cStop spamming the server or you will be kicked!'
SPAM_KICK_REASON: '&cKicked for spamming'
SPAM_KICK_BROADCAST: '&c%player% was kicked for spamming'
SPAM_BAN_REASON: '&cBanned for spamming'
SPAM_BAN_BROADCAST: '&c%player% was banned for spamming'
# The warning message to send when a player is spamming
SPAM_WARNING: '&6&lACR &8> &7Stop spamming the server or you will be kicked!'
# Kick reason when 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'
# The prefix for staff and debug alerts
ALERT_PREFIX: "&6&lACR &8> &7"
+10 -13
View File
@@ -1,34 +1,31 @@
# Time to exempt a player from moving because of entering/exiting a vehicle
# Increase in case of false positives
ENTERED_EXITED_TIME: 1000
ENTERED_EXITED_TIME: 2500
# Time to exempt a player from moving because of teleporting
# Increase in case of false positives
TELEPORT_TIME: 1000
# Time to exempt a player from moving because of exiting fly mode
# Changing this value is almost never required
EXIT_FLY_TIME: 2000
TELEPORT_TIME: 1500
# Time to exempt a player from moving because of joining the server
# If your server is slow when a player joins, increasing this value is important
# Shouldn't be lower than 1500 or higher than 5000
JOIN_TIME: 2000
# Time to exempt a player from moving because of taking damage
# 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
# 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
# Can be decreased very slightly to increase detection
# Increase in case of false positives, but shouldn't be necessary
KNOCKBACK_DAMAGE_TIME: 4000
# Increase in case of false positives after knockback
KNOCKBACK_DAMAGE_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
# 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: 2000
VELOCITY_TIME: 1000
# This is a set value and shouldn't be changed unless you know what you're doing
VELOCITY_PREVENT: 5000
VELOCITY_PREVENT: 2000
# This is a set value and shouldn't be changed unless you know what you're doing
VELOCITY_MAXTIMES: 2
# Minimum travel distance for move to be considered a teleport and subsequently be ignored
+13 -1
View File
@@ -127,6 +127,15 @@ permissions:
anticheat.check.aimbot:
description: Allow players to use aimbot
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:
description: Total exemption from checks
default: false
@@ -157,4 +166,7 @@ permissions:
anticheat.check.unicode: true
anticheat.check.illegalinteract: 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