Bleeding: Let Passable prefer the data's set-back location.

This might not fully fix all fly bypasses, but it prevents the Passable
check from resetting players into the air for moves that may cover any
distance from air into ground, leading to resetting the player into the
air, which allows for a fly bypass, effectively. Preferring the data's
set-back location will set the player back onto ground if it is
passable,
this still leaves some area for cheat attempts, but the order of speed
and passable checks shows the dilemma that either can undo the others
effects with the set-back locations used by the checks. [Subject to
review.]
This commit is contained in:
asofold 2012-11-03 04:46:37 +01:00
parent 77d8c27f7e
commit eedc4c77a7

View File

@ -54,6 +54,10 @@ public class Passable extends Check {
}
}
}
// Prefer the set-back location from the data.
if (data.setBack != null && BlockProperties.isPassable(from.getBlockAccess(), data.setBack)) loc = data.setBack;
// Return the reset position.
data.passableVL += 1d;
final ViolationData vd = new ViolationData(this, player, data.passableVL, 1, cc.passableActions);
@ -61,7 +65,7 @@ public class Passable extends Check {
if (executeActions(vd)){
// TODO: Consider another set back position for this, also keeping track of players moving around in blocks.
final Location newTo;
if (!from.isPassable() && loc == null){
if (loc == null && !from.isPassable()){
// Check if passable.
loc = player.getLocation();
if (to.isSamePos(loc) || !BlockProperties.isPassable(from.getBlockAccess(), loc.getX(), loc.getY(), loc.getZ(), from.getTypeId(from.getBlockX(), from.getBlockY(), from.getBlockZ()))){