1.1-Beta
Fly NPE Fixed
This commit is contained in:
parent
edc62a8493
commit
20d6c9d18c
@ -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();
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user