This commit is contained in:
Brettflan 2011-06-05 22:04:08 -05:00
commit 3b5471d465
3 changed files with 33 additions and 10 deletions

View File

@ -90,6 +90,8 @@ public class Conf {
public static Set<Material> territoryProtectedMaterials = new HashSet<Material>();
public static Set<Material> territoryDenyUseageMaterials = new HashSet<Material>();
public static Set<Material> territoryProtectedMaterialsWhenOffline = new HashSet<Material>();
public static Set<Material> territoryDenyUseageMaterialsWhenOffline = new HashSet<Material>();
public static transient Set<CreatureType> safeZoneNerfedCreatureTypes = new HashSet<CreatureType>();
@ -112,6 +114,17 @@ public class Conf {
territoryDenyUseageMaterials.add(Material.WATER_BUCKET);
territoryDenyUseageMaterials.add(Material.LAVA_BUCKET);
territoryProtectedMaterialsWhenOffline.add(Material.WOODEN_DOOR);
territoryProtectedMaterialsWhenOffline.add(Material.TRAP_DOOR);
territoryProtectedMaterialsWhenOffline.add(Material.DISPENSER);
territoryProtectedMaterialsWhenOffline.add(Material.CHEST);
territoryProtectedMaterialsWhenOffline.add(Material.FURNACE);
territoryDenyUseageMaterialsWhenOffline.add(Material.FLINT_AND_STEEL);
territoryDenyUseageMaterialsWhenOffline.add(Material.BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.WATER_BUCKET);
territoryDenyUseageMaterialsWhenOffline.add(Material.LAVA_BUCKET);
safeZoneNerfedCreatureTypes.add(CreatureType.CREEPER);
safeZoneNerfedCreatureTypes.add(CreatureType.GHAST);
safeZoneNerfedCreatureTypes.add(CreatureType.PIG_ZOMBIE);

View File

@ -24,7 +24,6 @@ import org.mcteam.factions.gson.GsonBuilder;
import org.mcteam.factions.listeners.FactionsBlockListener;
import org.mcteam.factions.listeners.FactionsEntityListener;
import org.mcteam.factions.listeners.FactionsPlayerListener;
import org.mcteam.factions.util.MiscUtil;
import com.nijiko.permissions.PermissionHandler;
@ -57,8 +56,6 @@ public class Factions extends JavaPlugin {
private String baseCommand;
private static boolean lock = false;
public Factions() {
Factions.instance = this;
}

View File

@ -202,12 +202,18 @@ public class FactionsPlayerListener extends PlayerListener{
return true;
}
if ( ! Conf.territoryDenyUseageMaterials.contains(material)) {
return true; // Item isn't one we're preventing.
}
Faction otherFaction = Board.getFactionAt(new FLocation(block));
if (otherFaction.getOnlinePlayers()!=null){
if ( ! Conf.territoryDenyUseageMaterials.contains(material)) {
return true; // Item isn't one we're preventing for online factions.
}
}else{
if ( ! Conf.territoryDenyUseageMaterialsWhenOffline.contains(material)) {
return true; // Item isn't one we're preventing for offline factions.
}
}
FPlayer me = FPlayer.get(player);
if (otherFaction.isNone()) {
@ -252,14 +258,21 @@ public class FactionsPlayerListener extends PlayerListener{
Material material = block.getType();
Faction otherFaction = Board.getFactionAt(new FLocation(block));
// We only care about some material types.
if ( ! Conf.territoryProtectedMaterials.contains(material)) {
return true;
if (otherFaction.getOnlinePlayers()!=null){
if ( ! Conf.territoryProtectedMaterials.contains(material)) {
return true;
}
} else {
if ( ! Conf.territoryProtectedMaterialsWhenOffline.contains(material)) {
return true;
}
}
FPlayer me = FPlayer.get(player);
Faction myFaction = me.getFaction();
Faction otherFaction = Board.getFactionAt(new FLocation(block));
// In safe zones you may use any block...
if (otherFaction.isNormal() && myFaction != otherFaction) {