mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-26 20:26:23 +01:00
Move some more stuff from ConfServer --> UConf
This commit is contained in:
parent
3dc2691bea
commit
d9a23241ec
@ -30,21 +30,6 @@ public class ConfServer extends SimpleConfig
|
||||
public static double autoLeaveRoutineRunsEveryXMinutes = 5.0;
|
||||
public static boolean removePlayerDataWhenBanned = true;
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------- //
|
||||
// PVP
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean disablePVPForFactionlessPlayers = false;
|
||||
public static boolean enablePVPAgainstFactionlessInAttackersLand = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ASSORTED
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean permanentFactionsDisableLeaderPromotion = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CLAIMS
|
||||
// -------------------------------------------- //
|
||||
@ -58,28 +43,7 @@ public class ConfServer extends SimpleConfig
|
||||
// if someone is doing a radius claim and the process fails to claim land this many times in a row, it will exit
|
||||
public static int radiusClaimFailureLimit = 9;
|
||||
|
||||
//public static double considerFactionsReallyOfflineAfterXMinutes = 0.0;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ASSORTED
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static int actionDeniedPainAmount = 2;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ASSORTED
|
||||
// -------------------------------------------- //
|
||||
|
||||
// TODO: Should this be based on a permission node lookup map?
|
||||
public static double territoryShieldFactor = 0.3;
|
||||
|
||||
// for claimed areas where further faction-member ownership can be defined
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ASSORTED
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean pistonProtectionThroughDenyBuild = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: WORLD GUARD
|
||||
@ -87,18 +51,19 @@ public class ConfServer extends SimpleConfig
|
||||
|
||||
public static boolean worldGuardChecking = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: LWC
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static boolean onUnclaimResetLwcLocks = false;
|
||||
public static boolean onCaptureResetLwcLocks = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: ECONOMY
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static int econLandRewardTaskRunsEveryXMinutes = 20;
|
||||
|
||||
public static boolean econEnabled = false;
|
||||
|
||||
// TODO: Rename to include unit.
|
||||
public static double econLandReward = 0.00;
|
||||
|
||||
public static String econUniverseAccount = "";
|
||||
|
||||
public static double econCostClaimWilderness = 30.0;
|
||||
@ -124,8 +89,7 @@ public class ConfServer extends SimpleConfig
|
||||
public static double econCostNeutral = 0.0;
|
||||
public static double econCostEnemy = 0.0;
|
||||
|
||||
public static int econLandRewardTaskRunsEveryXMinutes = 20;
|
||||
public static double econLandReward = 0.00;
|
||||
|
||||
|
||||
//Faction banks, to pay for land claiming and other costs instead of individuals paying for them
|
||||
public static boolean bankEnabled = true;
|
||||
|
@ -10,7 +10,6 @@ import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.Const;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.RelationParticipator;
|
||||
@ -112,7 +111,7 @@ public class Board extends Entity<Board> implements BoardInterface
|
||||
{
|
||||
// TODO: Listen to an event instead!
|
||||
// NOTE: And this is probably the place where the event should be triggered!
|
||||
if (ConfServer.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
||||
if (UConf.get(ps).onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
||||
{
|
||||
LWCFeatures.clearAllProtections(ps);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.Const;
|
||||
import com.massivecraft.factions.EconomyParticipator;
|
||||
import com.massivecraft.factions.FFlag;
|
||||
@ -791,7 +790,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
public void promoteNewLeader()
|
||||
{
|
||||
if ( ! this.isNormal()) return;
|
||||
if (this.getFlag(FFlag.PERMANENT) && ConfServer.permanentFactionsDisableLeaderPromotion) return;
|
||||
if (this.getFlag(FFlag.PERMANENT) && UConf.get(this).permanentFactionsDisableLeaderPromotion) return;
|
||||
|
||||
UPlayer oldLeader = this.getLeader();
|
||||
|
||||
|
@ -26,9 +26,7 @@ public class UConf extends Entity<UConf>
|
||||
// -------------------------------------------- //
|
||||
// CORE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean canLeaveWithNegativePower = true;
|
||||
|
||||
|
||||
public int factionMemberLimit = 0;
|
||||
public double factionPowerMax = 1000.0;
|
||||
|
||||
@ -36,6 +34,19 @@ public class UConf extends Entity<UConf>
|
||||
public int factionTagLengthMax = 10;
|
||||
public boolean factionTagForceUpperCase = false;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// ASSORTED
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean permanentFactionsDisableLeaderPromotion = false;
|
||||
|
||||
public int actionDeniedPainAmount = 2;
|
||||
|
||||
public boolean disablePVPForFactionlessPlayers = false;
|
||||
public boolean enablePVPAgainstFactionlessInAttackersLand = false;
|
||||
|
||||
public double territoryShieldFactor = 0.3;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// DEFAULTS
|
||||
// -------------------------------------------- //
|
||||
@ -60,6 +71,8 @@ public class UConf extends Entity<UConf>
|
||||
public double powerPerHour = 2.0;
|
||||
public double powerPerDeath = -2.0;
|
||||
|
||||
public boolean canLeaveWithNegativePower = true;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// HOMES
|
||||
// -------------------------------------------- //
|
||||
@ -88,4 +101,11 @@ public class UConf extends Entity<UConf>
|
||||
Rel.MEMBER, new ArrayList<String>()
|
||||
);
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INTEGRATION: LWC
|
||||
// -------------------------------------------- //
|
||||
|
||||
public boolean onUnclaimResetLwcLocks = false;
|
||||
public boolean onCaptureResetLwcLocks = false;
|
||||
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ public class UPlayer extends SenderEntity<UPlayer> implements EconomyParticipato
|
||||
if (Econ.payForAction(cost, this, "claim this land")) return false;
|
||||
|
||||
// TODO: The LWC integration should listen to Monitor for the claim event.
|
||||
if (LWCFeatures.getEnabled() && forFaction.isNormal() && ConfServer.onCaptureResetLwcLocks)
|
||||
if (LWCFeatures.getEnabled() && forFaction.isNormal() && UConf.get(forFaction).onCaptureResetLwcLocks)
|
||||
{
|
||||
LWCFeatures.clearOtherProtections(psChunk, this.getFaction());
|
||||
}
|
||||
|
@ -226,20 +226,21 @@ public class FactionsListenerMain implements Listener
|
||||
|
||||
Faction defendFaction = fdefender.getFaction();
|
||||
Faction attackFaction = fattacker.getFaction();
|
||||
UConf uconf = UConf.get(attackFaction);
|
||||
|
||||
if (attackFaction.isNone() && ConfServer.disablePVPForFactionlessPlayers)
|
||||
if (attackFaction.isNone() && uconf.disablePVPForFactionlessPlayers)
|
||||
{
|
||||
if (notify) fattacker.msg("<i>You can't hurt other players until you join a faction.");
|
||||
return false;
|
||||
}
|
||||
else if (defendFaction.isNone())
|
||||
{
|
||||
if (defenderPsFaction == attackFaction && ConfServer.enablePVPAgainstFactionlessInAttackersLand)
|
||||
if (defenderPsFaction == attackFaction && uconf.enablePVPAgainstFactionlessInAttackersLand)
|
||||
{
|
||||
// Allow PVP vs. Factionless in attacker's faction territory
|
||||
return true;
|
||||
}
|
||||
else if (ConfServer.disablePVPForFactionlessPlayers)
|
||||
else if (uconf.disablePVPForFactionlessPlayers)
|
||||
{
|
||||
if (notify) fattacker.msg("<i>You can't hurt players who are not currently in a faction.");
|
||||
return false;
|
||||
@ -269,15 +270,15 @@ public class FactionsListenerMain implements Listener
|
||||
|
||||
// Damage will be dealt. However check if the damage should be reduced.
|
||||
int damage = event.getDamage();
|
||||
if (damage > 0.0 && fdefender.hasFaction() && ownTerritory && ConfServer.territoryShieldFactor > 0)
|
||||
if (damage > 0.0 && fdefender.hasFaction() && ownTerritory && uconf.territoryShieldFactor > 0)
|
||||
{
|
||||
int newDamage = (int)Math.ceil(damage * (1D - ConfServer.territoryShieldFactor));
|
||||
int newDamage = (int)Math.ceil(damage * (1D - uconf.territoryShieldFactor));
|
||||
event.setDamage(newDamage);
|
||||
|
||||
// Send message
|
||||
if (notify)
|
||||
{
|
||||
String perc = MessageFormat.format("{0,number,#%}", (ConfServer.territoryShieldFactor)); // TODO does this display correctly??
|
||||
String perc = MessageFormat.format("{0,number,#%}", (uconf.territoryShieldFactor)); // TODO does this display correctly??
|
||||
fdefender.msg("<i>Enemy damage reduced by <rose>%s<i>.", perc);
|
||||
}
|
||||
}
|
||||
@ -516,7 +517,7 @@ public class FactionsListenerMain implements Listener
|
||||
if (!justCheck)
|
||||
{
|
||||
me.msg("<b>It is painful to build in the territory of %s<b>.", factionHere.describeTo(me));
|
||||
player.damage(ConfServer.actionDeniedPainAmount);
|
||||
player.damage(UConf.get(player).actionDeniedPainAmount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -579,12 +580,12 @@ public class FactionsListenerMain implements Listener
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void blockBuild(BlockPistonExtendEvent event)
|
||||
{
|
||||
if ( ! ConfServer.pistonProtectionThroughDenyBuild) return;
|
||||
Block block = event.getBlock();
|
||||
|
||||
Faction pistonFaction = BoardColls.get().getFactionAt(PS.valueOf(event.getBlock()));
|
||||
Faction pistonFaction = BoardColls.get().getFactionAt(PS.valueOf(block));
|
||||
|
||||
// target end-of-the-line empty (air) block which is being pushed into, including if piston itself would extend into air
|
||||
Block targetBlock = event.getBlock().getRelative(event.getDirection(), event.getLength() + 1);
|
||||
Block targetBlock = block.getRelative(event.getDirection(), event.getLength() + 1);
|
||||
|
||||
// members of faction might not have build rights in their own territory, but pistons should still work regardless; so, address that corner case
|
||||
Faction targetFaction = BoardColls.get().getFactionAt(PS.valueOf(targetBlock));
|
||||
@ -605,9 +606,7 @@ public class FactionsListenerMain implements Listener
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void blockBuild(BlockPistonRetractEvent event)
|
||||
{
|
||||
if (!ConfServer.pistonProtectionThroughDenyBuild) return;
|
||||
|
||||
{
|
||||
// if not a sticky piston, retraction should be fine
|
||||
if (!event.isSticky()) return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user