[Bleeding] Optimizations and corrections for set-backs.

This commit is contained in:
asofold 2013-01-04 17:21:34 +01:00
parent c73aa0edac
commit 1564115dd0
3 changed files with 8 additions and 9 deletions

View File

@ -122,8 +122,7 @@ public class CreativeFly extends Check {
if (executeActions(vd)) if (executeActions(vd))
// Compose a new location based on coordinates of "newTo" and viewing direction of "event.getTo()" // 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. // 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(), return data.getSetBack(to);
data.setBack.getZ(), to.getYaw(), to.getPitch());
} else } else
data.creativeFlyPreviousRefused = true; data.creativeFlyPreviousRefused = true;
} else } else
@ -133,7 +132,7 @@ public class CreativeFly extends Check {
data.creativeFlyVL *= 0.97D; data.creativeFlyVL *= 0.97D;
// If the event did not get cancelled, define a new setback point. // If the event did not get cancelled, define a new setback point.
data.setBack = to.getLocation(); data.setSetBack(to);
return null; return null;
} }
} }

View File

@ -256,7 +256,7 @@ public class MovingListener extends CheckListener{
noFall.checkDamage(player, data, y); noFall.checkDamage(player, data, y);
} }
// Teleport. // Teleport.
data.teleported = target; data.teleported = target.clone();
player.teleport(target, TeleportCause.PLUGIN);// TODO: schedule / other measures ? player.teleport(target, TeleportCause.PLUGIN);// TODO: schedule / other measures ?
} }
} }

View File

@ -338,13 +338,13 @@ public class SurvivalFly extends Check {
data.fromWasReset = resetFrom || data.noFallAssumeGround; data.fromWasReset = resetFrom || data.noFallAssumeGround;
if (resetTo){ if (resetTo){
// The player has moved onto ground. // The player has moved onto ground.
data.setBack = to.getLocation(); data.setSetBack(to);
data.sfJumpPhase = 0; data.sfJumpPhase = 0;
data.clearAccounting(); data.clearAccounting();
} }
else if (resetFrom){ else if (resetFrom){
// The player moved from ground. // The player moved from ground.
data.setBack = from.getLocation(); data.setSetBack(from);
data.sfJumpPhase = 1; // TODO: ? data.sfJumpPhase = 1; // TODO: ?
data.clearAccounting(); data.clearAccounting();
} }
@ -390,7 +390,7 @@ public class SurvivalFly extends Check {
// Set the new setBack and reset the jumpPhase. // Set the new setBack and reset the jumpPhase.
// TODO: Some interpolated position ? // TODO: Some interpolated position ?
// TODO: (Task list: sharpen when this is used, might remove isAboveStairs!) // TODO: (Task list: sharpen when this is used, might remove isAboveStairs!)
if (setBackSafe) data.setBack = from.getLocation(); if (setBackSafe) data.setSetBack(from);
else{ else{
// TODO: This seems dubious ! // TODO: This seems dubious !
// Consider: 1.0 + ? or max(from.getY(), 1.0 + ...) ? // Consider: 1.0 + ? or max(from.getY(), 1.0 + ...) ?
@ -484,7 +484,7 @@ public class SurvivalFly extends Check {
data.toWasReset = false; data.toWasReset = false;
data.fromWasReset = false; data.fromWasReset = false;
// Set-back + view direction of to (more smooth). // 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{ else{
// Cancelled by other plugin, or no cancel set by configuration. // 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.setYaw(to.getYaw());
data.setBack.setPitch(to.getPitch()); data.setBack.setPitch(to.getPitch());
data.sfLastYDist = Double.MAX_VALUE; data.sfLastYDist = Double.MAX_VALUE;
return data.setBack; return data.setBack.clone();
} else return null; } else return null;
} }