Fly Fixes

This commit is contained in:
Driftay 2019-05-23 17:08:18 -04:00
parent 8770ea0d4f
commit e3cfb575fd
3 changed files with 10 additions and 13 deletions

View File

@ -92,10 +92,10 @@ public class CmdFly extends FCommand {
continue;
}
Player player = Bukkit.getPlayer(name);
if (player == null
|| !player.isFlying()
|| player.getGameMode() == GameMode.CREATIVE
|| !SavageFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
if (player == null
|| !player.isFlying()
|| player.getGameMode() == GameMode.CREATIVE
|| !SavageFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
continue;
}
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
@ -110,7 +110,7 @@ public class CmdFly extends FCommand {
}
FLocation myFloc = new FLocation(player.getLocation());
if (Board.getInstance().getFactionAt(myFloc) != myFaction) {
if (!checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
if (!checkBypassPerms(fPlayer, player, Board.getInstance().getFactionAt(myFloc))) {
fPlayer.setFlying(false);
flyMap.remove(name);
}
@ -153,8 +153,8 @@ public class CmdFly extends FCommand {
public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
faction.isWarZone() ||
faction.isWilderness();
}
public static void checkTaskState() {
@ -192,6 +192,7 @@ public class CmdFly extends FCommand {
}
}
if (args.size() == 0) {
toggleFlight(fme.isFlying(), me);
} else if (args.size() == 1) {
@ -226,4 +227,4 @@ public class CmdFly extends FCommand {
return TL.COMMAND_FLY_DESCRIPTION;
}
}
}

View File

@ -8,8 +8,6 @@ import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit;
import java.util.ArrayList;
import java.util.Iterator;
public class UtilFly {
@ -17,7 +15,6 @@ public class UtilFly {
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return;
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
for (FPlayer fp : FPlayers.getInstance().getAllFPlayers()) {
if (fp.isFlying()) fp.checkIfNearbyEnemies();

View File

@ -1070,7 +1070,6 @@ public abstract class MemoryFPlayer implements FPlayer {
if (e == null) {
continue;
}
if (e instanceof Player) {
Player eplayer = (((Player) e).getPlayer());
if (eplayer == null) {
@ -1080,7 +1079,7 @@ public abstract class MemoryFPlayer implements FPlayer {
if (efplayer == null) {
continue;
}
if (efplayer != null && this.getRelationTo(efplayer).equals(Relation.ENEMY) && !efplayer.isStealthEnabled()) {
if (this.getRelationTo(efplayer).equals(Relation.ENEMY) && !efplayer.isStealthEnabled()) {
setFlying(false);
msg(TL.COMMAND_FLY_ENEMY_NEAR);
Bukkit.getServer().getPluginManager().callEvent(new FPlayerStoppedFlying(this));