diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index befc8c077..31f286c14 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -286,6 +286,8 @@ permissions: default: false plots.admin.command.clear: default: false + plots.admin.flight: + default: false plots.teleport.delay.bypass: default: false @@ -425,4 +427,4 @@ permissions: plots.save: true plots.done: true plots.continue: true - plots.middle: true \ No newline at end of file + plots.middle: true diff --git a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java index ba690b2fc..9b377081f 100644 --- a/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/core/listener/PlotListener.java @@ -186,15 +186,17 @@ public class PlotListener { } final FlyFlag.FlyStatus flyStatus = plot.getFlag(FlyFlag.class); - if (flyStatus != FlyFlag.FlyStatus.DEFAULT) { - boolean flight = player.getFlight(); - GameMode gamemode = player.getGameMode(); - if (flight != (gamemode == GameModes.CREATIVE || gamemode == GameModes.SPECTATOR)) { - try (final MetaDataAccess metaDataAccess = player.accessPersistentMetaData(PlayerMetaDataKeys.PERSISTENT_FLIGHT)) { - metaDataAccess.set(player.getFlight()); + if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_FLIGHT)) { + if (flyStatus != FlyFlag.FlyStatus.DEFAULT) { + boolean flight = player.getFlight(); + GameMode gamemode = player.getGameMode(); + if (flight != (gamemode == GameModes.CREATIVE || gamemode == GameModes.SPECTATOR)) { + try (final MetaDataAccess metaDataAccess = player.accessPersistentMetaData(PlayerMetaDataKeys.PERSISTENT_FLIGHT)) { + metaDataAccess.set(player.getFlight()); + } } + player.setFlight(flyStatus == FlyFlag.FlyStatus.ENABLED); } - player.setFlight(flyStatus == FlyFlag.FlyStatus.ENABLED); } final GameMode gameMode = plot.getFlag(GamemodeFlag.class); diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index 068277a36..78981040f 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -201,7 +201,8 @@ public enum Permission { PERMISSION_ADMIN_BACKUP_OTHER("plots.admin.backup.other"), PERMISSION_ADMIN_ALLOW_UNSAFE("plots.admin.unsafe"), PERMISSION_ADMIN_DEBUG_OTHER("plots.admin.debug.other"), - PERMISSION_RATE("plots.rate"); + PERMISSION_RATE("plots.rate"), + PERMISSION_ADMIN_FLIGHT("plots.admin.flight"); // private final String text;