diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index a425cccf..b364fd8d 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -160,6 +160,12 @@ public class Conf { public static Set warzoneDenyCommands = new LinkedHashSet<>(); public static Set wildernessDenyCommands = new LinkedHashSet<>(); + public static boolean defaultFlyPermEnemy = false; + public static boolean defaultFlyPermNeutral = false; + public static boolean defaultFlyPermTruce = false; + public static boolean defaultFlyPermAlly = true; + public static boolean defaultFlyPermMember = true; + public static boolean territoryDenyBuild = true; public static boolean territoryDenyBuildWhenOffline = true; public static boolean territoryPainBuild = false; diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index 5023fedb..4473318f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -951,14 +951,36 @@ public abstract class MemoryFPlayer implements FPlayer { if (faction.isWilderness() || faction.isSafeZone() || faction.isWarZone()) { return false; } - if (faction == getFaction() && getRole() == Role.ADMIN) { + + // Admins can always fly in their territory. + // admin bypass (ops) can fly as well. + if (isAdminBypassing || (faction == getFaction() && getRole() == Role.ADMIN)) { return true; } Access access = faction.getAccess(this, PermissableAction.FLY); - // True if access is somehow null (should never happen), true if access is undefinied (let everyone fly by default) - // or if access is set (allow or deny), true if allow. - return access == null || access == Access.UNDEFINED || access == Access.ALLOW; + + if (access == null || access == Access.UNDEFINED) { + + // If access is null or undefined, we'll default to the conf.json + switch (faction.getRelationTo(getFaction())) { + case ENEMY: + return Conf.defaultFlyPermEnemy; + case ALLY: + return Conf.defaultFlyPermAlly; + case NEUTRAL: + return Conf.defaultFlyPermNeutral; + case TRUCE: + return Conf.defaultFlyPermTruce; + case MEMBER: + return Conf.defaultFlyPermMember; + default: + return false; // should never reach. + } + + } + + return access == Access.ALLOW; } public boolean shouldTakeFallDamage() {