mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-26 18:37:59 +01:00
[Bleeding] Optimizations and corrections for set-backs.
This commit is contained in:
parent
c73aa0edac
commit
1564115dd0
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 ?
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user