Ignore flight check on spectator mode.

If a player is in Spectator mode, we should not interfere with their flight. This is an extension to the already existing creative mode check.
This commit is contained in:
Ali Moghnieh 2016-06-19 03:33:48 +01:00
parent dba9dab985
commit a267fb16b8

View File

@ -408,7 +408,9 @@ public class EssentialsPlayerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerChangedWorldFlyReset(final PlayerChangedWorldEvent event) {
final User user = ess.getUser(event.getPlayer());
if (user.getBase().getGameMode() != GameMode.CREATIVE && !user.isAuthorized("essentials.fly")) {
if (user.getBase().getGameMode() != GameMode.CREATIVE
&& user.getBase().getGameMode() != GameMode.SPECTATOR
&& !user.isAuthorized("essentials.fly")) {
user.getBase().setFallDistance(0f);
user.getBase().setAllowFlight(false);
}