Merge remote-tracking branch 'origin/1.6.x' into 1.6.x

This commit is contained in:
Driftay 2020-04-07 22:24:55 -04:00
commit d86d8fc73a
2 changed files with 17 additions and 7 deletions

View File

@ -27,6 +27,7 @@ public class CmdFly extends FCommand {
public static ConcurrentHashMap<String, Boolean> flyMap = new ConcurrentHashMap<>();
public static BukkitTask particleTask = null;
public static BukkitTask flyTask = null;
public static boolean autoenable = FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable");
public CmdFly() {
@ -97,7 +98,7 @@ public class CmdFly extends FCommand {
}
public static boolean checkFly(FPlayer fme, Player me, Faction toFac) {
if (Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase))
if ((Conf.denyFlightIfInNoClaimingWorld && !Conf.worldsNoClaiming.isEmpty() && Conf.worldsNoClaiming.stream().anyMatch(me.getWorld().getName()::equalsIgnoreCase)) || me.hasPermission(Permission.FLY_FLY.node))
return false;
if (toFac.getAccess(fme, PermissableAction.FLY) == Access.ALLOW) return true;
if (fme.getFaction().isWilderness()) return false;

View File

@ -4,6 +4,7 @@ import com.massivecraft.factions.*;
import com.massivecraft.factions.cmd.CmdFGlobal;
import com.massivecraft.factions.cmd.CmdFly;
import com.massivecraft.factions.cmd.CmdSeeChunk;
import com.massivecraft.factions.cmd.FCmdRoot;
import com.massivecraft.factions.cmd.audit.FLogType;
import com.massivecraft.factions.cmd.logout.LogoutHandler;
import com.massivecraft.factions.cmd.wild.CmdWild;
@ -569,15 +570,17 @@ public class FactionsPlayerListener implements Listener {
.replace("{leader}", faction.getFPlayerAdmin() + "");
return string;
}
@Deprecated
public void checkCanFly(FPlayer me) {
if (!FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight") || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))
return;
if (me.isFlying()) return;
me.setFFlying(true, false);
CmdFly.flyMap.put(me.getName(), true);
if (CmdFly.particleTask == null)
CmdFly.startParticles();
if (me.getPlayer().hasPermission(Permission.FLY_FLY.node)) {
me.setFFlying(true, false);
CmdFly.flyMap.put(me.getName(), true);
if (CmdFly.particleTask == null)
CmdFly.startParticles();
}
}
//inspect
@ -716,7 +719,13 @@ public class FactionsPlayerListener implements Listener {
}, 5);
}
}
this.checkCanFly(me);
if (FCmdRoot.instance.fFlyEnabled && CmdFly.autoenable && CmdFly.checkFly(me, me.getPlayer(), factionTo)) {
me.setFFlying(true, false);
CmdFly.flyMap.put(me.getName(), true);
if (CmdFly.particleTask == null)
CmdFly.startParticles();
}
if (me.getAutoClaimFor() != null) {
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);