mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 06:28:52 +00:00
commit
c50e1e883b
2 files changed
+96
-4
No files matched your search
@@ -51,7 +51,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;
|
||||
|
||||
@@ -60,6 +60,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;
|
||||
@@ -79,6 +83,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;
|
||||
@@ -103,6 +109,10 @@ public class Backend
|
||||
private Map<String,Integer> chatKicks = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> nofallViolation = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> fastBreakViolation = new HashMap<String,Integer>();
|
||||
private Map<String,Integer> YaxisViolations = new HashMap<String,Integer>();
|
||||
private Map<String,Long> YaxisLastVio = new HashMap<String,Long>();
|
||||
private Map<String,Double> lastYcoord = new HashMap<String,Double>();
|
||||
private Map<String,Long> lastYtime = new HashMap<String,Long>();
|
||||
private Map<String,Integer> blocksBroken = new HashMap<String,Integer>();
|
||||
private Map<String,Long> lastBlockBroken = new HashMap<String,Long>();
|
||||
private Map<String,Integer> fastPlaceViolation = new HashMap<String,Integer>();
|
||||
@@ -239,6 +249,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);
|
||||
@@ -383,11 +450,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);
|
||||
|
||||
Reference in new issue
Block a user