mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 14:38:47 +00:00
Hopefully fixed seemingly random attacks of failed checks while climbing
This commit is contained in:
1 parent
59e26344fb
commit
c56ea8151c
3 files changed
+28
-28
No files matched your search
@@ -353,6 +353,29 @@ public class PlayerListener extends EventListener
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkManager.willCheck(player, CheckType.NOFALL) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY() && backend.checkNoFall(player, y))
|
||||
{
|
||||
if (!config.silentMode())
|
||||
{
|
||||
event.setTo(from);
|
||||
player.damage(2); // I added this in here so the player(s) would still receive damage.
|
||||
}
|
||||
log("tried avoid fall damage.", player, CheckType.NOFALL);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void checkSpeed(PlayerMoveEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
if (event.getTo() != event.getFrom())
|
||||
{
|
||||
Distance distance = new Distance(from, to);
|
||||
double x = distance.getXDifference();
|
||||
double y = distance.getYDifference();
|
||||
double z = distance.getZDifference();
|
||||
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))
|
||||
@@ -383,29 +406,6 @@ public class PlayerListener extends EventListener
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkManager.willCheck(player, CheckType.NOFALL) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY) && event.getFrom().getY() > event.getTo().getY() && backend.checkNoFall(player, y))
|
||||
{
|
||||
if (!config.silentMode())
|
||||
{
|
||||
event.setTo(from);
|
||||
player.damage(2); // I added this in here so the player(s) would still receive damage.
|
||||
}
|
||||
log("tried avoid fall damage.", player, CheckType.NOFALL);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void checkSpeed(PlayerMoveEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
if (event.getTo() != event.getFrom())
|
||||
{
|
||||
Distance distance = new Distance(from, to);
|
||||
double x = distance.getXDifference();
|
||||
double y = distance.getYDifference();
|
||||
double z = distance.getZDifference();
|
||||
if (checkManager.willCheck(player, CheckType.WATER_WALK) && backend.checkWaterWalk(player, x, z))
|
||||
{
|
||||
if (!config.silentMode())
|
||||
|
||||
@@ -303,7 +303,7 @@ public class Backend
|
||||
|
||||
public boolean checkSpider(Player player, double y)
|
||||
{
|
||||
if (y <= LADDER_Y_MAX && y >= LADDER_Y_MIN && !Utilities.isOnClimbableBlock(player))
|
||||
if (y <= LADDER_Y_MAX && y >= LADDER_Y_MIN && !Utilities.isClimbableBlock(player.getLocation().getBlock()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -544,7 +544,7 @@ public class Backend
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!isMovingExempt(player) && !Utilities.isOnClimbableBlock(player) && !player.isInsideVehicle() && !Utilities.isInWater(player))
|
||||
if (!isMovingExempt(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !Utilities.isClimbableBlock(player.getLocation().add(0, -1, 0).getBlock()) && !player.isInsideVehicle() && !Utilities.isInWater(player))
|
||||
{
|
||||
double y1 = player.getLocation().getY();
|
||||
String name = player.getName();
|
||||
@@ -682,7 +682,7 @@ public class Backend
|
||||
max += 12;
|
||||
}
|
||||
Block block = player.getLocation().getBlock();
|
||||
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.isOnClimbableBlock(player) && !player.isInsideVehicle())
|
||||
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && !player.isInsideVehicle())
|
||||
{
|
||||
String name = player.getName();
|
||||
if (y1 < y2)
|
||||
|
||||
@@ -133,9 +133,9 @@ public final class Utilities
|
||||
return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
public static boolean isOnClimbableBlock(Player player)
|
||||
public static boolean isClimbableBlock(Block block)
|
||||
{
|
||||
return player.getLocation().getBlock().getType() == Material.VINE || player.getLocation().getBlock().getType() == Material.LADDER;
|
||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER;
|
||||
}
|
||||
|
||||
public static boolean isOnVine(Player player)
|
||||
|
||||
Reference in new issue
Block a user