mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-13 19:11:22 +01:00
Use hard limits for maximum number of steps for ray-tracing.
This concerns both blockinteract.visible and moving.passable, both set to 60. In effect extreme moves are impossible with either check activated. Mind that 60 steps could be something like 20 blocks for some cases, probably even less.
This commit is contained in:
parent
c805caa553
commit
036c99653f
@ -22,6 +22,7 @@ public class Visible extends Check {
|
||||
public Visible() {
|
||||
super(CheckType.BLOCKINTERACT_VISIBLE);
|
||||
blockCache = mcAccess.getBlockCache(null);
|
||||
rayTracing.setMaxSteps(60); // TODO: Configurable ?
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -48,7 +49,7 @@ public class Visible extends Check {
|
||||
rayTracing.setBlockCache(blockCache);
|
||||
rayTracing.set(loc.getX(), loc.getY() + eyeHeight, loc.getZ(), 0.5 + block.getX() + 0.6 * face.getModX(), 0.5 + block.getY() + 0.6 * face.getModY(), 0.5 + block.getZ() + 0.6 * face.getModZ());
|
||||
rayTracing.loop();
|
||||
collides = rayTracing.collides();
|
||||
collides = rayTracing.collides() || rayTracing.getStepsDone() >= rayTracing.getMaxSteps();
|
||||
blockCache.cleanup();
|
||||
rayTracing.cleanup();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class Passable extends Check {
|
||||
|
||||
public Passable() {
|
||||
super(CheckType.MOVING_PASSABLE);
|
||||
rayTracing.setMaxSteps(60); // TODO: Configurable ?
|
||||
}
|
||||
|
||||
public Location check(final Player player, final PlayerLocation from, final PlayerLocation to, final MovingData data, final MovingConfig cc)
|
||||
@ -32,7 +33,7 @@ public class Passable extends Check {
|
||||
if (toPassable && cc.passableRayTracingCheck && (!cc.passableRayTracingVclipOnly || from.getY() > to.getY()) && (!cc.passableRayTracingBlockChangeOnly || from.getBlockX() != to.getBlockX() || from.getBlockY() != to.getBlockY() || from.getBlockZ() != to.getBlockZ())){
|
||||
rayTracing.set(from, to);
|
||||
rayTracing.loop();
|
||||
if (rayTracing.collides()){
|
||||
if (rayTracing.collides() || rayTracing.getStepsDone() >= rayTracing.getMaxSteps()){
|
||||
toPassable = false;
|
||||
}
|
||||
// TODO: If accuracy is set, also check the head position (or bounding box right away).
|
||||
|
Loading…
Reference in New Issue
Block a user