This commit is contained in:
Rammelkast committed 2021-12-30 22:37:55 +01:00
1 parent b27ffc9842
commit f123e397b6
4 files changed
+20 -14

No files matched your search

@@ -38,6 +38,7 @@ import com.rammelkast.anticheatreloaded.config.providers.Checks;
import com.rammelkast.anticheatreloaded.util.MovementManager;
import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public final class KillAuraCheck {
@@ -98,7 +99,7 @@ public final class KillAuraCheck {
final Entity entity = event.getEntity();
// Do not check while in vehicles
if (player.getVehicle() != null || entity.getVehicle() != null || player.isRiptiding()) {
if (player.getVehicle() != null || entity.getVehicle() != null || VersionUtil.isRiptiding(player)) {
return PASS;
}
@@ -218,15 +218,13 @@ public final class MovementManager {
}
}
if (VersionUtil.CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
if (player.isRiptiding()) {
this.riptideTicks = 30;
if (VersionUtil.isRiptiding(player)) {
this.riptideTicks = 30;
} else {
if (this.riptideTicks > 0) {
this.riptideTicks--;
} else {
if (this.riptideTicks > 0) {
this.riptideTicks--;
} else {
this.riptideTicks = 0;
}
this.riptideTicks = 0;
}
}
@@ -247,7 +245,7 @@ public final class MovementManager {
final Location bottom = to.clone().add(0, -1, 0);
this.bottomSolid = bottom.getBlock().getType().isSolid();
if ((this.motionY > 0.42D && this.motionY <= 0.5625D)
if ((this.motionY > 0.42f && this.motionY <= 0.5625f)
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
this.halfMovement = true;
this.halfMovementHistoryCounter = 30;
@@ -185,9 +185,9 @@ public final class Utilities {
*/
public static boolean couldBeOnHalfblock(final Location location) {
return isNearHalfblock(
new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getBlockZ()))
new Location(location.getWorld(), location.getX(), location.getY() - 0.01D, location.getZ()))
|| isNearHalfblock(new Location(location.getWorld(), location.getX(), location.getY() - 0.51D,
location.getBlockZ()));
location.getZ()));
}
public static boolean isNearHalfblock(final Location location) {
@@ -344,11 +344,11 @@ public final class Utilities {
*/
public static boolean isSlab(final Block block) {
final Material type = block.getType();
return type.name().endsWith("SLAB");
return type.name().toUpperCase().endsWith("SLAB") || type.name().toUpperCase().endsWith("STEP");
}
public static boolean isNearBed(final Location location) {
return isCollisionPoint(location, material -> material.name().endsWith("BED"));
return isCollisionPoint(location, material -> material.name().toUpperCase().endsWith("BED"));
}
/**
@@ -70,6 +70,13 @@ public class VersionUtil {
}
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
}
public static boolean isRiptiding(final Player player) {
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
return false;
}
return player.isRiptiding();
}
public static boolean isFrostWalk(final Player player) {
if (player.getInventory().getBoots() == null) {