mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
Started on movement check recode. First up: speed check!
This commit is contained in:
1 parent
610d53550f
commit
636f94b408
11 files changed
+241
-103
No files matched your search
@@ -131,6 +131,41 @@ public final class Utilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on ice
|
||||
*
|
||||
* @param location the location to check
|
||||
* @return true if the player could be standing on ice
|
||||
*/
|
||||
public static boolean couldBeOnIce(Location location) {
|
||||
return isNearIce(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.01D,
|
||||
location.getBlockZ()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a block is a type of ice
|
||||
*
|
||||
* @param block block to check
|
||||
* @return true if block is a type of ice
|
||||
*/
|
||||
public static boolean isIce(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("ICE");
|
||||
}
|
||||
|
||||
public static boolean isNearIce(Location location) {
|
||||
return isIce(location.getBlock())
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.WEST))
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||
|| isBed(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is fully submerged in water
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user