From 842eb097c6c4bc7cc775c62b4a10ba9a6c4dcc87 Mon Sep 17 00:00:00 2001 From: Stefan923 Date: Sat, 9 May 2020 00:30:03 +0300 Subject: [PATCH] Fixed issue. If the player does not have the fly activated when he joins another teritory, it skips the checks and his flight is activated. --- .../factions/listeners/FactionsPlayerListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index bddfb877..c2413406 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -580,7 +580,7 @@ public class FactionsPlayerListener implements Listener { } public void checkCanFly(FPlayer me) { - if (me.isFlying() && (!me.canFlyAtLocation() || me.checkIfNearbyEnemies())) { + if (!me.canFlyAtLocation() || me.checkIfNearbyEnemies()) { me.setFFlying(false, false); return; } @@ -662,8 +662,10 @@ public class FactionsPlayerListener implements Listener { if (lastLocations.isEmpty()) return; for (Map.Entry check : lastLocations.entrySet()) { Player player = Bukkit.getPlayer(check.getKey()); - refreshPosition(player, check.getValue(), player.getLocation()); - lastLocations.put(player.getUniqueId(), player.getLocation()); + if (player != null) { + refreshPosition(player, check.getValue(), player.getLocation()); + lastLocations.put(player.getUniqueId(), player.getLocation()); + } } }, 5L, 10L); }