Skip to content

Commit

Permalink
Fix getting the bottom vehicle. Added logging to discover.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed May 10, 2016
1 parent e3aa28d commit 43db457
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Expand Up @@ -378,6 +378,9 @@ else if (!from.getWorld().equals(to.getWorld())) {
if (earlyReturn) {
// TODO: Remove player from enforceLocation ?
// TODO: Log "early return: " + tags.
if (data.debug) {
debug(player, "Early return on PlayerMoveEvent: from: " + from + " , to: " + to);
}
if (newTo != null) {
// Illegal Yaw/Pitch.
if (LocUtil.needsYawCorrection(newTo.getYaw())) {
Expand All @@ -389,6 +392,9 @@ else if (!from.getWorld().equals(to.getWorld())) {
// Set.
// TODO: Reset positions? enforceLocation?
event.setTo(newTo);
if (data.debug) {
debug(player, "Early return on PlayerMoveEvent, set back to: " + newTo);
}
}
data.joinOrRespawn = false;
return;
Expand Down
Expand Up @@ -138,6 +138,9 @@ public Location onPlayerMoveVehicle(final Player player, final Location from, fi
// Note that with 1.6 not even PlayerMove fires for horses and pigs.
// (isInsideVehicle is the faster check without object creation, do re-check though, if it changes to only check for Vehicle instances.)
final Entity vehicle = CheckUtils.getLastNonPlayerVehicle(player);
if (data.debug) {
debug(player, "onPlayerMoveVehicle: vehicle: " + vehicle);
}
data.wasInVehicle = true;
data.sfHoverTicks = -1;
data.removeAllVelocity();
Expand Down
Expand Up @@ -100,7 +100,12 @@ public static Entity getLastNonPlayerVehicle(final Entity entity) {
if (vehicle instanceof Player){
return null;
}
vehicle = vehicle.getVehicle();
else if (vehicle.isInsideVehicle()) {
vehicle = vehicle.getVehicle();
}
else {
break;
}
}
return vehicle;
}
Expand Down

0 comments on commit 43db457

Please sign in to comment.