From 19102ffd83cedccc29c5c816fe1286ce5674c210 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Wed, 17 Sep 2014 14:18:27 +0200 Subject: [PATCH] Adding OldConf in as previous UConf for future use. --- .../factions/entity/old/OldConf.java | 155 ++++++++++++++++++ .../factions/entity/old/OldConfColl.java | 30 ++++ .../factions/entity/old/OldConfColls.java | 47 ++++++ .../factions/util/VisualizeUtil.java | 2 +- 4 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/massivecraft/factions/entity/old/OldConf.java create mode 100644 src/main/java/com/massivecraft/factions/entity/old/OldConfColl.java create mode 100644 src/main/java/com/massivecraft/factions/entity/old/OldConfColls.java diff --git a/src/main/java/com/massivecraft/factions/entity/old/OldConf.java b/src/main/java/com/massivecraft/factions/entity/old/OldConf.java new file mode 100644 index 00000000..d28f74b3 --- /dev/null +++ b/src/main/java/com/massivecraft/factions/entity/old/OldConf.java @@ -0,0 +1,155 @@ +package com.massivecraft.factions.entity.old; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.bukkit.event.EventPriority; + +import com.massivecraft.factions.FFlag; +import com.massivecraft.factions.FPerm; +import com.massivecraft.factions.Rel; +import com.massivecraft.factions.event.EventFactionsChunkChangeType; +import com.massivecraft.massivecore.store.Entity; + +public class OldConf extends Entity +{ + // -------------------------------------------- // + // UNIVERSE ENABLE SWITCH + // -------------------------------------------- // + + public boolean enabled = true; + + // -------------------------------------------- // + // SPECIAL FACTION IDS + // -------------------------------------------- // + + public String factionIdNone = null; + public String factionIdSafezone = null; + public String factionIdWarzone = null; + + // -------------------------------------------- // + // DEFAULTS + // -------------------------------------------- // + + public String defaultPlayerFactionId = null; + public Rel defaultPlayerRole = null; + public double defaultPlayerPower = 0.0; + + public boolean defaultFactionOpen = false; + public Map defaultFactionFlags = null; + public Map> defaultFactionPerms = null; + + // -------------------------------------------- // + // MESSAGES + // -------------------------------------------- // + + public boolean broadcastNameChange = false; + + // -------------------------------------------- // + // POWER + // -------------------------------------------- // + + public double powerMax = 10.0; + public double powerMin = 0.0; + public double powerPerHour = 2.0; + public double powerPerDeath = -2.0; + + public boolean canLeaveWithNegativePower = true; + + // -------------------------------------------- // + // CORE + // -------------------------------------------- // + + public int factionMemberLimit = 0; + public double factionPowerMax = 0.0; + + public int factionNameLengthMin = 3; + public int factionNameLengthMax = 16; + public boolean factionNameForceUpperCase = false; + + // -------------------------------------------- // + // CLAIMS + // -------------------------------------------- // + + public boolean claimsMustBeConnected = true; + public boolean claimingFromOthersAllowed = true; + public boolean claimsCanBeUnconnectedIfOwnedByOtherFaction = false; + public int claimsRequireMinFactionMembers = 1; + public int claimedLandsMax = 0; + + // -------------------------------------------- // + // HOMES + // -------------------------------------------- // + + public boolean homesEnabled = true; + public boolean homesMustBeInClaimedTerritory = true; + public boolean homesTeleportCommandEnabled = true; + public boolean homesTeleportAllowedFromEnemyTerritory = true; + public boolean homesTeleportAllowedFromDifferentWorld = true; + public double homesTeleportAllowedEnemyDistance = 32.0; + public boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true; + + public boolean homesTeleportToOnDeathActive = false; + public EventPriority homesTeleportToOnDeathPriority = null; + + // -------------------------------------------- // + // ASSORTED + // -------------------------------------------- // + + public boolean permanentFactionsDisableLeaderPromotion = false; + public double actionDeniedPainAmount = 2.0D; + public boolean disablePVPForFactionlessPlayers = false; + public boolean enablePVPAgainstFactionlessInAttackersLand = false; + public double territoryShieldFactor = 0.3D; + + // -------------------------------------------- // + // DENY COMMANDS + // -------------------------------------------- // + + // commands which will be prevented if the player is a member of a permanent faction + public List denyCommandsPermanentFactionMember = null; + + // commands which will be prevented when in claimed territory of another faction + public Map> denyCommandsTerritoryRelation = null; + + // -------------------------------------------- // + // INTEGRATION: LWC + // -------------------------------------------- // + + public Map lwcRemoveOnChange = null; + + // -------------------------------------------- // + // INTEGRATION: ECONOMY + // -------------------------------------------- // + + public boolean econEnabled = false; + + // TODO: Rename to include unit. + public double econLandReward = 0.00; + + public String econUniverseAccount = null; + + public Map econChunkCost = null; + + public double econCostCreate = 200.0; + public double econCostSethome = 0.0; + public double econCostJoin = 0.0; + public double econCostLeave = 0.0; + public double econCostKick = 0.0; + public double econCostInvite = 0.0; + public double econCostDeinvite = 0.0; + public double econCostHome = 0.0; + public double econCostName = 0.0; + public double econCostDescription = 0.0; + public double econCostTitle = 0.0; + public double econCostOpen = 0.0; + + public Map econRelCost = null; + + //Faction banks, to pay for land claiming and other costs instead of individuals paying for them + public boolean bankEnabled = true; + //public static boolean bankMembersCanWithdraw = false; //Have to be at least moderator to withdraw or pay money to another faction + public boolean bankFactionPaysCosts = true; //The faction pays for faction command costs, such as sethome + public boolean bankFactionPaysLandCosts = true; //The faction pays for land claiming costs. +} diff --git a/src/main/java/com/massivecraft/factions/entity/old/OldConfColl.java b/src/main/java/com/massivecraft/factions/entity/old/OldConfColl.java new file mode 100644 index 00000000..cc439503 --- /dev/null +++ b/src/main/java/com/massivecraft/factions/entity/old/OldConfColl.java @@ -0,0 +1,30 @@ +package com.massivecraft.factions.entity.old; + +import com.massivecraft.factions.Factions; +import com.massivecraft.massivecore.MassiveCore; +import com.massivecraft.massivecore.store.Coll; +import com.massivecraft.massivecore.store.MStore; + +public class OldConfColl extends Coll +{ + // -------------------------------------------- // + // CONSTRUCT + // -------------------------------------------- // + + public OldConfColl(String name) + { + super(name, OldConf.class, MStore.getDb(), Factions.get()); + } + + // -------------------------------------------- // + // OVERRIDE + // -------------------------------------------- // + + @Override + public void init() + { + super.init(); + this.get(MassiveCore.INSTANCE, true); + } + +} diff --git a/src/main/java/com/massivecraft/factions/entity/old/OldConfColls.java b/src/main/java/com/massivecraft/factions/entity/old/OldConfColls.java new file mode 100644 index 00000000..061c95ab --- /dev/null +++ b/src/main/java/com/massivecraft/factions/entity/old/OldConfColls.java @@ -0,0 +1,47 @@ +package com.massivecraft.factions.entity.old; + +import com.massivecraft.factions.Factions; +import com.massivecraft.massivecore.Aspect; +import com.massivecraft.massivecore.MassiveCore; +import com.massivecraft.massivecore.store.Colls; + +public class OldConfColls extends Colls +{ + // -------------------------------------------- // + // INSTANCE & CONSTRUCT + // -------------------------------------------- // + + private static OldConfColls i = new OldConfColls(); + public static OldConfColls get() { return i; } + + // -------------------------------------------- // + // OVERRIDE: COLLS + // -------------------------------------------- // + + @Override + public OldConfColl createColl(String collName) + { + return new OldConfColl(collName); + } + + @Override + public Aspect getAspect() + { + return Factions.get().getAspect(); + } + + @Override + public String getBasename() + { + return "factions_uconf"; + } + + @Override + public OldConf get2(Object worldNameExtractable) + { + OldConfColl coll = this.get(worldNameExtractable); + if (coll == null) return null; + return coll.get(MassiveCore.INSTANCE); + } + +} diff --git a/src/main/java/com/massivecraft/factions/util/VisualizeUtil.java b/src/main/java/com/massivecraft/factions/util/VisualizeUtil.java index 0b04287b..60a019d9 100644 --- a/src/main/java/com/massivecraft/factions/util/VisualizeUtil.java +++ b/src/main/java/com/massivecraft/factions/util/VisualizeUtil.java @@ -14,7 +14,7 @@ import org.bukkit.entity.Player; // TODO: Only send blocks in visual range // TODO: Only send blocks that where changed when clearing? -// TODO: Create packed queue to avoid freezes. +// TODO: Create packed queue to avoid freezes. public class VisualizeUtil {