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.
public static boolean startupFinished = false;
// Persistence related
public static ArrayList<FPlayer> playersFlying = new ArrayList();
public boolean PlaceholderApi;
// Commands
@ -187,10 +185,6 @@ public class SavageFactions extends MPlugin {
}
}
playersFlying.clear();
for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) {
playersFlying.add(fPlayer);
}
UtilFly.run();
Board.getInstance().load();

View File

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