From 85d055739d3f1ffb779cd0ae654e4bcbcadea8b5 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Wed, 1 Jun 2011 18:32:09 -0500 Subject: [PATCH] Added in options to protect all wilderness (unclaimed) areas, in case that's your sort of thing. Also lowered default "territoryShieldFactor" from 0.5 to 0.3, since it seemed a bit overpowered at 0.5. --- src/org/mcteam/factions/Conf.java | 9 ++++++++- .../listeners/FactionsBlockListener.java | 12 ++++++++---- .../listeners/FactionsEntityListener.java | 18 ++++++++++++++---- .../listeners/FactionsPlayerListener.java | 12 ++++++++---- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/org/mcteam/factions/Conf.java b/src/org/mcteam/factions/Conf.java index 8e105714..11e30fdf 100644 --- a/src/org/mcteam/factions/Conf.java +++ b/src/org/mcteam/factions/Conf.java @@ -59,7 +59,7 @@ public class Conf { public static boolean homesTeleportToOnDeath = true; public static double homesTeleportAllowedEnemyDistance = 32; - public static double territoryShieldFactor = 0.5; + public static double territoryShieldFactor = 0.3; public static boolean territoryDenyBuild = true; public static boolean territoryDenyUseage = true; public static boolean territoryBlockCreepers = false; @@ -77,6 +77,13 @@ public class Conf { public static boolean warZoneBlockTNT = true; public static boolean warZonePowerLoss = true; + public static boolean wildernessDenyBuild = false; + public static boolean wildernessDenyUseage = false; + public static boolean wildernessBlockCreepers = false; + public static boolean wildernessBlockFireballs = false; + public static boolean wildernessBlockTNT = false; + public static boolean wildernessPowerLoss = true; + public static Set territoryProtectedMaterials = new HashSet(); public static Set territoryDenyUseageMaterials = new HashSet(); diff --git a/src/org/mcteam/factions/listeners/FactionsBlockListener.java b/src/org/mcteam/factions/listeners/FactionsBlockListener.java index 7935f67d..c4672d53 100644 --- a/src/org/mcteam/factions/listeners/FactionsBlockListener.java +++ b/src/org/mcteam/factions/listeners/FactionsBlockListener.java @@ -60,12 +60,16 @@ public class FactionsBlockListener extends BlockListener { Faction otherFaction = Board.getFactionAt(new FLocation(block)); - if (otherFaction.isNone()) { - return true; - } - FPlayer me = FPlayer.get(player); + if (otherFaction.isNone()) { + if (!Conf.wildernessDenyBuild) { + return true; // This is not faction territory. Use whatever you like here. + } + me.sendMessage("You can't "+action+" in the wilderness."); + return false; + } + if (otherFaction.isSafeZone()) { if (Factions.hasPermManageSafeZone(player) || !Conf.safeZoneDenyBuild) { return true; diff --git a/src/org/mcteam/factions/listeners/FactionsEntityListener.java b/src/org/mcteam/factions/listeners/FactionsEntityListener.java index 5a08e8cf..23764c73 100644 --- a/src/org/mcteam/factions/listeners/FactionsEntityListener.java +++ b/src/org/mcteam/factions/listeners/FactionsEntityListener.java @@ -48,6 +48,9 @@ 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) { + fplayer.sendMessage("You didn't lose any power since you were in the wilderness."); + return; } else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { fplayer.sendMessage("You didn't lose any power due to the world you died in."); return; @@ -97,6 +100,7 @@ public class FactionsEntityListener extends EntityListener { } if (event.getEntity() instanceof Creeper && ( + (faction.isNone() && Conf.wildernessBlockCreepers) || (faction.isNormal() && Conf.territoryBlockCreepers) || (faction.isWarZone() && Conf.warZoneBlockCreepers) || faction.isSafeZone() @@ -104,6 +108,7 @@ public class FactionsEntityListener extends EntityListener { // creeper which needs prevention event.setCancelled(true); } else if (event.getEntity() instanceof Fireball && ( + (faction.isNone() && Conf.wildernessBlockFireballs) || (faction.isNormal() && Conf.territoryBlockFireballs) || (faction.isWarZone() && Conf.warZoneBlockFireballs) || faction.isSafeZone() @@ -111,6 +116,7 @@ public class FactionsEntityListener extends EntityListener { // ghast fireball which needs prevention event.setCancelled(true); } else if ( + (faction.isNone() && Conf.wildernessBlockTNT) || (faction.isNormal() && Conf.territoryBlockTNT) || (faction.isWarZone() && Conf.warZoneBlockTNT) || (faction.isSafeZone() && Conf.safeZoneBlockTNT) @@ -263,12 +269,16 @@ public class FactionsEntityListener extends EntityListener { Faction otherFaction = Board.getFactionAt(loc); - if (otherFaction.isNone()) { - return true; - } - FPlayer me = FPlayer.get(player); + if (otherFaction.isNone()) { + if (!Conf.wildernessDenyBuild) { + return true; // This is not faction territory. Use whatever you like here. + } + me.sendMessage("You can't "+action+" paintings in the wilderness."); + return false; + } + if (otherFaction.isSafeZone()) { if (Factions.hasPermManageSafeZone(player) || !Conf.safeZoneDenyBuild) { return true; diff --git a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java index 2e81f13f..4ed71638 100644 --- a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java +++ b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java @@ -187,11 +187,15 @@ public class FactionsPlayerListener extends PlayerListener{ Faction otherFaction = Board.getFactionAt(new FLocation(block)); - if (otherFaction.isNone()) { - return true; // This is not faction territory. Use whatever you like here. - } - FPlayer me = FPlayer.get(player); + + if (otherFaction.isNone()) { + if (!Conf.wildernessDenyUseage) { + return true; // This is not faction territory. Use whatever you like here. + } + me.sendMessage("You can't use "+TextUtil.getMaterialName(material)+" in the wilderness."); + return false; + } if (otherFaction.isSafeZone() && Conf.safeZoneDenyUseage) { if (Factions.hasPermManageSafeZone(player)) {