mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Inline position check
This commit is contained in:
parent
35d63ae547
commit
6b151c1f7c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user