mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
Massive messaging and config changes.
Furthermore: + Added basic KillAura angle check (a start to #52) + Fixed sneak false positives + Added staff alert messaging (anticheat.system.alert permission, see #28) + Language file now support color coding + Added debug-mode for testservers + Insignificant pom.xml and README.md updates
This commit is contained in:
1 parent
fec1286c8d
commit
27ca12aec3
30 files changed
+145
-170
No files matched your search
@@ -39,6 +39,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.BlinkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||
@@ -91,6 +92,7 @@ public class Backend {
|
||||
private Map<UUID, Long> stepTime = new HashMap<UUID, Long>();
|
||||
private HashSet<Byte> transparent = new HashSet<Byte>();
|
||||
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
|
||||
private Map<String, Integer> fastSneakViolations = new HashMap<String, Integer>();
|
||||
|
||||
private Magic magic;
|
||||
private AntiCheatManager manager = null;
|
||||
@@ -170,11 +172,13 @@ public class Backend {
|
||||
inventoryTime.remove(pU);
|
||||
inventoryClicks.remove(pU);
|
||||
lastFallPacket.remove(pU);
|
||||
fastSneakViolations.remove(player.getUniqueId().toString());
|
||||
GlideCheck.LAST_DIFFERENCE.remove(pU);
|
||||
GlideCheck.LAST_FALL_DISTANCE.remove(pU);
|
||||
GlideCheck.VIOLATIONS.remove(pU);
|
||||
SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId());
|
||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
|
||||
KillAuraCheck.ANGLE_FLAGS.remove(player.getUniqueId().toString());
|
||||
}
|
||||
|
||||
public CheckResult checkFastBow(Player player, float force) {
|
||||
@@ -295,15 +299,27 @@ public class Backend {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkSneak(Player player, double x, double z) {
|
||||
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle()) {
|
||||
public CheckResult checkSneak(Player player, Location location, double x, double z) {
|
||||
if (player.isSneaking() && !VersionUtil.isFlying(player) && !isMovingExempt(player) && !player.isInsideVehicle() && !Utilities.cantStandAtExp(location)) {
|
||||
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
|
||||
if (i != -1) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
|
||||
if (this.fastSneakViolations.containsKey(player.getUniqueId().toString())) {
|
||||
int flags = this.fastSneakViolations.get(player.getUniqueId().toString());
|
||||
if (flags >= 3) { // TODO possible config
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
|
||||
}
|
||||
this.fastSneakViolations.put(player.getUniqueId().toString(), flags + 1);
|
||||
return PASS;
|
||||
} else {
|
||||
this.fastSneakViolations.put(player.getUniqueId().toString(), 1);
|
||||
return PASS;
|
||||
}
|
||||
} else {
|
||||
this.fastSneakViolations.remove(player.getUniqueId().toString());
|
||||
return PASS;
|
||||
}
|
||||
} else {
|
||||
this.fastSneakViolations.remove(player.getUniqueId().toString());
|
||||
return PASS;
|
||||
}
|
||||
}
|
||||
@@ -362,42 +378,6 @@ public class Backend {
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkSight(Player player, Entity entity) {
|
||||
/*if (entity instanceof LivingEntity) {
|
||||
LivingEntity le = (LivingEntity) entity;
|
||||
// Check to make sure the entity's head is not surrounded
|
||||
Block head = le.getWorld().getBlockAt((int) le.getLocation().getX(), (int) (le.getLocation().getY() + le.getEyeHeight()), (int) le.getLocation().getZ());
|
||||
boolean solid = false;
|
||||
// TODO: This sucks. See if it's possible to not have as many false-positives while still retaining most of the check.
|
||||
for (int x = -2; x <= 2; x++) {
|
||||
for (int z = -2; z <= 2; z++) {
|
||||
for (int y = -1; y < 2; y++) {
|
||||
if (head.getRelative(x, y, z).getTypeId() != 0) {
|
||||
if (head.getRelative(x, y, z).getType().isSolid()) {
|
||||
solid = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (solid) {
|
||||
return PASS;
|
||||
}
|
||||
// TODO: Needs proper testing
|
||||
Location mobLocation = le.getEyeLocation();
|
||||
for (Block block : player.getLineOfSight(transparent, 5)) {
|
||||
if (Math.abs(block.getLocation().getX() - mobLocation.getX()) < 2.3 || Math.abs(block.getLocation().getZ() - mobLocation.getZ()) < 2.3) {
|
||||
return PASS;
|
||||
}
|
||||
}
|
||||
return new CheckResult(Result.FAILED, player.getName()+" tried to damage an entity ("+le.getType()+") out of sight ");
|
||||
}*/
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public void logAscension(Player player, double y1, double y2) {
|
||||
UUID name = player.getUniqueId();
|
||||
if (y1 < y2 && !isAscending.contains(name)) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public enum CheckType {
|
||||
FAST_BOW(Permission.CHECK_FASTBOW),
|
||||
FAST_EAT(Permission.CHECK_FASTEAT),
|
||||
FAST_HEAL(Permission.CHECK_FASTHEAL),
|
||||
FORCEFIELD(Permission.CHECK_FORCEFIELD),
|
||||
KILLAURA(Permission.CHECK_KILLAURA),
|
||||
LONG_REACH(Permission.CHECK_LONGREACH),
|
||||
FAST_PROJECTILE(Permission.CHECK_FASTPROJECTILE),
|
||||
ITEM_SPAM(Permission.CHECK_ITEMSPAM),
|
||||
|
||||
@@ -57,11 +57,11 @@ public class VelocityCheck {
|
||||
else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_AMT()) {
|
||||
.VELOCITY_MAX_FLAGS()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
p.getName() + " failed Velocity, had zero/low velocity "
|
||||
+ VL_COUNT.get(p.getUniqueId()) + " times (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT()
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_MAX_FLAGS()
|
||||
+ ", dist=" + then.distance(p.getLocation()) + ")").getMessage(),
|
||||
p, CheckType.VELOCITY);
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BlinkCheck {
|
||||
|
||||
public static void listenPackets() {
|
||||
AntiCheatReloaded.getProtocolManager()
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL,
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK }) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ElytraCheck {
|
||||
if (changeY == 0.0D) {
|
||||
// Seen no false positives here yet
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " had no Y-axis dropoff when gliding with Elytra");
|
||||
player.getName() + " failed ElytraFly, had no Y-axis dropoff when gliding with Elytra");
|
||||
}
|
||||
|
||||
if (!JUMP_Y_VALUE.containsKey(uuid)) {
|
||||
@@ -81,7 +81,7 @@ public class ElytraCheck {
|
||||
player.teleport(to);
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " tried to glide above jump level");
|
||||
player.getName() + " failed ElytraFly, tried to glide above jump level");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class FlightCheck {
|
||||
if (BLOCKS_OVER_FLIGHT.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.FLIGHT_BLOCK_LIMIT() && (y1 <= y2)) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
|
||||
player.getName() + " failed Flight, flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().FLIGHT_BLOCK_LIMIT() + ")");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class GlideCheck {
|
||||
player.teleport(to);
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " was set back for gliding (yDiff="
|
||||
player.getName() + " failed Glide (yDiff="
|
||||
+ new BigDecimal(yDiff).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||
} else {
|
||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||
|
||||
Reference in new issue
Block a user