mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-30 20:37:52 +01:00
Prefer the set-back location from passable, but still check it first.
This commit is contained in:
parent
d8a1d96550
commit
1e7b60f79b
@ -387,13 +387,18 @@ public class MovingListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Location newTo = null;
|
Location newTo = null;
|
||||||
|
|
||||||
if (passable.isEnabled(player)) newTo = passable.check(player, pFrom, pTo, data, cc);
|
final Location passableTo;
|
||||||
|
// Check passable in any case (!)
|
||||||
|
if (passable.isEnabled(player)) {
|
||||||
|
// Passable is checked first to get the original set-back locations from the other checks, if needed.
|
||||||
|
passableTo = passable.check(player, pFrom, pTo, data, cc);
|
||||||
|
}
|
||||||
|
else passableTo = null;
|
||||||
|
|
||||||
// Optimized checking, giving creativefly permission precedence over survivalfly.
|
// Optimized checking, giving creativefly permission precedence over survivalfly.
|
||||||
if (newTo != null);
|
if (!player.hasPermission(Permissions.MOVING_CREATIVEFLY)){
|
||||||
else if (!player.hasPermission(Permissions.MOVING_CREATIVEFLY)){
|
|
||||||
// Either survivalfly or speed check.
|
// Either survivalfly or speed check.
|
||||||
if ((cc.ignoreCreative || player.getGameMode() != GameMode.CREATIVE) && (cc.ignoreAllowFlight || !player.getAllowFlight())
|
if ((cc.ignoreCreative || player.getGameMode() != GameMode.CREATIVE) && (cc.ignoreAllowFlight || !player.getAllowFlight())
|
||||||
&& cc.survivalFlyCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_SURVIVALFLY) && !player.hasPermission(Permissions.MOVING_SURVIVALFLY)){
|
&& cc.survivalFlyCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_SURVIVALFLY) && !player.hasPermission(Permissions.MOVING_SURVIVALFLY)){
|
||||||
@ -412,13 +417,16 @@ public class MovingListener implements Listener {
|
|||||||
}
|
}
|
||||||
else data.clearFlyData();
|
else data.clearFlyData();
|
||||||
|
|
||||||
if (newTo == null
|
if (newTo == null && cc.morePacketsCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_MOREPACKETS) && !player.hasPermission(Permissions.MOVING_MOREPACKETS)) {
|
||||||
&& cc.morePacketsCheck && !NCPExemptionManager.isExempted(player, CheckType.MOVING_MOREPACKETS) && !player.hasPermission(Permissions.MOVING_MOREPACKETS))
|
// If he hasn't been stopped by any other check and is handled by the more packets check, execute it.
|
||||||
// If he hasn't been stopped by any other check and is handled by the more packets check, execute it.
|
newTo = morePackets.check(player, pFrom, pTo, data, cc);
|
||||||
newTo = morePackets.check(player, pFrom, pTo, data, cc);
|
} else {
|
||||||
else
|
// Otherwise we need to clear his data.
|
||||||
// Otherwise we need to clear his data.
|
data.clearMorePacketsData();
|
||||||
data.clearMorePacketsData();
|
}
|
||||||
|
|
||||||
|
// Prefer the location returned by passable.
|
||||||
|
if (passableTo != null) newTo = passableTo;
|
||||||
|
|
||||||
// Did one of the checks decide we need a new "to"-location?
|
// Did one of the checks decide we need a new "to"-location?
|
||||||
if (newTo != null) {
|
if (newTo != null) {
|
||||||
@ -428,13 +436,16 @@ public class MovingListener implements Listener {
|
|||||||
// Remember where we send the player to.
|
// Remember where we send the player to.
|
||||||
data.teleported = newTo;
|
data.teleported = newTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set positions.
|
// Set positions.
|
||||||
|
// TODO: Should these be set on monitor ?
|
||||||
data.fromX = from.getX();
|
data.fromX = from.getX();
|
||||||
data.fromY = from.getY();
|
data.fromY = from.getY();
|
||||||
data.fromZ = from.getZ();
|
data.fromZ = from.getZ();
|
||||||
data.toX = to.getX();
|
data.toX = to.getX();
|
||||||
data.toY = to.getY();
|
data.toY = to.getY();
|
||||||
data.toZ = to.getZ();
|
data.toZ = to.getZ();
|
||||||
|
|
||||||
// Cleanup.
|
// Cleanup.
|
||||||
moveInfo.cleanup();
|
moveInfo.cleanup();
|
||||||
parkedInfo.add(moveInfo);
|
parkedInfo.add(moveInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user