From 0e037b2f7223d2bfd7a70de2853d30f0dcccd82d Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Sun, 3 Feb 2019 14:08:13 +0100 Subject: [PATCH] Don't change player flySpeed on join/spec. From a purist standpoint, the flySpeed tag should never be messed with in MobArena, because simply turning off flight should be enough. It is likely that the flySpeed tag was originally included to cull "cheaters" who somehow managed to activate flight in the arena anyway, but this isn't really MobArena's responsibility and can very probably be handled by other means of cheat prevention in WorldGuard regions or the like. By not touching the flySpeed tag, it makes it much easier for server owners to recover from crashes where the leave steps aren't executed, leaving players "locked in the air" when they try to fly. Closes #509 since this "fix" was the reason that feature request was made. --- changelog.md | 1 + src/main/java/com/garbagemule/MobArena/steps/SetFlying.java | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index bc4f6e6..c47bab7 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,7 @@ These changes will (most likely) be included in the next version. ## [Unreleased] +- MobArena no longer touches the `flySpeed` player attribute when players join an arena. This should fix issues where a crash would result in players being "locked in the air" when trying to fly outside of the arena. It also introduces compatibility with plugins that use flight to augment player abilities. ## [0.103.1] - 2018-12-31 - Like the other user commands, the permission for `/ma ready` now defaults to true. diff --git a/src/main/java/com/garbagemule/MobArena/steps/SetFlying.java b/src/main/java/com/garbagemule/MobArena/steps/SetFlying.java index d0d0963..f6a16c8 100644 --- a/src/main/java/com/garbagemule/MobArena/steps/SetFlying.java +++ b/src/main/java/com/garbagemule/MobArena/steps/SetFlying.java @@ -5,7 +5,6 @@ import org.bukkit.entity.Player; class SetFlying extends PlayerStep { private boolean allow; private boolean flying; - private float speed; private SetFlying(Player player) { super(player); @@ -15,9 +14,7 @@ class SetFlying extends PlayerStep { public void run() { allow = player.getAllowFlight(); flying = player.isFlying(); - speed = player.getFlySpeed(); - player.setFlySpeed(0); player.setFlying(false); player.setAllowFlight(false); } @@ -26,7 +23,6 @@ class SetFlying extends PlayerStep { public void undo() { player.setAllowFlight(allow); player.setFlying(flying); - player.setFlySpeed(speed); } static StepFactory create() {