mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
[BLEEDING] New Chest Visuals Check. There is false positives.
This commit is contained in:
1 parent
ba33955442
commit
6fa61cb254
6 files changed
+229
-6
No files matched your search
@@ -83,7 +83,7 @@ public class AnticheatManager
|
||||
{
|
||||
if(getConfiguration().logConsole())
|
||||
{
|
||||
LOGGER.info(ChatColor.stripColor(message)); //This is temporary. Is something wrong with jline?
|
||||
LOGGER.log(Level.WARNING, ChatColor.stripColor(message)); //This is temporary. Is something wrong with jline?
|
||||
}
|
||||
if(getConfiguration().getFileLogLevel() == LOG_LEVEL_HIGH)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ public class AnticheatManager
|
||||
|
||||
public void fileLog(String message)
|
||||
{
|
||||
FILE_LOGGER.info(message);
|
||||
FILE_LOGGER.log(Level.WARNING, message);
|
||||
}
|
||||
|
||||
public Anticheat getPlugin()
|
||||
|
||||
@@ -261,6 +261,141 @@ public class Backend
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkChestCheat(Player player, Block block)
|
||||
{
|
||||
// The most complicated check in the world...approaching nirvana.
|
||||
int strikes = 0;
|
||||
|
||||
// now let's swing the bat.
|
||||
Distance distance = new Distance(player.getLocation(), block.getLocation());
|
||||
|
||||
//player coords
|
||||
double px = distance.fromX();
|
||||
double py = distance.fromY();
|
||||
double pz = distance.fromZ();
|
||||
|
||||
double x = Math.round(distance.getXDifference());
|
||||
double y = Math.round(distance.getYDifference());
|
||||
double z = Math.round(distance.getZDifference());
|
||||
|
||||
String direction = Utilities.getCardinalDirection(player);
|
||||
|
||||
if(direction != null)
|
||||
{
|
||||
if(direction.equals("N") || direction.equals("NE"))
|
||||
{
|
||||
if(x > 0)
|
||||
{
|
||||
for(int a = 0; a < x + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px-a,py,pz);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(z > 0)
|
||||
{
|
||||
for(int a = 0; a < z + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px,py,pz-a);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(direction.equals("E") || direction.equals("SE"))
|
||||
{
|
||||
if(x > 0)
|
||||
{
|
||||
for(int a = 0; a < x + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px+a,py,pz);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(z > 0)
|
||||
{
|
||||
for(int a = 0; a < z + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px,py,pz-a);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(direction.equals("S") || direction.equals("SW") || direction.equals("W"))
|
||||
{
|
||||
if(x > 0)
|
||||
{
|
||||
for(int a = 0; a < x + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px+a,py,pz);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(z > 0)
|
||||
{
|
||||
for(int a = 0; a < z + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px,py,pz+a);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(direction.equals("NW"))
|
||||
{
|
||||
if(x > 0)
|
||||
{
|
||||
for(int a = 0; a < x + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px-a,py,pz);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(z > 0)
|
||||
{
|
||||
for(int a = 0; a < z + 1; a++)
|
||||
{
|
||||
Location coords = new Location(player.getWorld(), px,py,pz+a);
|
||||
if(coords.getBlock().getTypeId() != 0 && coords.getBlock().getTypeId() != block.getTypeId())
|
||||
{
|
||||
strikes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return strikes > 0;
|
||||
}
|
||||
|
||||
public boolean checkWaterWalk(Player player, double x, double z)
|
||||
{
|
||||
Block block = player.getLocation().getBlock();
|
||||
|
||||
@@ -38,6 +38,7 @@ public enum CheckType
|
||||
WATER_WALK("anticheat.waterwalk"),
|
||||
NO_SWING("anticheat.noswing"),
|
||||
FAST_BREAK("anticheat.fastbreak"),
|
||||
CHEST_HACK("anticheat.chest"),
|
||||
FAST_PLACE("anticheat.fastplace"),
|
||||
SPAM("anticheat.spam"),
|
||||
SPRINT("anticheat.sprint"),
|
||||
|
||||
@@ -30,11 +30,23 @@ public class Distance
|
||||
l2 = from;
|
||||
}
|
||||
|
||||
public double fromY() {
|
||||
public double fromX()
|
||||
{
|
||||
return l2.getX();
|
||||
}
|
||||
|
||||
public double fromY()
|
||||
{
|
||||
return l2.getY();
|
||||
}
|
||||
|
||||
public double toY() {
|
||||
public double fromZ()
|
||||
{
|
||||
return l2.getZ();
|
||||
}
|
||||
|
||||
public double toY()
|
||||
{
|
||||
return l1.getY();
|
||||
}
|
||||
|
||||
@@ -51,5 +63,6 @@ public class Distance
|
||||
public double getYDifference()
|
||||
{
|
||||
return Math.abs(l1.getY()-l2.getY());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user