From 1564115dd0b505be3e56693f5ece5d8f0f741ed2 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 4 Jan 2013 17:21:34 +0100 Subject: [PATCH] [Bleeding] Optimizations and corrections for set-backs. --- .../nocheatplus/checks/moving/CreativeFly.java | 5 ++--- .../nocheatplus/checks/moving/MovingListener.java | 2 +- .../nocheatplus/checks/moving/SurvivalFly.java | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java index ed005bbb..df1ea78e 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/CreativeFly.java @@ -122,8 +122,7 @@ public class CreativeFly extends Check { if (executeActions(vd)) // Compose a new location based on coordinates of "newTo" and viewing direction of "event.getTo()" // to allow the player to look somewhere else despite getting pulled back by NoCheatPlus. - return new Location(player.getWorld(), data.setBack.getX(), data.setBack.getY(), - data.setBack.getZ(), to.getYaw(), to.getPitch()); + return data.getSetBack(to); } else data.creativeFlyPreviousRefused = true; } else @@ -133,7 +132,7 @@ public class CreativeFly extends Check { data.creativeFlyVL *= 0.97D; // If the event did not get cancelled, define a new setback point. - data.setBack = to.getLocation(); + data.setSetBack(to); return null; } } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java index 7eca72ba..d46914d6 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java @@ -256,7 +256,7 @@ public class MovingListener extends CheckListener{ noFall.checkDamage(player, data, y); } // Teleport. - data.teleported = target; + data.teleported = target.clone(); player.teleport(target, TeleportCause.PLUGIN);// TODO: schedule / other measures ? } } diff --git a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java index b53f6918..512cec54 100644 --- a/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java +++ b/NCPPlugin/src/main/java/fr/neatmonster/nocheatplus/checks/moving/SurvivalFly.java @@ -338,13 +338,13 @@ public class SurvivalFly extends Check { data.fromWasReset = resetFrom || data.noFallAssumeGround; if (resetTo){ // The player has moved onto ground. - data.setBack = to.getLocation(); + data.setSetBack(to); data.sfJumpPhase = 0; data.clearAccounting(); } else if (resetFrom){ // The player moved from ground. - data.setBack = from.getLocation(); + data.setSetBack(from); data.sfJumpPhase = 1; // TODO: ? data.clearAccounting(); } @@ -390,7 +390,7 @@ public class SurvivalFly extends Check { // Set the new setBack and reset the jumpPhase. // TODO: Some interpolated position ? // TODO: (Task list: sharpen when this is used, might remove isAboveStairs!) - if (setBackSafe) data.setBack = from.getLocation(); + if (setBackSafe) data.setSetBack(from); else{ // TODO: This seems dubious ! // Consider: 1.0 + ? or max(from.getY(), 1.0 + ...) ? @@ -484,7 +484,7 @@ public class SurvivalFly extends Check { data.toWasReset = false; data.fromWasReset = false; // Set-back + view direction of to (more smooth). - return new Location(player.getWorld(), data.setBack.getX(), data.setBack.getY(), data.setBack.getZ(), to.getYaw(), to.getPitch()); + return data.getSetBack(to); } else{ // Cancelled by other plugin, or no cancel set by configuration. @@ -629,7 +629,7 @@ public class SurvivalFly extends Check { data.setBack.setYaw(to.getYaw()); data.setBack.setPitch(to.getPitch()); data.sfLastYDist = Double.MAX_VALUE; - return data.setBack; + return data.setBack.clone(); } else return null; }