Reset player fall-distance on select teleports.
Sets the player fall-distance to zero before performing a player teleport during "move player" steps. This should cancel out any already calculated, added fall-distance that might result in unintentional fall damage. Fixes #698
This commit is contained in:
parent
71b261e691
commit
05396f4d49
|
@ -7,8 +7,6 @@ import org.bukkit.util.Vector;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
abstract class MovePlayerStep extends PlayerStep {
|
||||
private static final Vector NULL_VECTOR = new Vector(0, 0, 0);
|
||||
|
||||
private final Supplier<Location> destination;
|
||||
|
||||
private Location location;
|
||||
|
@ -22,13 +20,13 @@ abstract class MovePlayerStep extends PlayerStep {
|
|||
public void run() {
|
||||
location = player.getLocation();
|
||||
|
||||
player.setVelocity(NULL_VECTOR);
|
||||
player.setFallDistance(0.0F);
|
||||
player.teleport(destination.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void undo() {
|
||||
player.setVelocity(NULL_VECTOR);
|
||||
player.setFallDistance(0.0F);
|
||||
player.teleport(location);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue