From 6b151c1f7caa8ef187bf40b630bcf94ce0774753 Mon Sep 17 00:00:00 2001 From: themode Date: Wed, 11 Aug 2021 22:17:41 +0200 Subject: [PATCH] Inline position check --- .../net/minestom/server/listener/PlayerPositionListener.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/net/minestom/server/listener/PlayerPositionListener.java b/src/main/java/net/minestom/server/listener/PlayerPositionListener.java index 2213063c4..29e040782 100644 --- a/src/main/java/net/minestom/server/listener/PlayerPositionListener.java +++ b/src/main/java/net/minestom/server/listener/PlayerPositionListener.java @@ -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);