mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Changes loggig, renamed GhostHand to IllegalInteract.
This commit is contained in:
1 parent
2ba98f9f9c
commit
f77d45a78d
19 files changed
+73
-65
No files matched your search
@@ -47,7 +47,7 @@ import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.SpeedCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.WaterWalkCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.YAxisCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.player.GhosthandCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Lang;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
@@ -192,7 +192,7 @@ public class Backend {
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
f = f > 1.0F ? 1.0F : f;
|
||||
if (Math.abs(force - f) > magic.BOW_ERROR()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getUniqueId() + " fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "fired their bow too fast (actual force=" + force + ", calculated force=" + f + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class Backend {
|
||||
projectileTime.remove(player.getUniqueId());
|
||||
projectilesShot.remove(player.getUniqueId());
|
||||
if (time < magic.PROJECTILE_TIME_MIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " wound up a bow too fast (actual time=" + time + ", min time=" + magic.PROJECTILE_TIME_MIN() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "wound up a bow too fast (actual time=" + time + ", min time=" + magic.PROJECTILE_TIME_MIN() + ")");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
@@ -224,7 +224,7 @@ public class Backend {
|
||||
blockTime.remove(player.getUniqueId());
|
||||
blocksDropped.remove(player.getUniqueId());
|
||||
if (time < magic.DROP_TIME_MIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " dropped an item too fast (actual time=" + time + ", min time=" + magic.DROP_TIME_MIN() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED,"dropped an item too fast (actual time=" + time + ", min time=" + magic.DROP_TIME_MIN() + ")");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
@@ -234,7 +234,7 @@ public class Backend {
|
||||
if (isInstantBreakExempt(player)) {
|
||||
return new CheckResult(CheckResult.Result.PASSED);
|
||||
} else {
|
||||
String string = player.getName() + " reached too far for a block";
|
||||
String string = "reached too far for a block";
|
||||
double distance =
|
||||
player.getGameMode() == GameMode.CREATIVE ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
||||
: player.getLocation().getDirection().getY() > 0.9 ? magic.BLOCK_MAX_DISTANCE_CREATIVE()
|
||||
@@ -249,7 +249,7 @@ public class Backend {
|
||||
}
|
||||
|
||||
public CheckResult checkLongReachDamage(Player player, double x, double y, double z) {
|
||||
String string = player.getName() + " reached too far for an entity";
|
||||
String string = "reached too far for an entity";
|
||||
double i = x >= magic.ENTITY_MAX_DISTANCE() ? x : y > magic.ENTITY_MAX_DISTANCE() ? y : z > magic.ENTITY_MAX_DISTANCE() ? z : -1;
|
||||
if (i != -1) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, string + " (distance=" + i + ", max=" + magic.ENTITY_MAX_DISTANCE() + ")");
|
||||
@@ -260,7 +260,7 @@ public class Backend {
|
||||
|
||||
public CheckResult checkSpider(Player player, double y) {
|
||||
if (y <= magic.LADDER_Y_MAX() && y >= magic.LADDER_Y_MIN() && !Utilities.isClimbableBlock(player.getLocation().getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to climb a non-ladder (" + player.getLocation().getBlock().getType() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to climb a non-ladder (" + player.getLocation().getBlock().getType() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public class Backend {
|
||||
|
||||
public CheckResult checkYSpeed(Player player, double y) {
|
||||
if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && (y > magic.Y_SPEED_MAX()) && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + "'s y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ public class Backend {
|
||||
int i = nofallViolation.get(uuid);
|
||||
if (i >= magic.NOFALL_LIMIT()) {
|
||||
nofallViolation.put(player.getUniqueId(), 1);
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to avoid fall damage (fall distance = 0 " + i + " times in a row, max=" + magic.NOFALL_LIMIT() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to avoid fall damage (fall distance = 0 " + i + " times in a row, max=" + magic.NOFALL_LIMIT() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ public class Backend {
|
||||
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() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
|
||||
}
|
||||
this.fastSneakViolations.put(player.getUniqueId().toString(), flags + 1);
|
||||
return PASS;
|
||||
@@ -327,7 +327,7 @@ public class Backend {
|
||||
public CheckResult checkSprintHungry(PlayerToggleSprintEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.isSprinting() && player.getGameMode() != GameMode.CREATIVE && player.getFoodLevel() <= magic.SPRINT_FOOD_MIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " sprinted while hungry (food=" + player.getFoodLevel() + ", min=" + magic.SPRINT_FOOD_MIN() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "sprinted while hungry (food=" + player.getFoodLevel() + ", min=" + magic.SPRINT_FOOD_MIN() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class Backend {
|
||||
for (int i = 0; i < (Math.round(distance.getYDifference())) + 1; i++) {
|
||||
Block block = new Location(player.getWorld(), player.getLocation().getX(), to + i, player.getLocation().getZ()).getBlock();
|
||||
if (block.getType() != Material.AIR && block.getType().isSolid()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to move through a solid block", (int) from + 3);
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to move through a solid block", (int) from + 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ public class Backend {
|
||||
long time = System.currentTimeMillis() - stepTime.get(uuid);
|
||||
steps.put(uuid, 0);
|
||||
if (time < magic.TIMER_TIMEMIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to alter their timer, took " + step + " steps in " + time + " ms (min = " + magic.TIMER_TIMEMIN() + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to alter their timer, took " + step + " steps in " + time + " ms (min = " + magic.TIMER_TIMEMIN() + " ms)");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
@@ -399,7 +399,7 @@ public class Backend {
|
||||
increment(player, ascensionCount, max);
|
||||
if (ascensionCount.get(player.getUniqueId()) >= max) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " ascended " + ascensionCount.get(player.getUniqueId())
|
||||
"ascended " + ascensionCount.get(player.getUniqueId())
|
||||
+ " times in a row (max = " + max + string + ")");
|
||||
}
|
||||
}
|
||||
@@ -417,7 +417,7 @@ public class Backend {
|
||||
if (blockPunches.get(uuid) != null && player.getGameMode() != GameMode.CREATIVE) {
|
||||
int i = blockPunches.get(uuid);
|
||||
if (i < magic.BLOCK_PUNCH_MIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to break a block of " + block.getType() + " after only " + i + " punches (min=" + magic.BLOCK_PUNCH_MIN() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break a block of " + block.getType() + " after only " + i + " punches (min=" + magic.BLOCK_PUNCH_MIN() + ")");
|
||||
} else {
|
||||
blockPunches.put(uuid, 0); // it should reset after EACH block break.
|
||||
}
|
||||
@@ -442,7 +442,7 @@ public class Backend {
|
||||
int i = fastBreakViolation.get(uuid);
|
||||
if (i > violations && math < magic.FASTBREAK_MAXVIOLATIONTIME()) {
|
||||
lastBlockBroken.put(uuid, System.currentTimeMillis());
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " broke blocks too fast " + i + " times in a row (max=" + violations + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "broke blocks too fast " + i + " times in a row (max=" + violations + ")");
|
||||
} else if (fastBreakViolation.get(uuid) > 0 && math > magic.FASTBREAK_MAXVIOLATIONTIME()) {
|
||||
fastBreakViolation.put(uuid, 0);
|
||||
}
|
||||
@@ -469,7 +469,7 @@ public class Backend {
|
||||
int i = fastBreaks.get(uuid);
|
||||
fastBreaks.put(uuid, 0);
|
||||
fastBreakViolation.put(uuid, fastBreakViolation.get(uuid) + 1);
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to break " + i + " blocks in " + math + " ms (max=" + magic.FASTBREAK_LIMIT() + " in " + timemax + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to break " + i + " blocks in " + math + " ms (max=" + magic.FASTBREAK_LIMIT() + " in " + timemax + " ms)");
|
||||
} else if (fastBreaks.get(uuid) >= magic.FASTBREAK_LIMIT() || fastBreakViolation.get(uuid) > 0) {
|
||||
if (!blockBreakHolder.containsKey(uuid) || !blockBreakHolder.get(uuid)) {
|
||||
blockBreakHolder.put(uuid, true);
|
||||
@@ -503,7 +503,7 @@ public class Backend {
|
||||
AntiCheatReloaded.debugLog("Player lastBlockPlaced value = " + lastBlockPlaced + ", diff=" + math);
|
||||
if (lastBlockPlaced.get(uuid) > 0 && math < magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
lastBlockPlaced.put(uuid, time);
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "placed blocks too fast " + fastBreakViolation.get(uuid) + " times in a row (max=" + violations + ")");
|
||||
} else if (lastBlockPlaced.get(uuid) > 0 && math > magic.FASTPLACE_MAXVIOLATIONTIME()) {
|
||||
AntiCheatReloaded.debugLog("Reset facePlaceViolation for " + uuid);
|
||||
fastPlaceViolation.put(uuid, 0);
|
||||
@@ -517,7 +517,7 @@ public class Backend {
|
||||
lastBlockPlaceTime.put(uuid, (time - last));
|
||||
lastBlockPlaced.put(uuid, time);
|
||||
fastPlaceViolation.put(uuid, fastPlaceViolation.get(uuid) + 1);
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to place a block " + thisTime + " ms after the last one (min=" + magic.FASTPLACE_TIMEMIN() + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to place a block " + thisTime + " ms after the last one (min=" + magic.FASTPLACE_TIMEMIN() + " ms)");
|
||||
}
|
||||
lastBlockPlaceTime.put(uuid, (time - last));
|
||||
}
|
||||
@@ -623,7 +623,7 @@ public class Backend {
|
||||
long time = System.currentTimeMillis() - inventoryTime.get(uuid);
|
||||
inventoryClicks.put(uuid, 0);
|
||||
if (time < magic.INVENTORY_TIMEMIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " clicked inventory slots " + clicks + " times in " + time + " ms (max=" + magic.INVENTORY_CHECK() + " in " + magic.INVENTORY_TIMEMIN() + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "clicked inventory slots " + clicks + " times in " + time + " ms (max=" + magic.INVENTORY_CHECK() + " in " + magic.INVENTORY_TIMEMIN() + " ms)");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
@@ -631,7 +631,7 @@ public class Backend {
|
||||
|
||||
public CheckResult checkAutoTool(Player player) {
|
||||
if (itemInHand.containsKey(player.getUniqueId()) && itemInHand.get(player.getUniqueId()) != VersionUtil.getItemInHand(player).getType()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " switched tools too fast (had " + itemInHand.get(player.getUniqueId()) + ", has " + VersionUtil.getItemInHand(player).getType() + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "switched tools too fast (had " + itemInHand.get(player.getUniqueId()) + ", has " + VersionUtil.getItemInHand(player).getType() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -639,7 +639,7 @@ public class Backend {
|
||||
|
||||
public CheckResult checkSprintDamage(Player player) {
|
||||
if (isDoing(player, sprinted, magic.SPRINT_MAX())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " sprinted and damaged an entity too fast (min sprint=" + magic.SPRINT_MAX() + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "sprinted and damaged an entity too fast (min sprint=" + magic.SPRINT_MAX() + " ms)");
|
||||
} else {
|
||||
return PASS;
|
||||
}
|
||||
@@ -652,7 +652,7 @@ public class Backend {
|
||||
long l = lastHeal.get(player.getUniqueId());
|
||||
lastHeal.remove(player.getUniqueId());
|
||||
if ((System.currentTimeMillis() - l) < healTime) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "healed too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + healTime + " ms)");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
@@ -664,7 +664,7 @@ public class Backend {
|
||||
long l = startEat.get(player.getUniqueId());
|
||||
startEat.remove(player.getUniqueId());
|
||||
if ((System.currentTimeMillis() - l) < magic.EAT_TIME_MIN()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " ate too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + magic.EAT_TIME_MIN() + " ms)");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "ate too quickly (time=" + (System.currentTimeMillis() - l) + " ms, min=" + magic.EAT_TIME_MIN() + " ms)");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
|
||||
@@ -63,7 +63,7 @@ public enum CheckType {
|
||||
VELOCITY(Permission.CHECK_VELOCITY),
|
||||
CRITICALS(Permission.CHECK_CRITICALS),
|
||||
CHAT_UNICODE(Permission.CHECK_UNICODE),
|
||||
GHOSTHAND(Permission.CHECK_GHOSTHAND);
|
||||
ILLEGAL_INTERACT(Permission.CHECK_ILLEGAL_INTERACT);
|
||||
|
||||
private final Permission permission;
|
||||
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
|
||||
@@ -124,8 +124,19 @@ public enum CheckType {
|
||||
* @return reference name
|
||||
*/
|
||||
public static String getName(CheckType type) {
|
||||
char[] chars = type.toString().replaceAll("_", " ").toLowerCase().toCharArray();
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
return new String(chars);
|
||||
if (type.name().contains("_")) {
|
||||
String[] split = type.name().toLowerCase().split("_");
|
||||
String name = "";
|
||||
for (String part : split) {
|
||||
char[] chars = part.toCharArray();
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
name += new String(chars);
|
||||
}
|
||||
return name;
|
||||
} else {
|
||||
char[] chars = type.name().toLowerCase().toCharArray();
|
||||
chars[0] = Character.toUpperCase(chars[0]);
|
||||
return new String(chars);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,7 @@ public class CriticalsCheck {
|
||||
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0)
|
||||
&& p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||
e.setCancelled(true);
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
p.getName() + " failed Criticals, tried to do a critical without needed conditions")
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, "tried to do a critical without needed conditions")
|
||||
.getMessage(),
|
||||
p, CheckType.CRITICALS);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class KillAuraCheck {
|
||||
int flags = ANGLE_FLAGS.get(player.getUniqueId().toString());
|
||||
if (flags >= AntiCheatReloaded.getManager().getConfiguration().getMagic().KILLAURA_MAX_ANGLE_VIOLATIONS()) {
|
||||
ANGLE_FLAGS.remove(player.getUniqueId().toString());
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " failed KillAura, tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to attack from an illegal angle (angle=" + Math.round(angleDifference) + ")");
|
||||
}
|
||||
|
||||
ANGLE_FLAGS.put(player.getUniqueId().toString(), flags + 1);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class VelocityCheck {
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_MAX_FLAGS()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
p.getName() + " failed Velocity, had zero/low velocity "
|
||||
"had zero/low velocity "
|
||||
+ VL_COUNT.get(p.getUniqueId()) + " times (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_MAX_FLAGS()
|
||||
+ ", dist=" + then.distance(p.getLocation()) + ")").getMessage(),
|
||||
|
||||
@@ -86,8 +86,7 @@ public class BlinkCheck {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED, p.getName()
|
||||
+ " failed Blink, sent " + packets
|
||||
new CheckResult(CheckResult.Result.FAILED, "sent " + packets
|
||||
+ " packets in one second (max=" + AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().BLINK_PACKET()
|
||||
+ ", leniency=" + finalPingLeniency + ", ping=" + ping + ")").getMessage(),
|
||||
|
||||
@@ -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() + " failed ElytraFly, had no Y-axis dropoff when gliding with Elytra");
|
||||
"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() + " failed ElytraFly, tried to glide above jump level");
|
||||
"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() + " failed Flight, flew over " + BLOCKS_OVER_FLIGHT.get(uuid) + " blocks (max="
|
||||
"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() + " failed Glide (yDiff="
|
||||
"desc_amount="
|
||||
+ new BigDecimal(yDiff).setScale(2, RoundingMode.HALF_UP) + ")");
|
||||
} else {
|
||||
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SpeedCheck {
|
||||
AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX());
|
||||
if (num >= AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX()) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + "'s speed was too high " + reason + num + " times in a row (max="
|
||||
"speed was too high " + reason + num + " times in a row (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().SPEED_MAX() + ", speed="
|
||||
+ (x > z ? x : z) + ", max speed=" + max + ")");
|
||||
} else {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class WaterWalkCheck {
|
||||
.WATER_SPEED_VIOLATION_MAX()) {
|
||||
WATER_SPEED_VIOLATIONS.put(uuid, 0);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " stood on water " + v + " times (can't stand on "
|
||||
"stood on water " + v + " times (can't stand on "
|
||||
+ block.getType() + " or "
|
||||
+ block.getRelative(BlockFace.DOWN).getType() + ")");
|
||||
} else {
|
||||
@@ -106,7 +106,7 @@ public class WaterWalkCheck {
|
||||
if (v >= AntiCheatReloaded.getManager().getBackend().getMagic().WATER_ASCENSION_VIOLATION_MAX()) {
|
||||
WATER_ASCENSION_VIOLATIONS.put(uuid, 0);
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " stood on water " + v + " times (can't stand on " + block.getType()
|
||||
"stood on water " + v + " times (can't stand on " + block.getType()
|
||||
+ " or " + block.getRelative(BlockFace.DOWN).getType() + ")");
|
||||
} else {
|
||||
WATER_ASCENSION_VIOLATIONS.put(uuid, v + 1);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class YAxisCheck {
|
||||
}
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max ="
|
||||
"tried to fly on y-axis " + Y_AXIS_VIOLATIONS.get(uuid) + " times (max ="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
|
||||
} else {
|
||||
if (Y_AXIS_VIOLATIONS.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
@@ -107,7 +107,7 @@ public class YAxisCheck {
|
||||
player.teleport(g);
|
||||
}
|
||||
}
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis in "
|
||||
return new CheckResult(CheckResult.Result.FAILED, "tried to fly on y-axis in "
|
||||
+ i + " ms (min =" + AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")");
|
||||
} else {
|
||||
if ((y1 - LAST_Y_COORD_CACHE.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
||||
|
||||
+6
-7
@@ -33,7 +33,7 @@ import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class GhosthandCheck {
|
||||
public class IllegalInteract {
|
||||
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GhosthandCheck {
|
||||
private static CheckResult checkBlockBreak(Player player, BlockBreakEvent event) {
|
||||
if (!isValidTarget(player, event.getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " tried to break a block which was out of view");
|
||||
"tried to break a block which was out of view");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class GhosthandCheck {
|
||||
private static CheckResult checkBlockPlace(Player player, BlockPlaceEvent event) {
|
||||
if (!isValidTarget(player, event.getBlock())) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " tried to place a block out of their view");
|
||||
"tried to place a block out of their view");
|
||||
}
|
||||
return PASS;
|
||||
}
|
||||
@@ -70,7 +70,8 @@ public class GhosthandCheck {
|
||||
: magic.BLOCK_MAX_DISTANCE();
|
||||
Block targetBlock = player.getTargetBlockExact((int) Math.ceil(distance));
|
||||
if (targetBlock == null) {
|
||||
return false;
|
||||
// TODO better check here
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Utilities.isClimbableBlock(targetBlock)) {
|
||||
@@ -84,12 +85,10 @@ public class GhosthandCheck {
|
||||
}
|
||||
|
||||
Location eyeLocation = player.getEyeLocation();
|
||||
|
||||
double yawDifference = KillAuraCheck.calculateYawDifference(eyeLocation, block.getLocation());
|
||||
double playerYaw = player.getEyeLocation().getYaw();
|
||||
|
||||
double angleDifference = Math.abs(180 - Math.abs(Math.abs(yawDifference - playerYaw) - 180));
|
||||
if (Math.round(angleDifference) > magic.GHOSTHAND_MAX_ANGLE_DIFFERENCE()) {
|
||||
if (Math.round(angleDifference) > magic.ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -385,5 +385,5 @@ public interface Magic {
|
||||
/**
|
||||
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
||||
*/
|
||||
public int GHOSTHAND_MAX_ANGLE_DIFFERENCE();
|
||||
public int ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE();
|
||||
}
|
||||
@@ -30,7 +30,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.player.GhosthandCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
@@ -66,11 +66,11 @@ public class BlockListener extends EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
if (getCheckManager().willCheck(player, CheckType.GHOSTHAND)) {
|
||||
CheckResult result = GhosthandCheck.performCheck(player, event);
|
||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||
CheckResult result = IllegalInteract.performCheck(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.GHOSTHAND);
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
@@ -112,11 +112,11 @@ public class BlockListener extends EventListener {
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
if (getCheckManager().willCheck(player, CheckType.GHOSTHAND)) {
|
||||
result = GhosthandCheck.performCheck(player, event);
|
||||
if (getCheckManager().willCheck(player, CheckType.ILLEGAL_INTERACT)) {
|
||||
result = IllegalInteract.performCheck(player, event);
|
||||
if (result.failed()) {
|
||||
event.setCancelled(!silentMode());
|
||||
log(result.getMessage(), player, CheckType.GHOSTHAND);
|
||||
log(result.getMessage(), player, CheckType.ILLEGAL_INTERACT);
|
||||
noHack = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class EventListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
String alertMessage = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + message;
|
||||
String alertMessage = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed " + CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message;
|
||||
if (CONFIG.getConfig().debugMode.getValue()) {
|
||||
player.sendMessage(alertMessage);
|
||||
} else {
|
||||
|
||||
@@ -26,7 +26,7 @@ public enum Permission {
|
||||
CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_KILLAURA, CHECK_LONGREACH, CHECK_UNICODE,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_GHOSTHAND,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_ILLEGAL_INTERACT,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_SPY, SYSTEM_HELP, SYSTEM_UPDATE, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||
|
||||
@@ -260,5 +260,5 @@ KILLAURA_MAX_ANGLE_DIFFERENCE: 50
|
||||
# Increase this in case of false positives
|
||||
KILLAURA_MAX_ANGLE_VIOLATIONS: 3
|
||||
# The maximum angle difference allowed when placing or breaking a block
|
||||
# Increase this in case of false positives
|
||||
GHOSTHAND_MAX_ANGLE_DIFFERENCE: 50
|
||||
# Increase this in case of false positives, can be slightly decreased to tighten check
|
||||
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
||||
@@ -133,8 +133,8 @@ permissions:
|
||||
anticheat.check.unicode:
|
||||
description: Allow players to use unicode in chat
|
||||
default: false
|
||||
anticheat.check.ghosthand:
|
||||
description: Allow players to use ghosthand
|
||||
anticheat.check.illegalinteract:
|
||||
description: Allow players to place blocks in illegal places
|
||||
default: false
|
||||
anticheat.check.exempt:
|
||||
description: Total exemption from checks
|
||||
@@ -167,4 +167,4 @@ permissions:
|
||||
anticheat.check.velocity: true
|
||||
anticheat.check.criticals: true
|
||||
anticheat.check.unicode: true
|
||||
anticheat.check.ghosthand: true
|
||||
anticheat.check.illegalinteract: true
|
||||
Reference in new issue
Block a user