From e573895d8a5d635e7cd8a046dabcb1d6f92fc36b Mon Sep 17 00:00:00 2001 From: Brettflan Date: Mon, 22 Aug 2011 23:31:37 -0500 Subject: [PATCH] Added owner list display for faction members when moving between to/from claimed chunks which have owners set (code by Zidkon) --- src/com/massivecraft/factions/Conf.java | 26 ++++++++++++------- .../listeners/FactionsPlayerListener.java | 18 ++++++++++++- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/com/massivecraft/factions/Conf.java b/src/com/massivecraft/factions/Conf.java index 7180f944..17bf6b1f 100644 --- a/src/com/massivecraft/factions/Conf.java +++ b/src/com/massivecraft/factions/Conf.java @@ -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 territoryProtectedMaterials = EnumSet.noneOf(Material.class); diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 14f575bf..c8d814b1 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -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); + } + } } }