Added further "offline" options for preventing the 3 explosion types in faction territory; also fix for safe zone and war zone autoclaim bug

This commit is contained in:
Brettflan 2011-06-10 18:47:39 -05:00
parent e023e9de91
commit 4cc13707cc
3 changed files with 12 additions and 5 deletions

View File

@ -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;

View File

@ -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)
) {

View File

@ -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);