From de703d346141143c9f2a306755bbcd7254964479 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 22 Apr 2013 10:43:40 +0200 Subject: [PATCH] The Derpy overrides are MConf for sure. --- src/com/massivecraft/factions/ConfServer.java | 15 --------------- src/com/massivecraft/factions/entity/FPlayer.java | 2 +- src/com/massivecraft/factions/entity/MConf.java | 15 +++++++++++++++ .../factions/listeners/FactionsListenerMain.java | 9 +++++---- .../listeners/TodoFactionsPlayerListener.java | 6 +++--- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/com/massivecraft/factions/ConfServer.java b/src/com/massivecraft/factions/ConfServer.java index 48a1441f..1512ffb0 100644 --- a/src/com/massivecraft/factions/ConfServer.java +++ b/src/com/massivecraft/factions/ConfServer.java @@ -32,21 +32,6 @@ public class ConfServer extends SimpleConfig // TODO: Shouldn't this be a constant rather? 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 playersWhoBypassAllProtection = new LinkedHashSet(); - - public static Set worldsNoClaiming = new LinkedHashSet(); - - // TODO: Should worldsNoPowerLoss rather be a bukkit permission node? - public static Set worldsNoPowerLoss = new LinkedHashSet(); - public static Set worldsIgnorePvP = new LinkedHashSet(); - // TODO: A better solution Would be to have One wilderness faction per world. - //public static Set worldsNoWildernessProtection = new LinkedHashSet(); - // -------------------------------------------- // // CORE // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/entity/FPlayer.java b/src/com/massivecraft/factions/entity/FPlayer.java index d8730a88..de976992 100644 --- a/src/com/massivecraft/factions/entity/FPlayer.java +++ b/src/com/massivecraft/factions/entity/FPlayer.java @@ -731,7 +731,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato // Checks for WorldGuard regions in the chunk attempting to be claimed error = Txt.parse("This land is protected"); } - else if (ConfServer.worldsNoClaiming.contains(ps.getWorld())) + else if (MConf.get().worldsNoClaiming.contains(ps.getWorld())) { error = Txt.parse("Sorry, this world has land claiming disabled."); } diff --git a/src/com/massivecraft/factions/entity/MConf.java b/src/com/massivecraft/factions/entity/MConf.java index 5d28683a..a385a27f 100644 --- a/src/com/massivecraft/factions/entity/MConf.java +++ b/src/com/massivecraft/factions/entity/MConf.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.entity; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Set; import org.bukkit.ChatColor; @@ -101,5 +102,19 @@ public class MConf extends Entity public boolean handleExploitInteractionSpam = true; 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 playersWhoBypassAllProtection = new LinkedHashSet(); + + public Set worldsNoClaiming = new LinkedHashSet(); + public Set worldsNoPowerLoss = new LinkedHashSet(); + public Set worldsIgnorePvP = new LinkedHashSet(); } \ No newline at end of file diff --git a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java index 604384d2..acbaa172 100644 --- a/src/com/massivecraft/factions/listeners/FactionsListenerMain.java +++ b/src/com/massivecraft/factions/listeners/FactionsListenerMain.java @@ -54,6 +54,7 @@ import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.FPlayerColl; import com.massivecraft.factions.entity.Faction; +import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.event.FactionsEventPowerChange; import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReason; import com.massivecraft.factions.util.VisualizeUtil; @@ -100,7 +101,7 @@ public class FactionsListenerMain implements Listener return; } - if (ConfServer.worldsNoPowerLoss.contains(player.getWorld().getName())) + if (MConf.get().worldsNoPowerLoss.contains(player.getWorld().getName())) { fplayer.msg("You didn't lose any power due to the world you died in."); return; @@ -204,7 +205,7 @@ public class FactionsListenerMain implements Listener FPlayer fattacker = FPlayerColl.get().get(attacker); // ... 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 ... PS attackerPs = PS.valueOf(attacker); @@ -220,7 +221,7 @@ public class FactionsListenerMain implements Listener } // ... 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 attackFaction = fattacker.getFaction(); @@ -506,7 +507,7 @@ public class FactionsListenerMain implements Listener public static boolean canPlayerBuildAt(Player player, PS ps, boolean justCheck) { String name = player.getName(); - if (ConfServer.playersWhoBypassAllProtection.contains(name)) return true; + if (MConf.get().playersWhoBypassAllProtection.contains(name)) return true; FPlayer me = FPlayer.get(name); if (me.isUsingAdminMode()) return true; diff --git a/src/com/massivecraft/factions/listeners/TodoFactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/TodoFactionsPlayerListener.java index 277716c5..5d4e6d16 100644 --- a/src/com/massivecraft/factions/listeners/TodoFactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/TodoFactionsPlayerListener.java @@ -14,13 +14,13 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerMoveEvent; -import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.Const; import com.massivecraft.factions.FPerm; import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.FPlayer; import com.massivecraft.factions.entity.FPlayerColl; +import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.mcore.event.MCorePlayerLeaveEvent; 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) { 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); if (me.isUsingAdminMode()) return true; @@ -154,7 +154,7 @@ public class TodoFactionsPlayerListener implements Listener public static boolean canPlayerUseBlock(Player player, Block block, boolean justCheck) { 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); if (me.isUsingAdminMode()) return true;