Inline position check

This commit is contained in:
themode 2021-08-11 22:17:41 +02:00
parent 35d63ae547
commit 6b151c1f7c

View File

@ -54,10 +54,8 @@ public class PlayerPositionListener {
PlayerMoveEvent playerMoveEvent = new PlayerMoveEvent(player, newPosition);
EventDispatcher.call(playerMoveEvent);
// True if the event call changed the player position (possibly a teleport)
final boolean positionChanged = !currentPosition.equals(player.getPosition());
if (!playerMoveEvent.isCancelled() && !positionChanged) {
if (!playerMoveEvent.isCancelled() && currentPosition.equals(player.getPosition())) {
// Move the player
player.refreshPosition(playerMoveEvent.getNewPosition());
player.refreshOnGround(onGround);