Move deny commands from ConfServer to UConf.

This commit is contained in:
Olof Larsson 2013-04-23 09:17:30 +02:00
parent 90d819ab18
commit 6b7312bcf8
4 changed files with 50 additions and 12 deletions

View File

@ -42,13 +42,23 @@ public class ConfServer extends SimpleConfig
public static double homesTeleportAllowedEnemyDistance = 32.0; public static double homesTeleportAllowedEnemyDistance = 32.0;
public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true; public static boolean homesTeleportIgnoreEnemiesIfInOwnTerritory = true;
// -------------------------------------------- //
// PVP
// -------------------------------------------- //
public static boolean disablePVPForFactionlessPlayers = false; public static boolean disablePVPForFactionlessPlayers = false;
public static boolean enablePVPAgainstFactionlessInAttackersLand = false; public static boolean enablePVPAgainstFactionlessInAttackersLand = false;
//public static boolean peacefulMembersDisablePowerLoss = true; // -------------------------------------------- //
// ASSORTED
// -------------------------------------------- //
public static boolean permanentFactionsDisableLeaderPromotion = false; public static boolean permanentFactionsDisableLeaderPromotion = false;
// -------------------------------------------- //
// CLAIMS
// -------------------------------------------- //
public static boolean claimsMustBeConnected = false; public static boolean claimsMustBeConnected = false;
public static boolean claimingFromOthersAllowed = true; public static boolean claimingFromOthersAllowed = true;
public static boolean claimsCanBeUnconnectedIfOwnedByOtherFaction = true; public static boolean claimsCanBeUnconnectedIfOwnedByOtherFaction = true;
@ -60,19 +70,24 @@ public class ConfServer extends SimpleConfig
//public static double considerFactionsReallyOfflineAfterXMinutes = 0.0; //public static double considerFactionsReallyOfflineAfterXMinutes = 0.0;
// -------------------------------------------- //
// ASSORTED
// -------------------------------------------- //
public static int actionDeniedPainAmount = 2; public static int actionDeniedPainAmount = 2;
// commands which will be prevented if the player is a member of a permanent faction // -------------------------------------------- //
public static Set<String> permanentFactionMemberDenyCommands = new LinkedHashSet<String>(); // ASSORTED
// -------------------------------------------- //
// commands which will be prevented when in claimed territory of another faction
public static Set<String> territoryNeutralDenyCommands = new LinkedHashSet<String>();
public static Set<String> territoryEnemyDenyCommands = MUtil.set("home", "sethome", "spawn", "tpahere", "tpaccept", "tpa", "warp");
public static double territoryShieldFactor = 0.3; public static double territoryShieldFactor = 0.3;
// for claimed areas where further faction-member ownership can be defined // for claimed areas where further faction-member ownership can be defined
// -------------------------------------------- //
// ASSORTED
// -------------------------------------------- //
public static boolean pistonProtectionThroughDenyBuild = true; public static boolean pistonProtectionThroughDenyBuild = true;
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -37,5 +37,6 @@ public class MPlayer extends SenderEntity<MPlayer>
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
} }

View File

@ -1,5 +1,7 @@
package com.massivecraft.factions.entity; package com.massivecraft.factions.entity;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -8,6 +10,7 @@ import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.mcore.store.Entity; import com.massivecraft.mcore.store.Entity;
import com.massivecraft.mcore.util.MUtil;
public class UConf extends Entity<UConf> public class UConf extends Entity<UConf>
{ {
@ -64,4 +67,23 @@ public class UConf extends Entity<UConf>
public 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) public 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)
// -------------------------------------------- //
// DENY COMMANDS
// -------------------------------------------- //
// commands which will be prevented if the player is a member of a permanent faction
public List<String> denyCommandsPermanentFactionMember = new ArrayList<String>();
// commands which will be prevented when in claimed territory of another faction
public List<String> denyCommandsTerritoryNeutral = new ArrayList<String>();
public List<String> denyCommandsTerritoryEnemy = MUtil.list(
"home",
"sethome",
"spawn",
"tpahere",
"tpaccept",
"tpa",
"warp"
);
} }

View File

@ -342,7 +342,7 @@ public class FactionsListenerMain implements Listener
command = command.toLowerCase(); command = command.toLowerCase();
command = command.trim(); command = command.trim();
if (uplayer.hasFaction() && uplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, ConfServer.permanentFactionMemberDenyCommands)) if (uplayer.hasFaction() && uplayer.getFaction().getFlag(FFlag.PERMANENT) && containsCommand(command, UConf.get(player).denyCommandsPermanentFactionMember))
{ {
uplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command); uplayer.msg("<b>You can't use \"<h>/%s<b>\" as member of a permanent faction.", command);
event.setCancelled(true); event.setCancelled(true);
@ -353,14 +353,14 @@ public class FactionsListenerMain implements Listener
PS ps = PS.valueOf(player).getChunk(true); PS ps = PS.valueOf(player).getChunk(true);
if (BoardColls.get().getFactionAt(ps).isNone()) return; if (BoardColls.get().getFactionAt(ps).isNone()) return;
if (rel == Rel.NEUTRAL && containsCommand(command, ConfServer.territoryNeutralDenyCommands)) if (rel == Rel.NEUTRAL && containsCommand(command, UConf.get(player).denyCommandsTerritoryNeutral))
{ {
uplayer.msg("<b>You can't use \"<h>/%s<b>\" in neutral territory.", command); uplayer.msg("<b>You can't use \"<h>/%s<b>\" in neutral territory.", command);
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (rel == Rel.ENEMY && containsCommand(command, ConfServer.territoryEnemyDenyCommands)) if (rel == Rel.ENEMY && containsCommand(command, UConf.get(player).denyCommandsTerritoryEnemy))
{ {
uplayer.msg("<b>You can't use \"<h>/%s<b>\" in enemy territory.", command); uplayer.msg("<b>You can't use \"<h>/%s<b>\" in enemy territory.", command);
event.setCancelled(true); event.setCancelled(true);