Moving stuff around in ConfServer and adding properm methods to the enums for DefaultDefaults.
This commit is contained in:
parent
e901cae995
commit
c43bfbe537
@ -26,36 +26,26 @@ public class ConfServer extends SimpleConfig
|
||||
// DOUBTFULLY CONFIGURABLE DEFAULTS (TODO)
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static Map<FFlag, Boolean> factionFlagDefaults;
|
||||
//public static Map<FFlag, Boolean> factionFlagIsChangeable;
|
||||
public static Map<FPerm, Set<Rel>> factionPermDefaults;
|
||||
public static Map<FFlag, Boolean> factionFlagDefaults = FFlag.getDefaultDefaults();
|
||||
public static Map<FPerm, Set<Rel>> factionPermDefaults = FPerm.getDefaultDefaults();
|
||||
|
||||
// TODO: Shouldn't this be a constant rather?
|
||||
public static Rel factionRankDefault = Rel.RECRUIT;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// POWER
|
||||
// DERPY OVERRIDES
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static double powerMax = 10.0;
|
||||
public static double powerMin = -10.0;
|
||||
public static double powerStarting = 10.0; // New players start out with this power level
|
||||
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
|
||||
public static Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
|
||||
|
||||
public static double powerPerDeath = -4.0; // A death makes you lose 4 power
|
||||
public static Set<String> worldsNoClaiming = new LinkedHashSet<String>();
|
||||
|
||||
public static double powerPerHourOnline = 10.0;
|
||||
public static double powerPerHourOffline = 0.0;
|
||||
|
||||
// players will no longer lose power from being offline once their power drops to this amount or less
|
||||
public static double powerLimitGainOnline = 10.0;
|
||||
public static double powerLimitGainOffline = 0.0;
|
||||
public static double powerLimitLossOnline = -10.0;
|
||||
public static double powerLimitLossOffline = 0.0;
|
||||
|
||||
public static boolean scaleNegativePower = false; // Power regeneration rate increase as power decreases
|
||||
public static double scaleNegativeDivisor = 40.0; // Divisor for inverse power regeneration curve
|
||||
|
||||
public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts)
|
||||
// TODO: Should worldsNoPowerLoss rather be a bukkit permission node?
|
||||
public static Set<String> worldsNoPowerLoss = new LinkedHashSet<String>();
|
||||
public static Set<String> worldsIgnorePvP = new LinkedHashSet<String>();
|
||||
// TODO: A better solution Would be to have One wilderness faction per world.
|
||||
//public static Set<String> worldsNoWildernessProtection = new LinkedHashSet<String>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CORE
|
||||
@ -85,17 +75,28 @@ public class ConfServer extends SimpleConfig
|
||||
public static boolean removePlayerDataWhenBanned = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: WORLD GUARD
|
||||
// POWER
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean worldGuardChecking = false;
|
||||
public static double powerMax = 10.0;
|
||||
public static double powerMin = -10.0;
|
||||
public static double powerStarting = 10.0; // New players start out with this power level
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: LWC
|
||||
// -------------------------------------------- //
|
||||
public static double powerPerDeath = -4.0; // A death makes you lose 4 power
|
||||
|
||||
public static boolean onUnclaimResetLwcLocks = false;
|
||||
public static boolean onCaptureResetLwcLocks = false;
|
||||
public static double powerPerHourOnline = 10.0;
|
||||
public static double powerPerHourOffline = 0.0;
|
||||
|
||||
// players will no longer lose power from being offline once their power drops to this amount or less
|
||||
public static double powerLimitGainOnline = 10.0;
|
||||
public static double powerLimitGainOffline = 0.0;
|
||||
public static double powerLimitLossOnline = -10.0;
|
||||
public static double powerLimitLossOffline = 0.0;
|
||||
|
||||
public static boolean scaleNegativePower = false; // Power regeneration rate increase as power decreases
|
||||
public static double scaleNegativeDivisor = 40.0; // Divisor for inverse power regeneration curve
|
||||
|
||||
public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts)
|
||||
|
||||
// -------------------------------------------- //
|
||||
// HOMES
|
||||
@ -142,6 +143,19 @@ public class ConfServer extends SimpleConfig
|
||||
|
||||
public static boolean pistonProtectionThroughDenyBuild = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: WORLD GUARD
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean worldGuardChecking = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: LWC
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean onUnclaimResetLwcLocks = false;
|
||||
public static boolean onCaptureResetLwcLocks = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: SPOUT
|
||||
// -------------------------------------------- //
|
||||
@ -217,38 +231,5 @@ public class ConfServer extends SimpleConfig
|
||||
public static boolean bankFactionPaysCosts = true; //The faction pays for faction command costs, such as sethome
|
||||
public static boolean bankFactionPaysLandCosts = true; //The faction pays for land claiming costs.
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DERPY OVERRIDES
|
||||
// -------------------------------------------- //
|
||||
|
||||
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
|
||||
public static Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
|
||||
|
||||
public static Set<String> worldsNoClaiming = new LinkedHashSet<String>();
|
||||
|
||||
// TODO: Should worldsNoPowerLoss rather be a bukkit permission node?
|
||||
public static Set<String> worldsNoPowerLoss = new LinkedHashSet<String>();
|
||||
public static Set<String> worldsIgnorePvP = new LinkedHashSet<String>();
|
||||
// TODO: A better solution Would be to have One wilderness faction per world.
|
||||
//public static Set<String> worldsNoWildernessProtection = new LinkedHashSet<String>();
|
||||
|
||||
// -------------------------------------------- //
|
||||
// STATIC CONSTRUCTOR TO GET RID OF (TODO)
|
||||
// -------------------------------------------- //
|
||||
|
||||
static
|
||||
{
|
||||
factionFlagDefaults = new LinkedHashMap<FFlag, Boolean>();
|
||||
for (FFlag flag : FFlag.values())
|
||||
{
|
||||
factionFlagDefaults.put(flag, flag.defaultDefaultValue);
|
||||
}
|
||||
|
||||
factionPermDefaults = new LinkedHashMap<FPerm, Set<Rel>>();
|
||||
for (FPerm perm: FPerm.values())
|
||||
{
|
||||
factionPermDefaults.put(perm, perm.defaultDefaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* Flags that describe the nature of a faction and it's territory.
|
||||
@ -43,34 +46,45 @@ public enum FFlag
|
||||
private final String desc;
|
||||
public String getDescription() { return this.desc; }
|
||||
|
||||
public final boolean defaultDefaultValue;
|
||||
public final boolean defaultDefault;
|
||||
public boolean getDefaultDefault() { return this.defaultDefault; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private FFlag(final String nicename, final String desc, final boolean defaultDefaultValue)
|
||||
private FFlag(String nicename, final String desc, boolean defaultDefault)
|
||||
{
|
||||
this.nicename = nicename;
|
||||
this.desc = desc;
|
||||
this.defaultDefaultValue = defaultDefaultValue;
|
||||
this.defaultDefault = defaultDefault;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DEFAULTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean getDefault()
|
||||
{
|
||||
Boolean ret = ConfServer.factionFlagDefaults.get(this);
|
||||
if (ret == null) return this.getDefaultDefault();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Map<FFlag, Boolean> getDefaultDefaults()
|
||||
{
|
||||
Map<FFlag, Boolean> ret = new LinkedHashMap<FFlag, Boolean>();
|
||||
for (FFlag flag : values())
|
||||
{
|
||||
ret.put(flag, flag.getDefaultDefault());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FRODOODODFOFL
|
||||
// -------------------------------------------- //
|
||||
|
||||
|
||||
/**
|
||||
* The state for newly created factions.
|
||||
*/
|
||||
public boolean getDefault()
|
||||
{
|
||||
Boolean ret = ConfServer.factionFlagDefaults.get(this);
|
||||
if (ret == null) return this.defaultDefaultValue;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static FFlag parse(String str)
|
||||
{
|
||||
str = str.toLowerCase();
|
||||
@ -96,4 +110,7 @@ public enum FFlag
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ package com.massivecraft.factions;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -56,7 +58,8 @@ public enum FPerm
|
||||
private final String desc;
|
||||
public String getDescription() { return this.desc; }
|
||||
|
||||
public final Set<Rel> defaultDefaultValue;
|
||||
public final Set<Rel> defaultDefault;
|
||||
public Set<Rel> getDefaultDefault() { return new LinkedHashSet<Rel>(this.defaultDefault); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
@ -70,21 +73,35 @@ public enum FPerm
|
||||
Set<Rel> defaultDefaultValue = new LinkedHashSet<Rel>();
|
||||
defaultDefaultValue.addAll(Arrays.asList(rels));
|
||||
defaultDefaultValue = Collections.unmodifiableSet(defaultDefaultValue);
|
||||
this.defaultDefaultValue = defaultDefaultValue;
|
||||
this.defaultDefault = defaultDefaultValue;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FROOODLDLLD
|
||||
// DEFAULTS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public Set<Rel> getDefault()
|
||||
{
|
||||
Set<Rel> ret = ConfServer.factionPermDefaults.get(this);
|
||||
if (ret == null) ret = this.defaultDefaultValue;
|
||||
if (ret == null) return this.getDefaultDefault();
|
||||
ret = new LinkedHashSet<Rel>(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Map<FPerm, Set<Rel>> getDefaultDefaults()
|
||||
{
|
||||
Map<FPerm, Set<Rel>> ret = new LinkedHashMap<FPerm, Set<Rel>>();
|
||||
for (FPerm fperm : values())
|
||||
{
|
||||
ret.put(fperm, fperm.getDefaultDefault());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FROOODLDLLD
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static FPerm parse(String str)
|
||||
{
|
||||
str = str.toLowerCase();
|
||||
|
Loading…
Reference in New Issue
Block a user