If f perm is not set or undefined, allow server owners to define default f fly access in the conf.json. Adds #1100
This commit is contained in:
parent
20cd874026
commit
1567df7311
@ -160,6 +160,12 @@ public class Conf {
|
|||||||
public static Set<String> warzoneDenyCommands = new LinkedHashSet<>();
|
public static Set<String> warzoneDenyCommands = new LinkedHashSet<>();
|
||||||
public static Set<String> wildernessDenyCommands = new LinkedHashSet<>();
|
public static Set<String> 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 territoryDenyBuild = true;
|
||||||
public static boolean territoryDenyBuildWhenOffline = true;
|
public static boolean territoryDenyBuildWhenOffline = true;
|
||||||
public static boolean territoryPainBuild = false;
|
public static boolean territoryPainBuild = false;
|
||||||
|
@ -951,14 +951,36 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
if (faction.isWilderness() || faction.isSafeZone() || faction.isWarZone()) {
|
if (faction.isWilderness() || faction.isSafeZone() || faction.isWarZone()) {
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Access access = faction.getAccess(this, PermissableAction.FLY);
|
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.
|
if (access == null || access == Access.UNDEFINED) {
|
||||||
return access == null || access == Access.UNDEFINED || access == Access.ALLOW;
|
|
||||||
|
// 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() {
|
public boolean shouldTakeFallDamage() {
|
||||||
|
Loading…
Reference in New Issue
Block a user