[BLEEDING] Allow to override the set-back via MovingData.setTeleported.

This way, you can calculate a more interesting set-back location from
within a hook during violation handling. All you need to do to adjust
the set-back location is to call MovingData.setTeleported(newSetBack)
and NoCheatPlus should recognize this as the location to set back to.

Please do:
* Test if the check in question would set back at all
(IViolationData.wilCancel() returns true).

Please in such a case do not:
* Don't call setTeleported if IViolationData.willCancel() returns false
:).
* Cancel violation processing.
* Teleport the player.
* Do something complicated with MovingData otherwise :).
This commit is contained in:
asofold 2017-04-25 23:58:48 +02:00
parent 8fc9b1df91
commit 34e3548ec5

View File

@ -861,7 +861,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
data.blockChangeRef.updateFinal(pTo);
}
if (newTo == null) {
if (newTo == null && !data.hasTeleported()) {
// Allowed move.
// Bounce effects.
if (verticalBounce != BounceType.NO_BOUNCE) {
@ -882,6 +882,9 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
return false;
}
else {
if (data.hasTeleported()) {
newTo = data.getTeleported();
}
if (data.debug) { // TODO: Remove, if not relevant (doesn't look like it was :p).
if (verticalBounce != BounceType.NO_BOUNCE) {
debug(player, "Bounce effect not processed: " + verticalBounce);