From 244e740548b238c947dfae54c3dfa1ca2e5ea781 Mon Sep 17 00:00:00 2001 From: Super Spy Date: Mon, 21 May 2012 20:40:23 -0500 Subject: [PATCH 1/5] Compatible pom.xml we can all trust --- pom.xml | 58 ++++++++++++++++++++++++++------------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/pom.xml b/pom.xml index 35bf6f8..4e99fc4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,38 +4,38 @@ AntiCheat 1.1-PRE AntiCheat - http://H31IX.NET/ bukkit-repo http://repo.bukkit.org/content/repositories/releases/ - - ${basedir}/src/main/java - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - AntiCheat - - - . - true - ${basedir}/src/main/resources - - plugin.yml - config.yml - - - + + ${basedir}/src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + AntiCheat + + + + . + true + ${basedir}/src/main/resources + + plugin.yml + config.yml + + + @@ -58,12 +58,6 @@ 12.0 jar compile - - - jsr305 - com.google.code.findbugs - - \ No newline at end of file From 6a1bd8c8584ebad59d442b00455b499fdfa977b1 Mon Sep 17 00:00:00 2001 From: Super Spy Date: Mon, 21 May 2012 20:40:23 -0500 Subject: [PATCH 2/5] Reverting commit. --- pom.xml | 58 ++++++++++++++++++++++++++------------------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/pom.xml b/pom.xml index 35bf6f8..4e99fc4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,38 +4,38 @@ AntiCheat 1.1-PRE AntiCheat - http://H31IX.NET/ bukkit-repo http://repo.bukkit.org/content/repositories/releases/ - - ${basedir}/src/main/java - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - AntiCheat - - - . - true - ${basedir}/src/main/resources - - plugin.yml - config.yml - - - + + ${basedir}/src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + AntiCheat + + + + . + true + ${basedir}/src/main/resources + + plugin.yml + config.yml + + + @@ -58,12 +58,6 @@ 12.0 jar compile - - - jsr305 - com.google.code.findbugs - - \ No newline at end of file From e46313eb2b4c62d08f71a4f3510e8c59ca96317d Mon Sep 17 00:00:00 2001 From: Super Spy Date: Mon, 21 May 2012 20:43:30 -0500 Subject: [PATCH 3/5] Reverting pom.xml --- pom.xml | 58 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 4e99fc4..35bf6f8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,38 +4,38 @@ AntiCheat 1.1-PRE AntiCheat + http://H31IX.NET/ bukkit-repo http://repo.bukkit.org/content/repositories/releases/ - - ${basedir}/src/main/java - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - AntiCheat - - - - . - true - ${basedir}/src/main/resources - - plugin.yml - config.yml - - - + + ${basedir}/src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + AntiCheat + + + . + true + ${basedir}/src/main/resources + + plugin.yml + config.yml + + + @@ -58,6 +58,12 @@ 12.0 jar compile + + + jsr305 + com.google.code.findbugs + + \ No newline at end of file From ae41d9c21eed129d1d721d3cdfcc13e527f85fd1 Mon Sep 17 00:00:00 2001 From: Super Spy Date: Wed, 23 May 2012 08:25:21 -0500 Subject: [PATCH 4/5] Improve Fastplace with little tidbits each day. --- src/main/java/net/h31ix/anticheat/manage/Backend.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/h31ix/anticheat/manage/Backend.java b/src/main/java/net/h31ix/anticheat/manage/Backend.java index 3481668..03c9dee 100644 --- a/src/main/java/net/h31ix/anticheat/manage/Backend.java +++ b/src/main/java/net/h31ix/anticheat/manage/Backend.java @@ -47,7 +47,7 @@ public class Backend public static final int FASTBREAK_MAXVIOLATIONTIME = 10000; public static final int FASTPLACE_LIMIT = 2; public static final int FASTPLACE_ZEROLIMIT = 3; - public static final int FASTPLACE_TIMEMAX = 100; + public static final int FASTPLACE_TIMEMAX = 80; public static final int FASTPLACE_MAXVIOLATIONS = 2; public static final int FASTPLACE_MAXVIOLATIONTIME = 10000; @@ -379,11 +379,11 @@ public class Backend } else { - lastZeroHitPlace.put(name, lastZeroHitPlace.get(name)+1); + lastZeroHitPlace.put(name, lastZeroHitPlace.get(name)+1); } } - if(!nocheck && thisTime < FASTPLACE_TIMEMAX && lastTime < FASTPLACE_TIMEMAX - && lastZeroHitPlace.get(name) > FASTPLACE_ZEROLIMIT) + if(thisTime < FASTPLACE_TIMEMAX && lastTime < FASTPLACE_TIMEMAX + || nocheck && lastZeroHitPlace.get(name) > FASTPLACE_ZEROLIMIT) { lastBlockPlaceTime.put(name, (time-last)); lastBlockPlaced.put(name, time); From c7ee0d9661785ce81141a71a822420514bfdba14 Mon Sep 17 00:00:00 2001 From: Super Spy Date: Fri, 25 May 2012 19:07:36 -0500 Subject: [PATCH 5/5] Finally patched the cocky Y-axis fly. --- .../h31ix/anticheat/event/PlayerListener.java | 25 +++++++ .../net/h31ix/anticheat/manage/Backend.java | 67 +++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java index 1e7c334..1c36fe9 100644 --- a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java +++ b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java @@ -197,6 +197,31 @@ public class PlayerListener extends EventListener } log("tried to fly.",player,CheckType.FLY); } + if(checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && backend.checkDoomsOfTheYHeckers(player)) { + from.setX(from.getX()-1); + from.setY(from.getY()-1); + from.setZ(from.getZ()-1); + if(from.getBlock().getTypeId() == 0) + event.setTo(from); + for(int i= 5;i>0;i--) + { + Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-i, player.getLocation().getZ()); + Block lower = newLocation.getBlock(); + if(lower.getTypeId() == 0) + { + player.teleport(newLocation); + break; + } + } + //Lets really give this flyer a real pushdown. + Location newLocation = new Location(player.getWorld(), player.getLocation().getX(), player.getLocation().getY()-2, player.getLocation().getZ()); + Block newBlock = newLocation.getBlock(); + if(newBlock.getTypeId() != 0) + { + event.setTo(newLocation); + } + log("tried to fly on y-axis", player, CheckType.FLY); //cause he's poor. + } if(checkManager.willCheck(player, CheckType.SPEED) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY)) { if(event.getFrom().getY() < event.getTo().getY() && backend.checkYSpeed(player, y)) diff --git a/src/main/java/net/h31ix/anticheat/manage/Backend.java b/src/main/java/net/h31ix/anticheat/manage/Backend.java index 03c9dee..9895d90 100644 --- a/src/main/java/net/h31ix/anticheat/manage/Backend.java +++ b/src/main/java/net/h31ix/anticheat/manage/Backend.java @@ -56,6 +56,10 @@ public class Backend private static final int CHAT_BAN_LEVEL = 3; public static final int FLIGHT_LIMIT = 4; + public static final int FLIGHT_MINIMUM = 1; + public static final int FLIGHT_TIMELIMIT = 5000; + public static final int Y_MAXVIOLATIONS = 1; + public static final int Y_MAXVIOTIME = 5000; public static final int NOFALL_LIMIT = 5; public static final int SPRINT_FOOD_MIN = 6; @@ -75,6 +79,8 @@ public class Backend public static final double LADDER_Y_MIN = 0.11759; public static final double Y_SPEED_MAX = 0.5; + public static final double Y_MAXDIFF = 5; + public static final double Y_TIME = 1000; public static final double XZ_SPEED_MAX = 0.4; public static final double XZ_SPEED_MAX_SPRINT = 0.65; public static final double XZ_SPEED_MAX_SNEAK = 0.2; @@ -99,6 +105,10 @@ public class Backend private Map chatKicks = new HashMap(); private Map nofallViolation = new HashMap(); private Map fastBreakViolation = new HashMap(); + private Map YaxisViolations = new HashMap(); + private Map YaxisLastVio = new HashMap(); + private Map lastYcoord = new HashMap(); + private Map lastYtime = new HashMap(); private Map blocksBroken = new HashMap(); private Map lastBlockBroken = new HashMap(); private Map fastPlaceViolation = new HashMap(); @@ -235,6 +245,63 @@ public class Backend return false; } + public boolean checkDoomsOfTheYHeckers(Player player) { + double y1 = player.getLocation().getY(); + String name = player.getName(); + //Fix Y axis spam. + if(!lastYcoord.containsKey(name) || !lastYtime.containsKey(name) + || !YaxisViolations.containsKey(name) || !YaxisLastVio.containsKey(name)) + { + lastYcoord.put(name, y1); + YaxisViolations.put(name, 0); + YaxisLastVio.put(name, 0L); + lastYtime.put(name, System.currentTimeMillis()); + } + else + { + if(y1 > lastYcoord.get(name) && YaxisViolations.get(name) > Y_MAXVIOLATIONS + && (System.currentTimeMillis() - YaxisLastVio.get(name)) < Y_MAXVIOTIME) + { + Location g = player.getLocation(); + g.setY(lastYcoord.get(name)); + player.sendMessage(ChatColor.RED + "[AntiCheat] Fly hacking on the y-axis detected. Please wait 5 seconds to prevent getting damage."); + YaxisViolations.put(name, YaxisViolations.get(name)+1); + YaxisLastVio.put(name, System.currentTimeMillis()); + if(g.getBlock().getTypeId() == 0) + player.teleport(g); + return true; + } + else + { + if(YaxisViolations.get(name) > Y_MAXVIOLATIONS + && (System.currentTimeMillis() - YaxisLastVio.get(name)) > Y_MAXVIOTIME) { + YaxisViolations.put(name, 0); + YaxisLastVio.put(name, 0L); + } + } + if((y1 - lastYcoord.get(name)) > Y_MAXDIFF && (System.currentTimeMillis() - lastYtime.get(name)) < Y_TIME) + { + Location g = player.getLocation(); + g.setY(lastYcoord.get(name)); + YaxisViolations.put(name, YaxisViolations.get(name)+1); + YaxisLastVio.put(name, System.currentTimeMillis()); + if(g.getBlock().getTypeId() == 0) + player.teleport(g); + return true; + } + else + { + if((y1 - lastYcoord.get(name)) > Y_MAXDIFF + 1 || (System.currentTimeMillis() - lastYtime.get(name)) > Y_TIME) + { + lastYtime.put(name, System.currentTimeMillis()); + lastYcoord.put(name, y1); + } + } + } + //Fix Y axis spam + return false; + } + public boolean checkFlight(Player player, double y1, double y2) { Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN);