From 4cc13707cc32311ddd9f3c834bdbfbd61d4a1052 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Fri, 10 Jun 2011 18:47:39 -0500 Subject: [PATCH] Added further "offline" options for preventing the 3 explosion types in faction territory; also fix for safe zone and war zone autoclaim bug --- src/org/mcteam/factions/Conf.java | 3 +++ .../factions/listeners/FactionsEntityListener.java | 10 +++++++--- .../factions/listeners/FactionsPlayerListener.java | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/org/mcteam/factions/Conf.java b/src/org/mcteam/factions/Conf.java index 494a40bb..aba92d45 100644 --- a/src/org/mcteam/factions/Conf.java +++ b/src/org/mcteam/factions/Conf.java @@ -68,8 +68,11 @@ public class Conf { public static boolean territoryDenyBuildWhenOffline = true; public static boolean territoryDenyUseage = true; public static boolean territoryBlockCreepers = false; + public static boolean territoryBlockCreepersWhenOffline = false; public static boolean territoryBlockFireballs = false; + public static boolean territoryBlockFireballsWhenOffline = false; public static boolean territoryBlockTNT = false; + public static boolean territoryBlockTNTWhenOffline = false; public static boolean safeZoneDenyBuild = true; public static boolean safeZoneDenyUseage = true; diff --git a/src/org/mcteam/factions/listeners/FactionsEntityListener.java b/src/org/mcteam/factions/listeners/FactionsEntityListener.java index 81a5ff4a..59ede7c6 100644 --- a/src/org/mcteam/factions/listeners/FactionsEntityListener.java +++ b/src/org/mcteam/factions/listeners/FactionsEntityListener.java @@ -93,10 +93,12 @@ public class FactionsEntityListener extends EntityListener { } Faction faction = Board.getFactionAt(new FLocation(event.getLocation())); + boolean online = faction.HasPlayersOnline(); if (event.getEntity() instanceof Creeper && ( (faction.isNone() && Conf.wildernessBlockCreepers) || - (faction.isNormal() && Conf.territoryBlockCreepers) || + (faction.isNormal() && online && Conf.territoryBlockCreepers) || + (faction.isNormal() && !online && Conf.territoryBlockCreepersWhenOffline) || (faction.isWarZone() && Conf.warZoneBlockCreepers) || faction.isSafeZone() )) { @@ -104,7 +106,8 @@ public class FactionsEntityListener extends EntityListener { event.setCancelled(true); } else if (event.getEntity() instanceof Fireball && ( (faction.isNone() && Conf.wildernessBlockFireballs) || - (faction.isNormal() && Conf.territoryBlockFireballs) || + (faction.isNormal() && online && Conf.territoryBlockFireballs) || + (faction.isNormal() && !online && Conf.territoryBlockFireballsWhenOffline) || (faction.isWarZone() && Conf.warZoneBlockFireballs) || faction.isSafeZone() )) { @@ -112,7 +115,8 @@ public class FactionsEntityListener extends EntityListener { event.setCancelled(true); } else if ( (faction.isNone() && Conf.wildernessBlockTNT) || - (faction.isNormal() && Conf.territoryBlockTNT) || + (faction.isNormal() && online && Conf.territoryBlockTNT) || + (faction.isNormal() && !online && Conf.territoryBlockTNTWhenOffline) || (faction.isWarZone() && Conf.warZoneBlockTNT) || (faction.isSafeZone() && Conf.safeZoneBlockTNT) ) { diff --git a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java index 931a4733..073d8f35 100644 --- a/src/org/mcteam/factions/listeners/FactionsPlayerListener.java +++ b/src/org/mcteam/factions/listeners/FactionsPlayerListener.java @@ -186,7 +186,7 @@ public class FactionsPlayerListener extends PlayerListener{ me.attemptClaim(false); } else if (me.autoSafeZoneEnabled()) { - if (!Factions.hasPermManageSafeZone((CommandSender)me)) { + if (!Factions.hasPermManageSafeZone((CommandSender)event.getPlayer())) { me.enableAutoSafeZone(false); } else { FLocation playerFlocation = new FLocation(me); @@ -198,7 +198,7 @@ public class FactionsPlayerListener extends PlayerListener{ } } else if (me.autoWarZoneEnabled()) { - if (!Factions.hasPermManageWarZone((CommandSender)me)) { + if (!Factions.hasPermManageWarZone((CommandSender)event.getPlayer())) { me.enableAutoWarZone(false); } else { FLocation playerFlocation = new FLocation(me);