From ab82529a4b5012d4e02fa4ce437435c5acd59ab5 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 27 Aug 2022 16:31:07 -0400 Subject: [PATCH 1/3] Players grounded properly when losing flight. --- src/engine/objects/PlayerCharacter.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index c7a55f57..464fb563 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4771,6 +4771,12 @@ public void dismissNecroPets() { } } + // Ground players who cannot fly but are currently flying + + if (CanFly(this) && + this.getMovementState().equals(MovementState.FLYING)) + GroundPlayer(this); + RealmMap.updateRealm(this); updateBlessingMessage(); -- 2.30.2 From 5fe518f8a17580a021e2cb83186e3cebf098fe50 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 27 Aug 2022 16:44:05 -0400 Subject: [PATCH 2/3] Players grounded properly when losing flight. --- src/engine/objects/AbstractCharacter.java | 15 +++++++++++++++ src/engine/objects/PlayerCharacter.java | 6 ------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 244f91c8..2413f8fb 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -1600,11 +1600,26 @@ public abstract class AbstractCharacter extends AbstractWorldObject { //Call to apply any new effects to player public synchronized void applyBonuses() { + PlayerCharacter player; //tell the player to applyBonuses because something has changed //start running the bonus calculations + try{ runBonuses(); + + // Check if calculations affected flight. + + if (this.getGridObjectType().equals(GameObjectType.PlayerCharacter)) { + player = (PlayerCharacter) this; + + // Ground players who cannot fly but are currently flying + + if (CanFly(player) == false && + player.getMovementState().equals(MovementState.FLYING)) + PlayerCharacter.GroundPlayer(player); + } + }catch(Exception e){ Logger.error("Error in run bonuses for object UUID " + this.getObjectUUID()); Logger.error(e); diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 464fb563..c7a55f57 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4771,12 +4771,6 @@ public void dismissNecroPets() { } } - // Ground players who cannot fly but are currently flying - - if (CanFly(this) && - this.getMovementState().equals(MovementState.FLYING)) - GroundPlayer(this); - RealmMap.updateRealm(this); updateBlessingMessage(); -- 2.30.2 From ebeda7d7bae85cdbc2f659f09b97ab361bd41376 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 27 Aug 2022 17:14:50 -0400 Subject: [PATCH 3/3] Players grounded properly when losing flight. --- src/engine/objects/AbstractCharacter.java | 2 +- src/engine/objects/PlayerCharacter.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 2413f8fb..32e9e6e7 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -1610,7 +1610,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { // Check if calculations affected flight. - if (this.getGridObjectType().equals(GameObjectType.PlayerCharacter)) { + if (this.getObjectType().equals(GameObjectType.PlayerCharacter)) { player = (PlayerCharacter) this; // Ground players who cannot fly but are currently flying diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index c7a55f57..600af48b 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -4781,10 +4781,6 @@ public void dismissNecroPets() { }finally{ this.updateLock.writeLock().unlock(); } - //temp removal - if(AbstractCharacter.CanFly(this) == false && this.altitude > 0) - GroundPlayer(this); - } } @Override -- 2.30.2