mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 03:02:11 +01:00
[BLEEDING] Extra method for set-back + reset positions differently.
Setting back players on PlayerMoveEvents: * Reset internal from/to tracking the set-back location. * Use an extra method for that.
This commit is contained in:
parent
4ebe911509
commit
39e2a86472
@ -405,6 +405,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
|
|
||||||
// TODO: Might log base parts here (+extras).
|
// TODO: Might log base parts here (+extras).
|
||||||
if (earlyReturn) {
|
if (earlyReturn) {
|
||||||
|
// TODO: Remove player from enforceLocation ?
|
||||||
// TODO: Log "early return: " + tags.
|
// TODO: Log "early return: " + tags.
|
||||||
if (newTo != null) {
|
if (newTo != null) {
|
||||||
// Illegal Yaw/Pitch.
|
// Illegal Yaw/Pitch.
|
||||||
@ -615,8 +616,36 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (newTo == null) {
|
||||||
|
// Set positions.
|
||||||
|
// TODO: Consider setting in Monitor (concept missing for changing coordinates, could double-check).
|
||||||
|
data.fromX = from.getX();
|
||||||
|
data.fromY = from.getY();
|
||||||
|
data.fromZ = from.getZ();
|
||||||
|
data.toX = to.getX();
|
||||||
|
data.toY = to.getY();
|
||||||
|
data.toZ = to.getZ();
|
||||||
|
}
|
||||||
|
else {
|
||||||
// Set-back handling.
|
// Set-back handling.
|
||||||
if (newTo != null) {
|
onSetBack(player, event, newTo, data, cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup.
|
||||||
|
moveInfo.cleanup();
|
||||||
|
parkedInfo.add(moveInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param event
|
||||||
|
* @param newTo Must be a cloned or new Location instance, free for whatever other plugins do with it.
|
||||||
|
* @param data
|
||||||
|
* @param cc
|
||||||
|
*/
|
||||||
|
private void onSetBack(final Player player, final PlayerMoveEvent event, final Location newTo, final MovingData data, final MovingConfig cc) {
|
||||||
// Illegal Yaw/Pitch.
|
// Illegal Yaw/Pitch.
|
||||||
if (LocUtil.needsYawCorrection(newTo.getYaw())) {
|
if (LocUtil.needsYawCorrection(newTo.getYaw())) {
|
||||||
newTo.setYaw(LocUtil.correctYaw(newTo.getYaw()));
|
newTo.setYaw(LocUtil.correctYaw(newTo.getYaw()));
|
||||||
@ -627,10 +656,9 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
|
|
||||||
// Reset some data.
|
// Reset some data.
|
||||||
data.prepareSetBack(newTo);
|
data.prepareSetBack(newTo);
|
||||||
|
data.resetPositions(newTo); // TODO: Might move into prepareSetBack, experimental here.
|
||||||
|
|
||||||
// Set new to-location.
|
// Set new to-location.
|
||||||
// TODO: Clone here for the case of using loc with loc = player.getLocation(moveInfo.loc).
|
|
||||||
// TODO: Actually should be a newly created location already (data.getSetBack).
|
|
||||||
event.setTo(newTo);
|
event.setTo(newTo);
|
||||||
|
|
||||||
// Debug.
|
// Debug.
|
||||||
@ -639,20 +667,6 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set positions.
|
|
||||||
// TODO: Consider setting in Monitor (concept missing for changing coordinates, could double-check).
|
|
||||||
data.fromX = from.getX();
|
|
||||||
data.fromY = from.getY();
|
|
||||||
data.fromZ = from.getZ();
|
|
||||||
data.toX = to.getX();
|
|
||||||
data.toY = to.getY();
|
|
||||||
data.toZ = to.getZ();
|
|
||||||
|
|
||||||
// Cleanup.
|
|
||||||
moveInfo.cleanup();
|
|
||||||
parkedInfo.add(moveInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called from player-move checking, if the player is inside of a vehicle.
|
* Called from player-move checking, if the player is inside of a vehicle.
|
||||||
* @param player
|
* @param player
|
||||||
|
Loading…
Reference in New Issue
Block a user