Compare commits

..
3 Commits
Author SHA1 Message Date
Rammelkast 3baa074b6f Remove debug messages 2016-11-22 17:57:17 +01:00
Rammelkast b264bb1e43 Fix #18 2016-11-22 17:56:18 +01:00
Rammelkast 57d7ee9b62 Fix #17 and #19 2016-11-22 17:32:31 +01:00
8 changed files with 80 additions and 16 deletions

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.gravitydevelopment.anticheat</groupId> <groupId>net.gravitydevelopment.anticheat</groupId>
<artifactId>AntiCheat</artifactId> <artifactId>AntiCheat</artifactId>
<version>1.5.3-ALPHA</version> <version>1.5.4-ALPHA</version>
<name>AntiCheatReloaded</name> <name>AntiCheatReloaded</name>
<url>https://rammelkast.com</url> <url>https://rammelkast.com</url>
<properties> <properties>
@@ -170,7 +170,7 @@ public class Backend {
inventoryTime.remove(pU); inventoryTime.remove(pU);
inventoryClicks.remove(pU); inventoryClicks.remove(pU);
lastFallPacket.remove(pU); lastFallPacket.remove(pU);
GlideCheck.lastYDelta.remove(pU); GlideCheck.lastToFall.remove(pU);
GlideCheck.glideBuffer.remove(pU); GlideCheck.glideBuffer.remove(pU);
SpeedCheck.speedViolation.remove(player.getUniqueId()); SpeedCheck.speedViolation.remove(player.getUniqueId());
} }
@@ -258,7 +258,7 @@ public class Backend {
} }
public CheckResult checkYSpeed(Player player, double y) { 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)) { if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && (y > (VersionUtil.isNewYSpeed() ? magic.Y_SPEED_MAX() + 0.05 : magic.Y_SPEED_MAX())) && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP)) {
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, player.getName() + "'s y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
} else { } else {
return PASS; return PASS;
@@ -410,7 +410,7 @@ public class Backend {
string = " with jump potion"; string = " with jump potion";
} }
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) { if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player) && !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock()) && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1.5, 0).getBlock())) {
if (y1 < y2) { if (y1 < y2) {
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) { if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid() && !block.getRelative(BlockFace.EAST).isLiquid() && !block.getRelative(BlockFace.WEST).isLiquid()) {
increment(player, ascensionCount, max); increment(player, ascensionCount, max);
@@ -773,7 +773,7 @@ public class Backend {
YAxisCheck.yAxisLastViolation.remove(player.getUniqueId()); YAxisCheck.yAxisLastViolation.remove(player.getUniqueId());
YAxisCheck.lastYcoord.remove(player.getUniqueId()); YAxisCheck.lastYcoord.remove(player.getUniqueId());
YAxisCheck.lastYtime.remove(player.getUniqueId()); YAxisCheck.lastYtime.remove(player.getUniqueId());
GlideCheck.lastYDelta.remove(player.getUniqueId()); GlideCheck.lastToFall.remove(player.getUniqueId());
GlideCheck.glideBuffer.remove(player.getUniqueId()); GlideCheck.glideBuffer.remove(player.getUniqueId());
} }
@@ -83,8 +83,9 @@ public class KillAuraCheck {
if (!VersionUtil.getVersion().equals("v1_11_R1")) { if (!VersionUtil.getVersion().equals("v1_11_R1")) {
return; return;
} }
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) {
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e); NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
}
} }
} }
@@ -23,7 +23,7 @@ public class GlideCheck {
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED); private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static Map<UUID, Double> lastYDelta = new HashMap<UUID, Double>(); public static Map<UUID, Double> lastToFall = new HashMap<UUID, Double>();
public static Map<UUID, Integer> glideBuffer = new HashMap<UUID, Integer>(); public static Map<UUID, Integer> glideBuffer = new HashMap<UUID, Integer>();
/* /*
@@ -65,18 +65,74 @@ public class GlideCheck {
lastYDelta.put(uuid, math);*/ lastYDelta.put(uuid, math);*/
public static CheckResult runCheck(Player player, Distance distance) { public static CheckResult runCheck(Player player, Distance distance) {
UUID uuid = player.getUniqueId(); /* UUID uuid = player.getUniqueId();
if (AntiCheat.getManager().getBackend().isMovingExempt(player) || VersionUtil.isFlying(player)) { if (AntiCheat.getManager().getBackend().isMovingExempt(player) || VersionUtil.isFlying(player)) {
return PASS; return PASS;
} }
if(!YAxisCheck.lastYcoord.containsKey(uuid)) {
YAxisCheck.lastYcoord.put(uuid, player.getLocation().getY());
}
if(!YAxisCheck.lastYtime.containsKey(uuid)) {
YAxisCheck.lastYtime.put(uuid, System.currentTimeMillis());
}
double currentY = player.getLocation().getY();
double diff = currentY - YAxisCheck.lastYcoord.get(uuid);
double glideMax = AntiCheat.getManager().getBackend().getMagic().GLIDE_MAX();
long timeDiff = System.currentTimeMillis() - YAxisCheck.lastYtime.get(uuid);
if (diff <= glideMax || diff >= 0) {
return PASS;
}
if (!(!(player.getEyeLocation().getBlock().getType() == Material.LADDER)
|| !Utilities.isInWater(player) || !Utilities.isInWeb(player)
|| Utilities.cantStandAt(player.getLocation().getBlock()) || !Utilities.cantStandAtSingle(player.getLocation().getBlock()) || !Utilities.cantStandAtSingle(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))) {
return PASS;
}
if (timeDiff <= 150/) {
return PASS;
}
if(!lastToFall.containsKey(uuid)) {
lastToFall.put(uuid, distanceToFall(player.getLocation()));
} else {
double lastFall = lastToFall.get(uuid);
if (distanceToFall(player.getLocation()) + diff >= lastFall - 0.10125) {
if (!glideBuffer.containsKey(uuid)) {
glideBuffer.put(uuid, 1);
} else {
int buffer = glideBuffer.get(uuid);
if (buffer >= AntiCheat.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
glideBuffer.remove(uuid);
if(!AntiCheat.getManager().getBackend().silentMode())
{
double fallDist = distanceToFall(player.getLocation());
player.teleport(player.getLocation().add(0, -fallDist, 0));
player.setFallDistance((float) fallDist);
}
return new CheckResult(CheckResult.Result.FAILED, uuid + " attempted to glide!");
} else {
glideBuffer.put(uuid, buffer + 1);
}
}
}
}
System.out.println(diff + ":" + timeDiff + ":" + distanceToFall(player.getLocation()));
*/
return PASS; return PASS;
} }
/*private static double distanceToFall(Location location) { private static double distanceToFall(Location location) {
location = location.clone();
double firstY = location.getY(); double firstY = location.getY();
while (location.clone().add(0, -0.1, 0).getBlock().getType() == Material.AIR) while (location.clone().add(0, -0.1, 0).getBlock().getType() == Material.AIR)
location.add(0, -0.1, 0); location.add(0, -0.1, 0);
return firstY - location.getY(); return firstY - location.getY();
}*/ }
} }
@@ -37,7 +37,7 @@ public class SpeedCheck {
reason = "on soulsand "; reason = "on soulsand ";
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND(); max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_SOULSAND();
} }
} else if (player.isFlying()) { } else if (VersionUtil.isFlying(player)) {
reason = "while flying "; reason = "while flying ";
max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY(); max = AntiCheat.getManager().getBackend().getMagic().XZ_SPEED_MAX_FLY();
} else if (player.hasPotionEffect(PotionEffectType.SPEED)) { } else if (player.hasPotionEffect(PotionEffectType.SPEED)) {
@@ -81,7 +81,7 @@ public class NPC_1_11 {
vec.setZ(-3 * vec.getZ()); vec.setZ(-3 * vec.getZ());
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.teleportTo(back, false); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc)); ((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) { if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
this.npc.setInvisible(false); this.npc.setInvisible(false);
@@ -102,7 +102,7 @@ public class NPC_1_11 {
vec.setZ(-3 * vec.getZ()); vec.setZ(-3 * vec.getZ());
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.teleportTo(back, false); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc)); ((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
} }
} else if (e.getTo().getPitch() >= 22) { } else if (e.getTo().getPitch() >= 22) {
@@ -113,7 +113,7 @@ public class NPC_1_11 {
vec.setZ(-3 * vec.getZ()); vec.setZ(-3 * vec.getZ());
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.teleportTo(back, false); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc)); ((CraftPlayer) this.getOwner()).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(npc));
} else { } else {
Location eyelocation = e.getPlayer().getEyeLocation(); Location eyelocation = e.getPlayer().getEyeLocation();
@@ -129,7 +129,6 @@ public class NPC_1_11 {
Location back = eyelocation.add(vec); Location back = eyelocation.add(vec);
this.location = back; // TODO this.location = back; // TODO
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20); this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float)new Random().nextFloat() * 20, (float)new Random().nextFloat() * 20);
this.npc.teleportTo(back, false);
((CraftPlayer) this.getOwner()).getHandle().playerConnection ((CraftPlayer) this.getOwner()).getHandle().playerConnection
.sendPacket(new PacketPlayOutEntityTeleport(npc)); .sendPacket(new PacketPlayOutEntityTeleport(npc));
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) { if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
@@ -40,4 +40,12 @@ public class VersionUtil {
} }
} }
public static boolean isNewYSpeed() {
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) {
return true;
} else {
return false;
}
}
} }
+1 -1
View File
@@ -84,7 +84,7 @@ Y_MAXVIOTIME: 5500
Y_SPEED_MAX: 0.5125 Y_SPEED_MAX: 0.5125
Y_TIME: 800 Y_TIME: 800
GLIDE_LIMIT: 10 GLIDE_LIMIT: 10
GLIDE_MAX: -3.75 GLIDE_MAX: -3.89425
KILLAURA_BOTHITS: 4 KILLAURA_BOTHITS: 4
BLINK_PACKET: 74 BLINK_PACKET: 74
VELOCITY_AMT: 5 VELOCITY_AMT: 5