From f9f04feee037e1b57f3a08680aa45062c6ffbaca Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 9 Dec 2015 22:14:37 +0100 Subject: [PATCH] Extend margin for PaperSpigot workaround, confine by split move 1. Add a tag. --- .../nocheatplus/checks/moving/MovingListener.java | 2 +- .../nocheatplus/checks/moving/SurvivalFly.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 604ea0f4..21772c2e 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -663,7 +663,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo // Actual check. if (newTo == null) { // Only check if passable has not already set back. - newTo = survivalFly.check(player, pFrom, pTo, isSamePos, moveInfo.data, data, cc, time); + newTo = survivalFly.check(player, pFrom, pTo, isSamePos, mightBeMultipleMoves, moveInfo.data, data, cc, time); } // Only check NoFall, if not already vetoed. if (checkNf) { diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index 511b6fdd..c34499d8 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -121,7 +121,7 @@ public class SurvivalFly extends Check { * @param isSamePos * @return the location */ - public Location check(final Player player, final PlayerLocation from, final PlayerLocation to, final boolean isSamePos, final MoveData moveData, final MovingData data, final MovingConfig cc, final long now) { + public Location check(final Player player, final PlayerLocation from, final PlayerLocation to, final boolean isSamePos, final boolean mightBeMultipleMoves, final MoveData moveData, final MovingData data, final MovingConfig cc, final long now) { tags.clear(); // Calculate some distances. @@ -370,7 +370,7 @@ public class SurvivalFly extends Check { } } else { - final double[] res = vDistAir(now, player, from, fromOnGround, resetFrom, to, toOnGround, resetTo, hDistanceAboveLimit, yDistance, data, cc); + final double[] res = vDistAir(now, player, from, fromOnGround, resetFrom, to, toOnGround, resetTo, hDistanceAboveLimit, yDistance, mightBeMultipleMoves, data, cc); vAllowedDistance = res[0]; vDistanceAboveLimit = res[1]; } @@ -804,7 +804,7 @@ public class SurvivalFly extends Check { * Core y-distance checks for in-air movement (may include air -> other). * @return */ - private double[] vDistAir(final long now, final Player player, final PlayerLocation from, final boolean fromOnGround, final boolean resetFrom, final PlayerLocation to, final boolean toOnGround, final boolean resetTo, final double hDistance, final double yDistance, final MovingData data, final MovingConfig cc) { + private double[] vDistAir(final long now, final Player player, final PlayerLocation from, final boolean fromOnGround, final boolean resetFrom, final PlayerLocation to, final boolean toOnGround, final boolean resetTo, final double hDistance, final double yDistance, final boolean mightBeMultipleMoves, final MovingData data, final MovingConfig cc) { // Y-distance for normal jumping, like in air. double vAllowedDistance = 0.0; double vDistanceAboveLimit = 0.0; @@ -1018,11 +1018,14 @@ public class SurvivalFly extends Check { if (yDistance > cc.sfStepHeight || !tags.contains("lostground_couldstep")) { if (data.getOrUseVerticalVelocity(yDistance) == null) { // Last minute special case. - if (data.lastYDist == Double.MAX_VALUE && data.sfJumpPhase == 0 - && Math.abs(totalVDistViolation) < 0.000000005 && yDistance > 0.0 && yDistance < 0.000000005 + if (data.lastYDist == Double.MAX_VALUE && data.sfJumpPhase == 0 && mightBeMultipleMoves + && Math.abs(totalVDistViolation) < 0.01 && yDistance > 0.0 && yDistance < 0.01 && !resetFrom && !resetTo && !data.noFallAssumeGround ) { - // Special case after teleport to in-air (PaperSpigot, might confine further by server type/version). + // Special case after teleport to in-air (PaperSpigot). + // TODO: Confine to PaperSpigot? + // TODO: Confine to from at block level (offest 0)? + tags.add("skip_paper"); } else { vDistanceAboveLimit = Math.max(vDistanceAboveLimit, totalVDistViolation); tags.add("vdistsb");