The Derpy overrides are MConf for sure.

This commit is contained in:
Olof Larsson 2013-04-22 10:43:40 +02:00
parent c43bfbe537
commit de703d3461
5 changed files with 24 additions and 23 deletions

View File

@ -32,21 +32,6 @@ public class ConfServer extends SimpleConfig
// TODO: Shouldn't this be a constant rather? // TODO: Shouldn't this be a constant rather?
public static Rel factionRankDefault = Rel.RECRUIT; public static Rel factionRankDefault = Rel.RECRUIT;
// -------------------------------------------- //
// 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>();
// -------------------------------------------- // // -------------------------------------------- //
// CORE // CORE
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -731,7 +731,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
// Checks for WorldGuard regions in the chunk attempting to be claimed // Checks for WorldGuard regions in the chunk attempting to be claimed
error = Txt.parse("<b>This land is protected"); error = Txt.parse("<b>This land is protected");
} }
else if (ConfServer.worldsNoClaiming.contains(ps.getWorld())) else if (MConf.get().worldsNoClaiming.contains(ps.getWorld()))
{ {
error = Txt.parse("<b>Sorry, this world has land claiming disabled."); error = Txt.parse("<b>Sorry, this world has land claiming disabled.");
} }

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.entity; package com.massivecraft.factions.entity;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -101,5 +102,19 @@ public class MConf extends Entity<MConf>
public boolean handleExploitInteractionSpam = true; public boolean handleExploitInteractionSpam = true;
public boolean handleExploitTNTWaterlog = false; public boolean handleExploitTNTWaterlog = false;
// -------------------------------------------- //
// DERPY OVERRIDES
// -------------------------------------------- //
// TODO: Should worldsNoPowerLoss rather be a bukkit permission node?
// TODO: These are derpy because they possibly use an invalid design approact.
// After universe support is added. Would some of these be removed?
// Could it also be more customizeable using some sort of permission lookup map?
// mainly for other plugins/mods that use a fake player to take actions, which shouldn't be subject to our protections
public Set<String> playersWhoBypassAllProtection = new LinkedHashSet<String>();
public Set<String> worldsNoClaiming = new LinkedHashSet<String>();
public Set<String> worldsNoPowerLoss = new LinkedHashSet<String>();
public Set<String> worldsIgnorePvP = new LinkedHashSet<String>();
} }

View File

@ -54,6 +54,7 @@ import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventPowerChange; import com.massivecraft.factions.event.FactionsEventPowerChange;
import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason; import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason;
import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.factions.util.VisualizeUtil;
@ -100,7 +101,7 @@ public class FactionsListenerMain implements Listener
return; return;
} }
if (ConfServer.worldsNoPowerLoss.contains(player.getWorld().getName())) if (MConf.get().worldsNoPowerLoss.contains(player.getWorld().getName()))
{ {
fplayer.msg("<i>You didn't lose any power due to the world you died in."); fplayer.msg("<i>You didn't lose any power due to the world you died in.");
return; return;
@ -204,7 +205,7 @@ public class FactionsListenerMain implements Listener
FPlayer fattacker = FPlayerColl.get().get(attacker); FPlayer fattacker = FPlayerColl.get().get(attacker);
// ... does this player bypass all protection? ... // ... does this player bypass all protection? ...
if (ConfServer.playersWhoBypassAllProtection.contains(attacker.getName())) return true; if (MConf.get().playersWhoBypassAllProtection.contains(attacker.getName())) return true;
// ... gather attacker PS and faction information ... // ... gather attacker PS and faction information ...
PS attackerPs = PS.valueOf(attacker); PS attackerPs = PS.valueOf(attacker);
@ -220,7 +221,7 @@ public class FactionsListenerMain implements Listener
} }
// ... are PVP rules completely ignored in this world? ... // ... are PVP rules completely ignored in this world? ...
if (ConfServer.worldsIgnorePvP.contains(defenderPs.getWorld())) return true; if (MConf.get().worldsIgnorePvP.contains(defenderPs.getWorld())) return true;
Faction defendFaction = fdefender.getFaction(); Faction defendFaction = fdefender.getFaction();
Faction attackFaction = fattacker.getFaction(); Faction attackFaction = fattacker.getFaction();
@ -506,7 +507,7 @@ public class FactionsListenerMain implements Listener
public static boolean canPlayerBuildAt(Player player, PS ps, boolean justCheck) public static boolean canPlayerBuildAt(Player player, PS ps, boolean justCheck)
{ {
String name = player.getName(); String name = player.getName();
if (ConfServer.playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
FPlayer me = FPlayer.get(name); FPlayer me = FPlayer.get(name);
if (me.isUsingAdminMode()) return true; if (me.isUsingAdminMode()) return true;

View File

@ -14,13 +14,13 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Const; import com.massivecraft.factions.Const;
import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.integration.SpoutFeatures;
import com.massivecraft.mcore.event.MCorePlayerLeaveEvent; import com.massivecraft.mcore.event.MCorePlayerLeaveEvent;
import com.massivecraft.mcore.ps.PS; import com.massivecraft.mcore.ps.PS;
@ -144,7 +144,7 @@ public class TodoFactionsPlayerListener implements Listener
public static boolean playerCanUseItemHere(Player player, Location loc, Material material, boolean justCheck) public static boolean playerCanUseItemHere(Player player, Location loc, Material material, boolean justCheck)
{ {
String name = player.getName(); String name = player.getName();
if (ConfServer.playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
FPlayer me = FPlayerColl.get().get(name); FPlayer me = FPlayerColl.get().get(name);
if (me.isUsingAdminMode()) return true; if (me.isUsingAdminMode()) return true;
@ -154,7 +154,7 @@ public class TodoFactionsPlayerListener implements Listener
public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck) public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck)
{ {
String name = player.getName(); String name = player.getName();
if (ConfServer.playersWhoBypassAllProtection.contains(name)) return true; if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true;
FPlayer me = FPlayerColl.get().get(name); FPlayer me = FPlayerColl.get().get(name);
if (me.isUsingAdminMode()) return true; if (me.isUsingAdminMode()) return true;