mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fixed descending waterfalls (or climbing out of them to get air) and a few logging issues.
This commit is contained in:
1 parent
077f67f900
commit
9253a93fe0
4 files changed
+47
-33
No files matched your search
@@ -77,16 +77,25 @@ public class AnticheatManager
|
||||
fileLogger.setUseParentHandlers(false);
|
||||
fileLogger.addHandler(fileHandler);
|
||||
}
|
||||
|
||||
|
||||
public void log(String message)
|
||||
{
|
||||
log(message, 0);
|
||||
}
|
||||
|
||||
public void log(String message, int i)
|
||||
{
|
||||
if (getConfiguration().logConsole())
|
||||
{
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED+message);
|
||||
}
|
||||
if (getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH)
|
||||
}
|
||||
if(i == 0 && getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH) // Not an alert, normal log message
|
||||
{
|
||||
fileLog(ChatColor.stripColor(message));
|
||||
fileLog(message);
|
||||
}
|
||||
else if(getConfiguration().getFileLogLevel() != 0)// alert
|
||||
{
|
||||
fileLog(message);
|
||||
}
|
||||
logs.add(ChatColor.stripColor(message));
|
||||
}
|
||||
@@ -103,9 +112,9 @@ public class AnticheatManager
|
||||
{
|
||||
return logs;
|
||||
}
|
||||
for(int i = 1; i < 31; i++)
|
||||
for(int i = logs.size()-1; i >= 0; i--)
|
||||
{
|
||||
log.add(logs.get(logs.size() - i));
|
||||
log.add(logs.get(i));
|
||||
}
|
||||
logs.clear();
|
||||
return log;
|
||||
|
||||
@@ -591,39 +591,42 @@ public class Backend
|
||||
String name = player.getName();
|
||||
int y1 = (int)distance.fromY();
|
||||
int y2 = (int)distance.toY();
|
||||
if(!isMovingExempt(player) && (y1 == y2 || y1 < y2) && !Utilities.isInWater(player) && !Utilities.canStand(player.getLocation().getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -1, 0).getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -2, 0).getBlock()))
|
||||
if(!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.canStand(player.getLocation().getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -1, 0).getBlock()) && Utilities.cantStandAt(player.getLocation().add(0, -2, 0).getBlock()))
|
||||
{
|
||||
Block block = player.getLocation().getBlock();
|
||||
//Check if the player is climbing up water.
|
||||
if(block.getRelative(BlockFace.NORTH).isLiquid() || block.getRelative(BlockFace.SOUTH).isLiquid() || block.getRelative(BlockFace.EAST).isLiquid() || block.getRelative(BlockFace.WEST).isLiquid())
|
||||
{
|
||||
//Even if they are using a hacked client and flying next to water to abuse this, they can't be go past the speed limit so they might as well swim
|
||||
return distance.getYDifference() > magic.WATER_CLIMB_MAX;
|
||||
if(y1 < y2)
|
||||
{
|
||||
//Even if they are using a hacked client and flying next to water to abuse this, they can't be go past the speed limit so they might as well swim
|
||||
return distance.getYDifference() > magic.WATER_CLIMB_MAX;
|
||||
}
|
||||
}
|
||||
//Check if the player is crouching on slabs
|
||||
if(player.isSneaking())
|
||||
else if(y1 == y2 || y1 < y2)
|
||||
{
|
||||
if(block.getRelative(BlockFace.NORTH).getTypeId() == 43 || block.getRelative(BlockFace.NORTH).getTypeId() == 44 || block.getRelative(BlockFace.SOUTH).getTypeId() == 43 || block.getRelative(BlockFace.SOUTH).getTypeId() == 44 || block.getRelative(BlockFace.EAST).getTypeId() == 43 || block.getRelative(BlockFace.EAST).getTypeId() == 44 || block.getRelative(BlockFace.WEST).getTypeId() == 43 || block.getRelative(BlockFace.WEST).getTypeId() == 44)
|
||||
//Check if the player is crouching on slabs
|
||||
if(player.isSneaking())
|
||||
{
|
||||
if(block.getRelative(BlockFace.NORTH).getTypeId() == 43 || block.getRelative(BlockFace.NORTH).getTypeId() == 44 || block.getRelative(BlockFace.SOUTH).getTypeId() == 43 || block.getRelative(BlockFace.SOUTH).getTypeId() == 44 || block.getRelative(BlockFace.EAST).getTypeId() == 43 || block.getRelative(BlockFace.EAST).getTypeId() == 44 || block.getRelative(BlockFace.WEST).getTypeId() == 43 || block.getRelative(BlockFace.WEST).getTypeId() == 44)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int violation = flightViolation.containsKey(name) ? flightViolation.get(name)+1 : 1;
|
||||
increment(player, flightViolation, violation);
|
||||
if(violation > magic.FLIGHT_LIMIT)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int violation = flightViolation.containsKey(name) ? flightViolation.get(name)+1 : 1;
|
||||
increment(player, flightViolation, violation);
|
||||
if(violation > magic.FLIGHT_LIMIT)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flightViolation.put(name, 0);
|
||||
return false;
|
||||
}
|
||||
flightViolation.put(name, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void logAscension(Player player, double y1, double y2)
|
||||
|
||||
@@ -80,19 +80,14 @@ public class User
|
||||
if(level == med)
|
||||
{
|
||||
Anticheat.getManager().getUserManager().alertMed(this, type);
|
||||
return true;
|
||||
}
|
||||
else if(level == high)
|
||||
{
|
||||
Anticheat.getManager().getUserManager().alertHigh(this, type);
|
||||
// Prevent the player from going over the high limit
|
||||
level = high-10;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,13 @@ public final class Utilities
|
||||
Anticheat.getManager().log(msg);
|
||||
}
|
||||
}
|
||||
if (Anticheat.getManager().getConfiguration().getFileLogLevel() != 0)
|
||||
{
|
||||
for (String msg : message)
|
||||
{
|
||||
Anticheat.getManager().log(msg, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean cantStandAt(Block block)
|
||||
|
||||
Reference in new issue
Block a user