Fly Fixes
This commit is contained in:
parent
8770ea0d4f
commit
e3cfb575fd
@ -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) {
|
||||||
|
@ -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();
|
||||||
|
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user