Skip to content

Commit

Permalink
UPDATE checks in fly listener
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguine6660 committed Dec 19, 2023
1 parent 8214e82 commit 038edb2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public PlayerFlyListener(IzanagiWorldGuardPlugin plugin) {

boolean flyMode = (online.getGameMode().equals(GameMode.SPECTATOR) || online.getGameMode().equals(GameMode.CREATIVE));

if (!flyMode && online.getAllowFlight() && !allowFly) {
if (!flyMode && online.getAllowFlight() != allowFly && !allowFly) {
Bukkit.getScheduler().runTask(getPlugin(), () -> {
online.setAllowFlight(false);
MessageUtils.sendPrefixedMessage(online, "&cYou're not allowed to fly anymore. In (10 seconds) you'll fall to the ground.");
Expand All @@ -126,7 +126,7 @@ public PlayerFlyListener(IzanagiWorldGuardPlugin plugin) {
});
}

if (!flyMode && !online.getAllowFlight() && allowFly) {
if (!flyMode && online.getAllowFlight() != allowFly && allowFly) {
Bukkit.getScheduler().runTask(getPlugin(), () -> {
online.setAllowFlight(true);
online.sendActionBar(MessageUtils.getComponentSerializer().deserialize(
Expand Down

0 comments on commit 038edb2

Please sign in to comment.