Fixed a few known issues with F Fly
This commit is contained in:
parent
86cba0e24c
commit
e37745eff9
@ -82,7 +82,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
public boolean mc114 = false;
|
public boolean mc114 = false;
|
||||||
public boolean mc115 = false;
|
public boolean mc115 = false;
|
||||||
public boolean useNonPacketParticles = false;
|
public boolean useNonPacketParticles = false;
|
||||||
public static boolean factionsFlight = false;
|
|
||||||
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
public List<String> itemList = getConfig().getStringList("fchest.Items-Not-Allowed");
|
||||||
SkriptAddon skriptAddon;
|
SkriptAddon skriptAddon;
|
||||||
private FactionsPlayerListener factionsPlayerListener;
|
private FactionsPlayerListener factionsPlayerListener;
|
||||||
@ -254,8 +253,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfig().getBoolean("enable-faction-flight")) factionsFlight = true;
|
|
||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
if (getServer().getPluginManager().getPlugin("Skript") != null) {
|
||||||
log("Skript was found! Registering FactionsPlugin Addon...");
|
log("Skript was found! Registering FactionsPlugin Addon...");
|
||||||
skriptAddon = Skript.registerAddon(this);
|
skriptAddon = Skript.registerAddon(this);
|
||||||
|
@ -101,27 +101,15 @@ public class CmdDisband extends FCommand {
|
|||||||
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
String amountString = context.sender instanceof ConsoleCommandSender ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(follower);
|
||||||
if (follower.getFaction() == faction) {
|
if (follower.getFaction() == faction) {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
follower.msg(TL.COMMAND_DISBAND_BROADCAST_YOURS, amountString);
|
||||||
if (!follower.canFlyAtLocation() && FactionsPlugin.factionsFlight) {
|
|
||||||
follower.setFFlying(false, false);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
follower.msg(TL.COMMAND_DISBAND_BROADCAST_NOTYOURS, amountString, faction.getTag(follower));
|
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 {
|
} else {
|
||||||
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
context.player.sendMessage(String.valueOf(TL.COMMAND_DISBAND_PLAYER));
|
||||||
}
|
}
|
||||||
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
faction.disband(context.player, PlayerDisbandReason.COMMAND);
|
||||||
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
|
Cooldown.setCooldown(context.fPlayer.getPlayer(), "disbandCooldown", FactionsPlugin.getInstance().getConfig().getInt("fcooldowns.f-disband"));
|
||||||
if (!context.fPlayer.canFlyAtLocation() && FactionsPlugin.factionsFlight) {
|
|
||||||
context.fPlayer.setFFlying(false, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ public class CmdFly extends FCommand {
|
|||||||
public static BukkitTask particleTask = null;
|
public static BukkitTask particleTask = null;
|
||||||
public static BukkitTask flyTask = null;
|
public static BukkitTask flyTask = null;
|
||||||
public static boolean autoenable = FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable");
|
public static boolean autoenable = FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable");
|
||||||
|
public static final boolean fly = FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight");
|
||||||
|
|
||||||
|
|
||||||
public CmdFly() {
|
public CmdFly() {
|
||||||
@ -46,7 +47,7 @@ public class CmdFly extends FCommand {
|
|||||||
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(FactionsPlugin.instance, () -> {
|
||||||
for (FPlayer fPlayer : flyMap.keySet()) {
|
for (FPlayer fPlayer : flyMap.keySet()) {
|
||||||
Player player = fPlayer.getPlayer();
|
Player player = fPlayer.getPlayer();
|
||||||
if (!player.isOnline() || !player.isFlying()) continue;
|
if (player == null || !player.isOnline() || !fPlayer.isFlying()) continue;
|
||||||
if (!FactionsPlugin.getInstance().mc17) {
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
if (player.getGameMode() == GameMode.SPECTATOR) continue;
|
if (player.getGameMode() == GameMode.SPECTATOR) continue;
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ public class CmdFly extends FCommand {
|
|||||||
for (FPlayer fPlayer : flyMap.keySet()) {
|
for (FPlayer fPlayer : flyMap.keySet()) {
|
||||||
Player player = fPlayer.getPlayer();
|
Player player = fPlayer.getPlayer();
|
||||||
if (player == null
|
if (player == null
|
||||||
|| !player.isFlying()
|
|| !fPlayer.isFlying()
|
||||||
|| player.getGameMode() == GameMode.CREATIVE
|
|| player.getGameMode() == GameMode.CREATIVE
|
||||||
|| !FactionsPlugin.getInstance().mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
|| !FactionsPlugin.getInstance().mc17 && player.getGameMode() == GameMode.SPECTATOR) {
|
||||||
continue;
|
continue;
|
||||||
@ -113,12 +114,10 @@ public class CmdFly extends FCommand {
|
|||||||
|
|
||||||
public static void disableFlight(final FPlayer fme) {
|
public static void disableFlight(final FPlayer fme) {
|
||||||
fme.setFlying(false);
|
fme.setFlying(false);
|
||||||
flyMap.remove(fme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void disableFlightSync(FPlayer fme) {
|
private static void disableFlightSync(FPlayer fme) {
|
||||||
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
|
Bukkit.getScheduler().runTask(FactionsPlugin.instance, () -> fme.setFFlying(false, false));
|
||||||
flyMap.remove(fme);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkEnemiesSync(FPlayer fp) {
|
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) {
|
private void toggleFlight(final boolean toggle, final FPlayer fme, CommandContext context) {
|
||||||
if (toggle) {
|
if (toggle) {
|
||||||
fme.setFlying(false);
|
fme.setFlying(false);
|
||||||
flyMap.remove(fme);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +30,6 @@ public class CmdReload extends FCommand {
|
|||||||
FactionsPlugin.getInstance().loadLang();
|
FactionsPlugin.getInstance().loadLang();
|
||||||
|
|
||||||
|
|
||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight", false)) {
|
|
||||||
FactionsPlugin.factionsFlight = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!FactionsPlugin.getInstance().mc17) {
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
FactionsPlayerListener.loadCorners();
|
FactionsPlayerListener.loadCorners();
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void checkCanFly(FPlayer me) {
|
public void checkCanFly(FPlayer me) {
|
||||||
if (!FactionsPlugin.factionsFlight || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
|
if (!CmdFly.fly || !CmdFly.autoenable)
|
||||||
return;
|
return;
|
||||||
if (me.isFlying()) return;
|
if (me.isFlying()) return;
|
||||||
if (me.getPlayer().hasPermission(Permission.FLY_FLY.node)) {
|
if (me.getPlayer().hasPermission(Permission.FLY_FLY.node)) {
|
||||||
@ -726,7 +726,6 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (FCmdRoot.instance.fFlyEnabled && CmdFly.autoenable && CmdFly.checkFly(me, me.getPlayer(), factionTo)) {
|
if (FCmdRoot.instance.fFlyEnabled && CmdFly.autoenable && CmdFly.checkFly(me, me.getPlayer(), factionTo)) {
|
||||||
me.setFFlying(true, false);
|
me.setFFlying(true, false);
|
||||||
CmdFly.flyMap.put(me, true);
|
|
||||||
if (CmdFly.particleTask == null)
|
if (CmdFly.particleTask == null)
|
||||||
CmdFly.startParticles();
|
CmdFly.startParticles();
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@ public class UtilFly {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void run() {
|
public static void run() {
|
||||||
if (!FactionsPlugin.factionsFlight)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(FactionsPlugin.getInstance(), () -> {
|
||||||
for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) {
|
for (FPlayer fp : FPlayers.getInstance().getOnlinePlayers()) {
|
||||||
@ -28,8 +26,6 @@ public class UtilFly {
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
|
public static void setFly(FPlayer fp, boolean fly, boolean silent, boolean damage) {
|
||||||
if (!FactionsPlugin.factionsFlight)
|
|
||||||
return;
|
|
||||||
|
|
||||||
fp.getPlayer().setAllowFlight(fly);
|
fp.getPlayer().setAllowFlight(fly);
|
||||||
fp.getPlayer().setFlying(fly);
|
fp.getPlayer().setFlying(fly);
|
||||||
|
@ -963,19 +963,19 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFFlying(boolean fly, boolean damage) {
|
public void setFFlying(boolean fly, boolean damage) {
|
||||||
if (!FactionsPlugin.factionsFlight)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
if (player == null) return;
|
assert player != null;
|
||||||
|
|
||||||
player.setAllowFlight(fly);
|
player.setAllowFlight(fly);
|
||||||
player.setFlying(fly);
|
player.setFlying(fly);
|
||||||
|
|
||||||
if (!damage) {
|
if (!damage) {
|
||||||
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
msg(TL.COMMAND_FLY_CHANGE, fly ? "enabled" : "disabled");
|
||||||
if (!fly)
|
if (!fly) {
|
||||||
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
sendMessage(TL.COMMAND_FLY_COOLDOWN.toString().replace("{amount}", FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3) + ""));
|
||||||
|
} else {
|
||||||
|
CmdFly.flyMap.put(this, true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
msg(TL.COMMAND_FLY_DAMAGE);
|
msg(TL.COMMAND_FLY_DAMAGE);
|
||||||
}
|
}
|
||||||
@ -983,7 +983,7 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
// If leaving fly mode, don't let them take fall damage for x seconds.
|
// If leaving fly mode, don't let them take fall damage for x seconds.
|
||||||
if (!fly) {
|
if (!fly) {
|
||||||
int cooldown = FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3);
|
int cooldown = FactionsPlugin.getInstance().getConfig().getInt("fly-falldamage-cooldown", 3);
|
||||||
CmdFly.flyMap.remove(player.getName());
|
CmdFly.flyMap.remove(this);
|
||||||
|
|
||||||
// If the value is 0 or lower, make them take fall damage.
|
// If the value is 0 or lower, make them take fall damage.
|
||||||
// Otherwise, start a timer and have this cancel after a few seconds.
|
// Otherwise, start a timer and have this cancel after a few seconds.
|
||||||
|
Loading…
Reference in New Issue
Block a user