From f8ff01349b2a1ddb9b0272ddc76596547dfc2231 Mon Sep 17 00:00:00 2001 From: Felix Cravic Date: Sun, 24 May 2020 22:27:58 +0200 Subject: [PATCH] Fixed Player#isFlying it is now properly synchronized with the client --- src/main/java/net/minestom/server/entity/Player.java | 6 +++++- .../net/minestom/server/listener/AbilitiesListener.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index 5c7870742..095898b03 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -1118,10 +1118,14 @@ public class Player extends LivingEntity { * @param flying should the player fly */ public void setFlying(boolean flying) { - this.flying = flying; + refreshFlying(flying); refreshAbilities(); } + public void refreshFlying(boolean flying) { + this.flying = flying; + } + /** * @return true if the player if allowed to fly, false otherwise */ diff --git a/src/main/java/net/minestom/server/listener/AbilitiesListener.java b/src/main/java/net/minestom/server/listener/AbilitiesListener.java index 5e224f5bc..bf98c7ae9 100644 --- a/src/main/java/net/minestom/server/listener/AbilitiesListener.java +++ b/src/main/java/net/minestom/server/listener/AbilitiesListener.java @@ -12,6 +12,7 @@ public class AbilitiesListener { if (canFly) { boolean isFlying = (packet.flags & 0x2) > 0; + player.refreshFlying(isFlying); if (isFlying) { PlayerStartFlyingEvent startFlyingEvent = new PlayerStartFlyingEvent(player);