mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
False positive fixes: Nofall false with shulkers, flight false positive with snow, speed false positive with snow, waterwalk false positive with boats and KillAura false positive with thorns
This commit is contained in:
1 parent
4deb8ae0fb
commit
e9a99f0463
7 files changed
+63
-30
No files matched your search
@@ -29,6 +29,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@@ -229,7 +230,8 @@ public class Backend {
|
|||||||
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
if (player.getGameMode() != GameMode.CREATIVE && !player.isInsideVehicle() && !player.isSleeping()
|
||||||
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
&& !isMovingExempt(player) && !justPlaced(player) && !Utilities.isNearWater(player)
|
||||||
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
&& !Utilities.isInWeb(player) && !player.getLocation().getBlock().getType().name().endsWith("TRAPDOOR")
|
||||||
&& !VersionUtil.isSlowFalling(player)) {
|
&& !VersionUtil.isSlowFalling(player) && !Utilities
|
||||||
|
.isNearShulkerBox(player.getLocation().getBlock().getRelative(BlockFace.DOWN).getLocation())) {
|
||||||
if (player.getFallDistance() == 0) {
|
if (player.getFallDistance() == 0) {
|
||||||
if (nofallViolation.get(uuid) == null) {
|
if (nofallViolation.get(uuid) == null) {
|
||||||
nofallViolation.put(uuid, 1);
|
nofallViolation.put(uuid, 1);
|
||||||
|
|||||||
@@ -92,6 +92,10 @@ public class FlightCheck {
|
|||||||
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
? AntiCheatReloaded.getManager().getBackend().placedBlock.get(player.getUniqueId())
|
||||||
: (blockPlaceAccountingTime + 1);
|
: (blockPlaceAccountingTime + 1);
|
||||||
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
double maxMotionY = System.currentTimeMillis() - lastPlacedBlock > blockPlaceAccountingTime ? 0 : 0.42;
|
||||||
|
// Fixes snow false positive
|
||||||
|
if (movementManager.motionY < 0.004 && Utilities
|
||||||
|
.isNearHalfblock(distance.getFrom().getBlock().getRelative(BlockFace.DOWN).getLocation()))
|
||||||
|
maxMotionY = 0.004D;
|
||||||
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
if (movementManager.motionY > maxMotionY && movementManager.slimeInfluenceTicks <= 0)
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
"tried to fly on the Y-axis (mY=" + movementManager.motionY + ", max=" + maxMotionY + ")");
|
||||||
@@ -123,9 +127,11 @@ public class FlightCheck {
|
|||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
"tried to climb air (mY=" + movementManager.motionY + ")");
|
"tried to climb air (mY=" + movementManager.motionY + ")");
|
||||||
|
|
||||||
|
// TODO hardcoded value against false again..
|
||||||
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
if (checksConfig.isSubcheckEnabled(CheckType.FLIGHT, "airClimb") && movementManager.motionY > 0.42
|
||||||
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
&& movementManager.airTicks > 2 && !AntiCheatReloaded.getManager().getBackend().justVelocity(player)
|
||||||
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
&& !player.hasPotionEffect(PotionEffectType.JUMP)
|
||||||
|
&& !(Math.round(movementManager.motionY * 1000) == 425 && movementManager.airTicks == 11)
|
||||||
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
&& (System.currentTimeMillis() - movementManager.lastTeleport >= checksConfig
|
||||||
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
.getInteger(CheckType.FLIGHT, "airClimb", "accountForTeleports")))
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
return new CheckResult(CheckResult.Result.FAILED,
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
|||||||
/**
|
/**
|
||||||
* @author Rammelkast
|
* @author Rammelkast
|
||||||
* TODO soulsand speed
|
* TODO soulsand speed
|
||||||
* TODO fix false positive with water weeds
|
|
||||||
*/
|
*/
|
||||||
public class SpeedCheck {
|
public class SpeedCheck {
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class WaterWalkCheck {
|
|||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(uuid);
|
||||||
MovementManager movementManager = user.getMovementManager();
|
MovementManager movementManager = user.getMovementManager();
|
||||||
|
|
||||||
if (movementManager.distanceXZ <= 0)
|
if (movementManager.distanceXZ <= 0 || player.getVehicle() != null)
|
||||||
return PASS;
|
return PASS;
|
||||||
|
|
||||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
|
|||||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
@@ -134,29 +135,28 @@ public class EntityListener extends EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.getDamager() instanceof Player) {
|
if (e.getDamager() instanceof Player && event.getCause() == DamageCause.ENTITY_ATTACK) {
|
||||||
Player player = (Player) e.getDamager();
|
Player player = (Player) e.getDamager();
|
||||||
getBackend().logDamage(player, 1);
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
||||||
CheckResult result = KillAuraCheck.checkAngle(player, event);
|
if (result.failed()) {
|
||||||
if (result.failed()) {
|
event.setCancelled(!silentMode());
|
||||||
event.setCancelled(!silentMode());
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
noHack = false;
|
||||||
noHack = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
||||||
CheckResult result = KillAuraCheck.checkReach(player, event.getEntity());
|
if (result.failed()) {
|
||||||
if (result.failed()) {
|
event.setCancelled(!silentMode());
|
||||||
event.setCancelled(!silentMode());
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
log(result.getMessage(), player, CheckType.KILLAURA);
|
noHack = false;
|
||||||
noHack = false;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (noHack) {
|
||||||
if (noHack) {
|
decrease(player);
|
||||||
decrease(player);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public class MovementManager {
|
|||||||
this.onGround = player.isOnGround();
|
this.onGround = player.isOnGround();
|
||||||
|
|
||||||
double x = distance.getXDifference();
|
double x = distance.getXDifference();
|
||||||
double z = distance.getZDifference();
|
double z = distance.getZDifference();
|
||||||
this.lastDistanceXZ = this.distanceXZ;
|
this.lastDistanceXZ = this.distanceXZ;
|
||||||
this.distanceXZ = Math.sqrt(x * x + z * z);
|
this.distanceXZ = Math.sqrt(x * x + z * z);
|
||||||
|
|
||||||
// Account for standing on boat
|
// Account for standing on boat
|
||||||
@@ -156,7 +156,8 @@ public class MovementManager {
|
|||||||
Location bottom = to.clone().add(0, -1, 0);
|
Location bottom = to.clone().add(0, -1, 0);
|
||||||
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
this.bottomSolid = bottom.getBlock().getType().isSolid();
|
||||||
|
|
||||||
if ((this.motionY > 0.464D && this.motionY <= 0.5625D) && (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
if ((this.motionY > 0.42D && this.motionY <= 0.5625D)
|
||||||
|
&& (Utilities.couldBeOnHalfblock(to) || Utilities.isNearBed(to))) {
|
||||||
this.halfMovement = true;
|
this.halfMovement = true;
|
||||||
this.halfMovementHistoryCounter = 30;
|
this.halfMovementHistoryCounter = 30;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -176,6 +176,31 @@ public final class Utilities {
|
|||||||
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
|| isIce(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether a block is a shulker box
|
||||||
|
*
|
||||||
|
* @param block block to check
|
||||||
|
* @return true if block is a shulker box
|
||||||
|
*/
|
||||||
|
public static boolean isShulkerBox(Block block) {
|
||||||
|
Material type = block.getType();
|
||||||
|
return type.name().endsWith("SHULKER_BOX");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNearShulkerBox(Location location) {
|
||||||
|
if (VersionUtil.isBountifulUpdate())
|
||||||
|
return false;
|
||||||
|
return isShulkerBox(location.getBlock())
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.WEST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH_WEST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_EAST))
|
||||||
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH_WEST));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a player could be standing on a halfblock
|
* Determine whether a player could be standing on a halfblock
|
||||||
*
|
*
|
||||||
@@ -201,7 +226,7 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHalfblock(Block block) {
|
public static boolean isHalfblock(Block block) {
|
||||||
return isSlab(block) || isStair(block) || isWall(block);
|
return isSlab(block) || isStair(block) || isWall(block) || block.getType() == Material.SNOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user