diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 23e54dd4..cfb6664f 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -201,6 +201,7 @@ public class Conf { public static Set worldsNoClaiming = new HashSet(); public static Set worldsNoPowerLoss = new HashSet(); public static Set worldsIgnorePvP = new HashSet(); + public static Set worldsNoWildernessProtection = new HashSet(); public static transient int mapHeight = 8; public static transient int mapWidth = 39; diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index 64849b53..7eeab481 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -116,7 +116,7 @@ public class FactionsBlockListener extends BlockListener { } if (otherFaction.isNone()) { - if (!Conf.wildernessDenyBuild) { + if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName())) { return true; } return false; @@ -158,7 +158,7 @@ public class FactionsBlockListener extends BlockListener { FPlayer me = FPlayer.get(player); if (otherFaction.isNone()) { - if (!Conf.wildernessDenyBuild || Factions.hasPermAdminBypass(player)) { + if (!Conf.wildernessDenyBuild || Factions.hasPermAdminBypass(player) || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) { return true; // This is not faction territory. Use whatever you like here. } me.sendMessage("You can't "+action+" in the wilderness."); diff --git a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java index 190276a8..31aac61f 100644 --- a/src/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -50,7 +50,7 @@ public class FactionsEntityListener extends EntityListener { if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { fplayer.sendMessage("The world you are in has power loss normally disabled, but you still lost power since you were in a war zone."); } - } else if (faction.isNone() && !Conf.wildernessPowerLoss) { + } else if (faction.isNone() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) { fplayer.sendMessage("You didn't lose any power since you were in the wilderness."); return; } else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { @@ -99,7 +99,9 @@ public class FactionsEntityListener extends EntityListener { return; } - Faction faction = Board.getFactionAt(new FLocation(event.getLocation())); + Location loc = event.getLocation(); + + Faction faction = Board.getFactionAt(new FLocation(loc)); boolean online = faction.hasPlayersOnline(); if (faction.noExplosionsInTerritory()) { @@ -107,7 +109,7 @@ public class FactionsEntityListener extends EntityListener { event.setCancelled(true); } else if (event.getEntity() instanceof Creeper && ( - (faction.isNone() && Conf.wildernessBlockCreepers) || + (faction.isNone() && Conf.wildernessBlockCreepers && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || (faction.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) || (faction.isWarZone() && Conf.warZoneBlockCreepers) || faction.isSafeZone() @@ -115,7 +117,7 @@ public class FactionsEntityListener extends EntityListener { // creeper which needs prevention event.setCancelled(true); } else if (event.getEntity() instanceof Fireball && ( - (faction.isNone() && Conf.wildernessBlockFireballs) || + (faction.isNone() && Conf.wildernessBlockFireballs && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || (faction.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) || (faction.isWarZone() && Conf.warZoneBlockFireballs) || faction.isSafeZone() @@ -123,7 +125,7 @@ public class FactionsEntityListener extends EntityListener { // ghast fireball which needs prevention event.setCancelled(true); } else if ( - (faction.isNone() && Conf.wildernessBlockTNT) || + (faction.isNone() && Conf.wildernessBlockTNT && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) || (faction.isNormal() && (online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline)) || (faction.isWarZone() && Conf.warZoneBlockTNT) || (faction.isSafeZone() && Conf.safeZoneBlockTNT) @@ -346,7 +348,7 @@ public class FactionsEntityListener extends EntityListener { FPlayer me = FPlayer.get(player); if (otherFaction.isNone()) { - if (!Conf.wildernessDenyBuild || Factions.hasPermAdminBypass(player)) { + if (!Conf.wildernessDenyBuild || Factions.hasPermAdminBypass(player) || Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) { return true; // This is not faction territory. Use whatever you like here. } me.sendMessage("You can't "+action+" paintings in the wilderness."); diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index e3fe1c2c..6c2b8d01 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -299,7 +299,7 @@ public class FactionsPlayerListener extends PlayerListener{ FPlayer me = FPlayer.get(player); if (otherFaction.isNone()) { - if (!Conf.wildernessDenyUseage || Factions.hasPermAdminBypass(player)) { + if (!Conf.wildernessDenyUseage || Factions.hasPermAdminBypass(player) || Conf.worldsNoWildernessProtection.contains(block.getWorld().getName())) { return true; // This is not faction territory. Use whatever you like here. } me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in the wilderness.");