Fly NPE Fixed
This commit is contained in:
Driftay 2019-05-22 22:52:30 -04:00
parent edc62a8493
commit 20d6c9d18c
2 changed files with 2 additions and 18 deletions

View File

@ -58,8 +58,6 @@ public class SavageFactions extends MPlugin {
// a green light to use the api. // a green light to use the api.
public static boolean startupFinished = false; public static boolean startupFinished = false;
// Persistence related
public static ArrayList<FPlayer> playersFlying = new ArrayList();
public boolean PlaceholderApi; public boolean PlaceholderApi;
// Commands // Commands
@ -187,10 +185,6 @@ public class SavageFactions extends MPlugin {
} }
} }
playersFlying.clear();
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
playersFlying.add(fPlayer);
}
UtilFly.run(); UtilFly.run();
Board.getInstance().load(); Board.getInstance().load();

View File

@ -13,19 +13,14 @@ import java.util.Iterator;
public class UtilFly { public class UtilFly {
public static ArrayList<FPlayer> playersFlying = SavageFactions.playersFlying;
public static void run() { public static void run() {
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return; return;
playersFlying.clear();
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> { Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
for (FPlayer fp : playersFlying) { for (FPlayer fp : FPlayers.getInstance().getAllFPlayers()) {
if (fp != null) if (fp.isFlying()) fp.checkIfNearbyEnemies();
fp.checkIfNearbyEnemies();
} }
}, 0, SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10)); }, 0, SavageFactions.plugin.getConfig().getInt("fly-task-interval", 10));
} }
@ -38,11 +33,6 @@ public class UtilFly {
fp.getPlayer().setFlying(fly); fp.getPlayer().setFlying(fly);
fp.setFlying(fly); fp.setFlying(fly);
if (fly) {
playersFlying.add(fp);
} else {
playersFlying.remove(fp);
}
if (!silent) { if (!silent) {
if (!damage) { if (!damage) {