mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Fix #174
This commit is contained in:
1 parent
a1f7a0cf7f
commit
5f1dc37679
4 files changed
+119
-49
No files matched your search
@@ -41,6 +41,8 @@ public final class MovementManager {
|
||||
public int iceInfluenceTicks = 0;
|
||||
// Ticks influenced by slime
|
||||
public int slimeInfluenceTicks = 0;
|
||||
// Ticks influenced by soil
|
||||
public int soilInfluenceTicks = 0;
|
||||
// Y motion of the movement
|
||||
public double motionY;
|
||||
// Previous Y motion of the movement
|
||||
@@ -162,6 +164,14 @@ public final class MovementManager {
|
||||
this.slimeInfluenceTicks--;
|
||||
}
|
||||
}
|
||||
|
||||
if (Utilities.couldBeOnSoil(to)) {
|
||||
this.soilInfluenceTicks = 6;
|
||||
} else {
|
||||
if (this.soilInfluenceTicks > 0) {
|
||||
this.soilInfluenceTicks--;
|
||||
}
|
||||
}
|
||||
|
||||
if (VersionUtil.isGliding(player)) {
|
||||
this.elytraEffectTicks = 30;
|
||||
|
||||
@@ -269,6 +269,41 @@ public final class Utilities {
|
||||
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isSlime(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player could be standing on soil
|
||||
*
|
||||
* @param location the location to check
|
||||
* @return true if the player could be standing on soil
|
||||
*/
|
||||
public static boolean couldBeOnSoil(Location location) {
|
||||
return isNearSoil(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.01D,
|
||||
location.getBlockZ()))
|
||||
|| isNearSoil(new Location(location.getWorld(), fixXAxis(location.getX()), location.getY() - 0.51D,
|
||||
location.getBlockZ()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a block is a type of soil
|
||||
*
|
||||
* @param block block to check
|
||||
* @return true if block is a type of soil
|
||||
*/
|
||||
public static boolean isSoil(Block block) {
|
||||
Material type = block.getType();
|
||||
return type.equals(XMaterial.SOUL_SOIL.parseMaterial()) || type.equals(XMaterial.SOUL_SAND.parseMaterial());
|
||||
}
|
||||
|
||||
public static boolean isNearSoil(Location location) {
|
||||
return isSoil(location.getBlock()) || isSoil(location.getBlock().getRelative(BlockFace.NORTH))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.EAST))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.WEST))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||
|| isSoil(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player is fully submerged in water
|
||||
|
||||
@@ -76,6 +76,13 @@ public class VersionUtil {
|
||||
}
|
||||
return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER);
|
||||
}
|
||||
|
||||
public static boolean isSoulSpeed(final ItemStack boots) {
|
||||
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.NETHER_UPDATE)) {
|
||||
return false;
|
||||
}
|
||||
return boots.containsEnchantment(Enchantment.SOUL_SPEED);
|
||||
}
|
||||
|
||||
public static ItemStack getItemInHand(final Player player) {
|
||||
return player.getInventory().getItemInMainHand();
|
||||
|
||||
Reference in new issue
Block a user