From b912b492899d2ad281cbb3e947fba73effbe7e76 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Mon, 4 Apr 2011 06:31:48 -0500 Subject: [PATCH] New boolean config options territoryBlockTNT (default false), safeZoneDenyBuild (default true), safeZoneDenyUseage (default true), safeZoneBlockTNT (default true). territoryBlockTNT prevents TNT explosions inside faction territory, which defaults to false (same as before). It prevents TNT cannons from being a viable tactic, and I think for most people it would be an undesirable option. safeZoneBlockTNT prevents TNT explosions inside safe zone areas, which defaults to true (new behavior). I think most server operators would prefer safe zones to be safe from TNT, from TNT cannons or otherwise. safeZoneDenyBuild prevents players from building inside safe zone areas, which defaults to true (same as before). This option is added for server admins who, for whatever reason, want to let their players build and break inside safe zone areas. safeZoneDenyUseage prevents players from using items in the territoryDenyUseageMaterials list, which defaults to true (new behavior). This will (with the default list) prevent players from dumping/using buckets inside safe zone areas. --- plugin.yml | 2 +- src/com/bukkit/mcteam/factions/Conf.java | 5 +++++ .../mcteam/factions/listeners/FactionsBlockListener.java | 2 +- .../mcteam/factions/listeners/FactionsEntityListener.java | 4 +++- .../mcteam/factions/listeners/FactionsPlayerListener.java | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/plugin.yml b/plugin.yml index 64801178..9e6f135e 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: Factions -version: 1.1.3 +version: 1.1.4 main: com.bukkit.mcteam.factions.Factions commands: f: diff --git a/src/com/bukkit/mcteam/factions/Conf.java b/src/com/bukkit/mcteam/factions/Conf.java index 1f1b50bf..4397a7eb 100644 --- a/src/com/bukkit/mcteam/factions/Conf.java +++ b/src/com/bukkit/mcteam/factions/Conf.java @@ -53,6 +53,11 @@ public class Conf { public static double territoryShieldFactor = 0.5; public static boolean territoryBlockCreepers = false; public static boolean territoryBlockFireballs = false; + public static boolean territoryBlockTNT = false; + + public static boolean safeZoneDenyBuild = true; + public static boolean safeZoneDenyUseage = true; + public static boolean safeZoneBlockTNT = true; public static Set territoryProtectedMaterials = new HashSet(); public static Set territoryDenyUseageMaterials = new HashSet(); diff --git a/src/com/bukkit/mcteam/factions/listeners/FactionsBlockListener.java b/src/com/bukkit/mcteam/factions/listeners/FactionsBlockListener.java index 4cfee8c4..309a5f93 100644 --- a/src/com/bukkit/mcteam/factions/listeners/FactionsBlockListener.java +++ b/src/com/bukkit/mcteam/factions/listeners/FactionsBlockListener.java @@ -64,7 +64,7 @@ public class FactionsBlockListener extends BlockListener { FPlayer me = FPlayer.get(player); if (otherFaction.isSafeZone()) { - if (Factions.hasPermManageSafeZone(player)) { + if (Factions.hasPermManageSafeZone(player) || !Conf.safeZoneDenyBuild) { return true; } me.sendMessage("You can't "+action+" in a safe zone."); diff --git a/src/com/bukkit/mcteam/factions/listeners/FactionsEntityListener.java b/src/com/bukkit/mcteam/factions/listeners/FactionsEntityListener.java index ab67a252..cbda20e3 100644 --- a/src/com/bukkit/mcteam/factions/listeners/FactionsEntityListener.java +++ b/src/com/bukkit/mcteam/factions/listeners/FactionsEntityListener.java @@ -65,7 +65,6 @@ public class FactionsEntityListener extends EntityListener { } - // TODO what happens with the creeper or fireball then? Must we delete them manually? @Override public void onEntityExplode(EntityExplodeEvent event) { @@ -86,6 +85,9 @@ public class FactionsEntityListener extends EntityListener { } else if ((Conf.territoryBlockFireballs || faction.isSafeZone()) && event.getEntity() instanceof Fireball) { // ghast fireball which might need prevention, if inside faction territory event.setCancelled(true); + } else if (Conf.territoryBlockTNT || (faction.isSafeZone() && Conf.safeZoneBlockTNT)) { + // we'll assume it's TNT, which might need prevention, if inside faction territory or safe zone + event.setCancelled(true); } } diff --git a/src/com/bukkit/mcteam/factions/listeners/FactionsPlayerListener.java b/src/com/bukkit/mcteam/factions/listeners/FactionsPlayerListener.java index b08f0476..5bb8376a 100644 --- a/src/com/bukkit/mcteam/factions/listeners/FactionsPlayerListener.java +++ b/src/com/bukkit/mcteam/factions/listeners/FactionsPlayerListener.java @@ -171,7 +171,7 @@ public class FactionsPlayerListener extends PlayerListener{ FPlayer me = FPlayer.get(player); - if (otherFaction.isSafeZone()) { + if (otherFaction.isSafeZone() && Conf.safeZoneDenyUseage) { if (Factions.hasPermManageSafeZone(player)) { return true; }