Fixed a few known issues with F Fly

This commit is contained in:
DroppingAnvil
2020-04-30 14:27:26 -05:00
committed by droppinganvil
parent 86cba0e24c
commit e37745eff9
7 changed files with 10 additions and 36 deletions

View File

@@ -101,27 +101,15 @@ public class CmdDisband extends FCommand {
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
if (follower.getFaction() == faction) {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
if (!follower.canFlyAtLocation() && FactionsPlugin.factionsFlight) {
follower.setFFlying(false, false);
}
} else {
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
}
}
if (FactionsPlugin.factionsFlight) {
faction.disband(context.player, PlayerDisbandReason.COMMAND);
context.fPlayer.setFFlying(false, false);
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
return;
}
} else {
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
}
faction.disband(context.player, PlayerDisbandReason.COMMAND);
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.factionsFlight) {
context.fPlayer.setFFlying(false, false);
}
}
}

View File

@@ -28,6 +28,7 @@ public class CmdFly extends FCommand {
public static BukkitTask particleTask = null;
public static BukkitTask flyTask = null;
public static boolean autoenable = FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable");
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
public CmdFly() {
@@ -46,7 +47,7 @@ public class CmdFly extends FCommand {
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
for (FPlayer fPlayer : flyMap.keySet()) {
Player player = fPlayer.getPlayer();
if (!player.isOnline() || !player.isFlying()) continue;
if (player == null || !player.isOnline() || !fPlayer.isFlying()) continue;
if (!FactionsPlugin.getInstance().mc17) {
if (player.getGameMode() == GameMode.SPECTATOR) continue;
}
@@ -66,7 +67,7 @@ public class CmdFly extends FCommand {
for (FPlayer fPlayer : flyMap.keySet()) {
Player player = fPlayer.getPlayer();
if (player == null
|| !player.isFlying()
|| !fPlayer.isFlying()
|| player.getGameMode() == GameMode.CREATIVE
|| !FactionsPlugin.getInstance().mc17 && player.getGameMode() == GameMode.SPECTATOR) {
continue;
@@ -113,12 +114,10 @@ public class CmdFly extends FCommand {
public static void disableFlight(final FPlayer fme) {
fme.setFlying(false);
flyMap.remove(fme);
}
private static void disableFlightSync(FPlayer fme) {
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
flyMap.remove(fme);
}
private static void checkEnemiesSync(FPlayer fp) {
@@ -164,7 +163,6 @@ public class CmdFly extends FCommand {
private void toggleFlight(final boolean toggle, final FPlayer fme, CommandContext context) {
if (toggle) {
fme.setFlying(false);
flyMap.remove(fme);
return;
}

View File

@@ -30,10 +30,6 @@ public class CmdReload extends FCommand {
FactionsPlugin.getInstance().loadLang();
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
FactionsPlugin.factionsFlight = true;
}
if (!FactionsPlugin.getInstance().mc17) {
FactionsPlayerListener.loadCorners();
}