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; continue;
} }
Player player = Bukkit.getPlayer(name); Player player = Bukkit.getPlayer(name);
if (player == null if (player == null
|| !player.isFlying() || !player.isFlying()
|| player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.CREATIVE
|| !SavageFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) { || !SavageFactions.plugin.mc17 && player.getGameMode() == GameMode.SPECTATOR) {
continue; continue;
} }
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
@ -110,7 +110,7 @@ public class CmdFly extends FCommand {
} }
FLocation myFloc = new FLocation(player.getLocation()); FLocation myFloc = new FLocation(player.getLocation());
if (Board.getInstance().getFactionAt(myFloc) != myFaction) { 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); fPlayer.setFlying(false);
flyMap.remove(name); flyMap.remove(name);
} }
@ -153,8 +153,8 @@ public class CmdFly extends FCommand {
public static Boolean isSystemFaction(Faction faction) { public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() || return faction.isSafeZone() ||
faction.isWarZone() || faction.isWarZone() ||
faction.isWilderness(); faction.isWilderness();
} }
public static void checkTaskState() { public static void checkTaskState() {
@ -192,6 +192,7 @@ public class CmdFly extends FCommand {
} }
} }
if (args.size() == 0) { if (args.size() == 0) {
toggleFlight(fme.isFlying(), me); toggleFlight(fme.isFlying(), me);
} else if (args.size() == 1) { } else if (args.size() == 1) {
@ -226,4 +227,4 @@ public class CmdFly extends FCommand {
return TL.COMMAND_FLY_DESCRIPTION; 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 com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import java.util.ArrayList;
import java.util.Iterator;
public class UtilFly { public class UtilFly {
@ -17,7 +15,6 @@ public class UtilFly {
if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) if (!SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight"))
return; return;
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> { Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
for (FPlayer fp : FPlayers.getInstance().getAllFPlayers()) { for (FPlayer fp : FPlayers.getInstance().getAllFPlayers()) {
if (fp.isFlying()) fp.checkIfNearbyEnemies(); if (fp.isFlying()) fp.checkIfNearbyEnemies();

View File

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