New conf.json setting "worldsNoWildernessProtection", for worlds in which you don't want wilderness protections to apply

This commit is contained in:
Brettflan 2011-08-23 00:37:31 -05:00
parent 72bf1492c3
commit ef465dfcf4
4 changed files with 12 additions and 9 deletions

View File

@ -201,6 +201,7 @@ public class Conf {
public static Set<String> worldsNoClaiming = new HashSet<String>(); public static Set<String> worldsNoClaiming = new HashSet<String>();
public static Set<String> worldsNoPowerLoss = new HashSet<String>(); public static Set<String> worldsNoPowerLoss = new HashSet<String>();
public static Set<String> worldsIgnorePvP = new HashSet<String>(); public static Set<String> worldsIgnorePvP = new HashSet<String>();
public static Set<String> worldsNoWildernessProtection = new HashSet<String>();
public static transient int mapHeight = 8; public static transient int mapHeight = 8;
public static transient int mapWidth = 39; public static transient int mapWidth = 39;

View File

@ -116,7 +116,7 @@ public class FactionsBlockListener extends BlockListener {
} }
if (otherFaction.isNone()) { if (otherFaction.isNone()) {
if (!Conf.wildernessDenyBuild) { if (!Conf.wildernessDenyBuild || Conf.worldsNoWildernessProtection.contains(target.getWorld().getName())) {
return true; return true;
} }
return false; return false;
@ -158,7 +158,7 @@ public class FactionsBlockListener extends BlockListener {
FPlayer me = FPlayer.get(player); FPlayer me = FPlayer.get(player);
if (otherFaction.isNone()) { 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. return true; // This is not faction territory. Use whatever you like here.
} }
me.sendMessage("You can't "+action+" in the wilderness."); me.sendMessage("You can't "+action+" in the wilderness.");

View File

@ -50,7 +50,7 @@ public class FactionsEntityListener extends EntityListener {
if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { 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."); 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."); fplayer.sendMessage("You didn't lose any power since you were in the wilderness.");
return; return;
} else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { } else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
@ -99,7 +99,9 @@ public class FactionsEntityListener extends EntityListener {
return; return;
} }
Faction faction = Board.getFactionAt(new FLocation(event.getLocation())); Location loc = event.getLocation();
Faction faction = Board.getFactionAt(new FLocation(loc));
boolean online = faction.hasPlayersOnline(); boolean online = faction.hasPlayersOnline();
if (faction.noExplosionsInTerritory()) { if (faction.noExplosionsInTerritory()) {
@ -107,7 +109,7 @@ public class FactionsEntityListener extends EntityListener {
event.setCancelled(true); event.setCancelled(true);
} }
else if (event.getEntity() instanceof Creeper && ( 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.isNormal() && (online ? Conf.territoryBlockCreepers : Conf.territoryBlockCreepersWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockCreepers) || (faction.isWarZone() && Conf.warZoneBlockCreepers) ||
faction.isSafeZone() faction.isSafeZone()
@ -115,7 +117,7 @@ public class FactionsEntityListener extends EntityListener {
// creeper which needs prevention // creeper which needs prevention
event.setCancelled(true); event.setCancelled(true);
} else if (event.getEntity() instanceof Fireball && ( } 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.isNormal() && (online ? Conf.territoryBlockFireballs : Conf.territoryBlockFireballsWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockFireballs) || (faction.isWarZone() && Conf.warZoneBlockFireballs) ||
faction.isSafeZone() faction.isSafeZone()
@ -123,7 +125,7 @@ public class FactionsEntityListener extends EntityListener {
// ghast fireball which needs prevention // ghast fireball which needs prevention
event.setCancelled(true); event.setCancelled(true);
} else if ( } else if (
(faction.isNone() && Conf.wildernessBlockTNT) || (faction.isNone() && Conf.wildernessBlockTNT && !Conf.worldsNoWildernessProtection.contains(loc.getWorld().getName())) ||
(faction.isNormal() && (online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline)) || (faction.isNormal() && (online ? Conf.territoryBlockTNT : Conf.territoryBlockTNTWhenOffline)) ||
(faction.isWarZone() && Conf.warZoneBlockTNT) || (faction.isWarZone() && Conf.warZoneBlockTNT) ||
(faction.isSafeZone() && Conf.safeZoneBlockTNT) (faction.isSafeZone() && Conf.safeZoneBlockTNT)
@ -346,7 +348,7 @@ public class FactionsEntityListener extends EntityListener {
FPlayer me = FPlayer.get(player); FPlayer me = FPlayer.get(player);
if (otherFaction.isNone()) { 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. return true; // This is not faction territory. Use whatever you like here.
} }
me.sendMessage("You can't "+action+" paintings in the wilderness."); me.sendMessage("You can't "+action+" paintings in the wilderness.");

View File

@ -299,7 +299,7 @@ public class FactionsPlayerListener extends PlayerListener{
FPlayer me = FPlayer.get(player); FPlayer me = FPlayer.get(player);
if (otherFaction.isNone()) { 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. return true; // This is not faction territory. Use whatever you like here.
} }
me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in the wilderness."); me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in the wilderness.");