Added owner list display for faction members when moving between to/from claimed chunks which have owners set (code by Zidkon)

This commit is contained in:
Brettflan 2011-08-22 23:31:37 -05:00
parent 55a1003ebb
commit e573895d8a
2 changed files with 33 additions and 11 deletions

View File

@ -112,16 +112,6 @@ public class Conf {
public static boolean territoryBlockTNT = false;
public static boolean territoryBlockTNTWhenOffline = false;
// for claimed areas where further faction-member ownership can be defined
public static boolean ownedAreasEnabled = true;
public static int ownedAreasLimitPerFaction = 0;
public static boolean ownedAreasModeratorsCanSet = false;
public static boolean ownedAreaModeratorsBypass = true;
public static boolean ownedAreaDenyBuild = true;
public static boolean ownedAreaPainBuild = false;
public static boolean ownedAreaProtectMaterials = true;
public static boolean ownedAreaDenyUseage = true;
public static boolean safeZoneDenyBuild = true;
public static boolean safeZoneDenyUseage = true;
public static boolean safeZoneBlockTNT = true;
@ -142,6 +132,22 @@ public class Conf {
public static boolean wildernessBlockTNT = false;
public static boolean wildernessPowerLoss = true;
// for claimed areas where further faction-member ownership can be defined
public static boolean ownedAreasEnabled = true;
public static int ownedAreasLimitPerFaction = 0;
public static boolean ownedAreasModeratorsCanSet = false;
public static boolean ownedAreaModeratorsBypass = true;
public static boolean ownedAreaDenyBuild = true;
public static boolean ownedAreaPainBuild = false;
public static boolean ownedAreaProtectMaterials = true;
public static boolean ownedAreaDenyUseage = true;
public static String ownedLandMessage = "Owner(s): ";
public static String publicLandMessage = "Public faction land.";
public static boolean ownedMessageOnBorder = true;
public static boolean ownedMessageInsideTerritory = true;
public static boolean ownedMessageByChunk = false;
public static boolean pistonProtectionThroughDenyBuild = true;
public static Set<Material> territoryProtectedMaterials = EnumSet.noneOf(Material.class);

View File

@ -170,8 +170,24 @@ public class FactionsPlayerListener extends PlayerListener{
// Did we change "host"(faction)?
Faction factionFrom = Board.getFactionAt(from);
Faction factionTo = Board.getFactionAt(to);
if ( factionFrom != factionTo) {
Faction myFaction = me.getFaction();
String ownersTo = myFaction.getOwnerListString(to);
if (factionFrom != factionTo) {
me.sendFactionHereMessage();
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder && myFaction == factionTo && !ownersTo.isEmpty()) {
me.sendMessage(Conf.ownedLandMessage+ownersTo);
}
}
else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && factionFrom == factionTo && myFaction == factionTo) {
String ownersFrom = myFaction.getOwnerListString(from);
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) {
if (!ownersTo.isEmpty()) {
me.sendMessage(Conf.ownedLandMessage+ownersTo);
}
else if (!Conf.publicLandMessage.isEmpty()) {
me.sendMessage(Conf.publicLandMessage);
}
}
}
}