mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-03 19:00:30 +02:00
Attempt to work around missing VehicleExit events with latest CB dev
builds.
This commit is contained in:
parent
33be1ca501
commit
d659dd7f26
|
@ -174,6 +174,11 @@ public class MovingData extends ACheckData {
|
||||||
public final ActionAccumulator vDistAcc = new ActionAccumulator(3, 3);
|
public final ActionAccumulator vDistAcc = new ActionAccumulator(3, 3);
|
||||||
|
|
||||||
|
|
||||||
|
// HOT FIX
|
||||||
|
/** Inconsistency-flag. Set on moving inside of vehicles, reset on exiting properly. Workaround for VehicleLeaveEvent missing. */
|
||||||
|
public boolean wasInVehicle = false;
|
||||||
|
|
||||||
|
|
||||||
// public final Stats stats = new Stats(); // Test.
|
// public final Stats stats = new Stats(); // Test.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -456,6 +456,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||||
// Ignore players in vehicles.
|
// Ignore players in vehicles.
|
||||||
if (player.isInsideVehicle()){
|
if (player.isInsideVehicle()){
|
||||||
// Workaround for pigs !
|
// Workaround for pigs !
|
||||||
|
data.wasInVehicle = true;
|
||||||
data.sfHoverTicks = -1;
|
data.sfHoverTicks = -1;
|
||||||
data.removeAllVelocity();
|
data.removeAllVelocity();
|
||||||
final Entity vehicle = player.getVehicle();
|
final Entity vehicle = player.getVehicle();
|
||||||
|
@ -464,6 +465,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore dead players.
|
// Ignore dead players.
|
||||||
if (player.isDead()){
|
if (player.isDead()){
|
||||||
data.sfHoverTicks = -1;
|
data.sfHoverTicks = -1;
|
||||||
|
@ -505,12 +507,24 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||||
parkedInfo.add(moveInfo);
|
parkedInfo.add(moveInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare locations for use.
|
// Prepare locations for use.
|
||||||
// TODO: Block flags might not be needed if neither sf nor passable get checked.
|
// TODO: Block flags might not be needed if neither sf nor passable get checked.
|
||||||
final PlayerLocation pFrom, pTo;
|
final PlayerLocation pFrom, pTo;
|
||||||
pFrom = moveInfo.from;
|
pFrom = moveInfo.from;
|
||||||
pTo = moveInfo.to;
|
pTo = moveInfo.to;
|
||||||
|
|
||||||
|
// HOT FIX - for VehicleLeaveEvent missing.
|
||||||
|
if (data.wasInVehicle){
|
||||||
|
if (cc.debug){
|
||||||
|
LogUtil.logWarning("[NoCheatPlus] VehicleExitEvent missing for: " + player.getName());
|
||||||
|
}
|
||||||
|
onPlayerVehicleLeave(player);
|
||||||
|
if (BlockProperties.isRails(pFrom.getTypeId())){
|
||||||
|
data.clearNoFallData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Potion effect "Jump".
|
// Potion effect "Jump".
|
||||||
final double jumpAmplifier = MovingListener.getJumpAmplifier(player);
|
final double jumpAmplifier = MovingListener.getJumpAmplifier(player);
|
||||||
if (jumpAmplifier > data.jumpAmplifier) data.jumpAmplifier = jumpAmplifier;
|
if (jumpAmplifier > data.jumpAmplifier) data.jumpAmplifier = jumpAmplifier;
|
||||||
|
@ -1220,6 +1234,8 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||||
final Entity entity = event.getExited();
|
final Entity entity = event.getExited();
|
||||||
if (!(entity instanceof Player)) return;
|
if (!(entity instanceof Player)) return;
|
||||||
onPlayerVehicleLeave((Player) entity);
|
onPlayerVehicleLeave((Player) entity);
|
||||||
|
// System.out.println("Vehicle: " + event.getVehicle().getLocation());
|
||||||
|
// System.out.println("Player: " + entity.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
@ -1243,6 +1259,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||||
|
|
||||||
private final void onPlayerVehicleLeave(final Player player){
|
private final void onPlayerVehicleLeave(final Player player){
|
||||||
final MovingData data = MovingData.getData(player);
|
final MovingData data = MovingData.getData(player);
|
||||||
|
data.wasInVehicle = false;
|
||||||
// if (data.morePacketsVehicleTaskId != -1){
|
// if (data.morePacketsVehicleTaskId != -1){
|
||||||
// // Await set-back.
|
// // Await set-back.
|
||||||
// // TODO: might still set ordinary set-backs ?
|
// // TODO: might still set ordinary set-backs ?
|
||||||
|
@ -1342,6 +1359,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||||
final Location loc = player.getLocation();
|
final Location loc = player.getLocation();
|
||||||
info.set(player, loc, null, cc.yOnGround);
|
info.set(player, loc, null, cc.yOnGround);
|
||||||
final boolean res;
|
final boolean res;
|
||||||
|
// TODO: Collect flags, more margin ?
|
||||||
if (info.from.isOnGround() || info.from.isResetCond() || info.from.isAboveLadder() || info.from.isAboveStairs()){
|
if (info.from.isOnGround() || info.from.isResetCond() || info.from.isAboveLadder() || info.from.isAboveStairs()){
|
||||||
res = true;
|
res = true;
|
||||||
data.sfHoverTicks = 0;
|
data.sfHoverTicks = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user