mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +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);
|
PlayerMoveEvent playerMoveEvent = new PlayerMoveEvent(player, newPosition);
|
||||||
EventDispatcher.call(playerMoveEvent);
|
EventDispatcher.call(playerMoveEvent);
|
||||||
|
|
||||||
// True if the event call changed the player position (possibly a teleport)
|
// True if the event call changed the player position (possibly a teleport)
|
||||||
final boolean positionChanged = !currentPosition.equals(player.getPosition());
|
if (!playerMoveEvent.isCancelled() && currentPosition.equals(player.getPosition())) {
|
||||||
if (!playerMoveEvent.isCancelled() && !positionChanged) {
|
|
||||||
// Move the player
|
// Move the player
|
||||||
player.refreshPosition(playerMoveEvent.getNewPosition());
|
player.refreshPosition(playerMoveEvent.getNewPosition());
|
||||||
player.refreshOnGround(onGround);
|
player.refreshOnGround(onGround);
|
||||||
|
Loading…
Reference in New Issue
Block a user