Faction admins can now mark already claimed areas as owned by specific faction members. Ownership can include multiple members. New command /f owner *[player name], to set/remove ownership. This command is only available to the faction admin and optionally the faction moderators. If no player name is specified, it will either set ownership to the player running the command (if no owner is currently set) or completely clear ownership of the territory. New command /f ownerlist, to view a list of owners for the current area. Only works inside your own faction's territory. New conf.json options "ownedAreasEnabled", "ownedAreasModeratorsCanSet", "ownedAreaModeratorsBypass", "ownedAreaDenyBuild", "ownedAreaProtectMaterials", and "ownedAreaDenyUseage" (all defaulting to true) to determine whether faction moderators can set or bypass ownership (faction admin always can), and what sort of protection these owned areas have against normal members of the faction (members other than the owner(s), faction admin, and probably faction moderators). New conf.json option "ownedAreasLimitPerFaction" to limit how many owned areas can be set. New permission node "factions.ownershipBypass" which allows a player to bypass ownership protection, but only within the person's own faction.

various little tweaks and improvements to other code
moderate speed boost to FLocation code
made commandDisable permissions work for any command alias of a command, instead of just the first one
This commit is contained in:
Brettflan
2011-07-30 20:17:00 -05:00
parent 63ab41f933
commit 508f953ce9
16 changed files with 643 additions and 49 deletions

View File

@ -42,6 +42,8 @@ public class Board {
}
public static void setIdAt(int id, FLocation flocation) {
clearOwnershipAt(flocation);
if (id == 0) {
removeAt(flocation);
}
@ -54,10 +56,24 @@ public class Board {
}
public static void removeAt(FLocation flocation) {
clearOwnershipAt(flocation);
flocationIds.remove(flocation);
}
// not to be confused with claims, ownership referring to further member-specific ownership of a claim
public static void clearOwnershipAt(FLocation flocation) {
Faction faction = getFactionAt(flocation);
if (faction != null && faction.isNormal()) {
faction.clearClaimOwnership(flocation);
}
}
public static void unclaimAll(int factionId) {
Faction faction = Faction.get(factionId);
if (faction != null && faction.isNormal()) {
faction.clearAllClaimOwnership();
}
Iterator<Entry<FLocation, Integer>> iter = flocationIds.entrySet().iterator();
while (iter.hasNext()) {
Entry<FLocation, Integer> entry = iter.next();
@ -215,10 +231,13 @@ public class Board {
public static Map<String,Map<String,Integer>> dumpAsSaveFormat() {
Map<String,Map<String,Integer>> worldCoordIds = new HashMap<String,Map<String,Integer>>();
String worldName, coords;
Integer id;
for (Entry<FLocation, Integer> entry : flocationIds.entrySet()) {
String worldName = entry.getKey().getWorldName();
String coords = entry.getKey().getCoordString();
Integer id = entry.getValue();
worldName = entry.getKey().getWorldName();
coords = entry.getKey().getCoordString();
id = entry.getValue();
if ( ! worldCoordIds.containsKey(worldName)) {
worldCoordIds.put(worldName, new TreeMap<String,Integer>());
}
@ -232,13 +251,17 @@ public class Board {
public static void loadFromSaveFormat(Map<String,Map<String,Integer>> worldCoordIds) {
flocationIds.clear();
String worldName;
String[] coords;
int x, z, factionId;
for (Entry<String,Map<String,Integer>> entry : worldCoordIds.entrySet()) {
String worldName = entry.getKey();
worldName = entry.getKey();
for (Entry<String,Integer> entry2 : entry.getValue().entrySet()) {
String[] coords = entry2.getKey().trim().split("[,\\s]+");
int x = Integer.parseInt(coords[0]);
int z = Integer.parseInt(coords[1]);
int factionId = entry2.getValue();
coords = entry2.getKey().trim().split("[,\\s]+");
x = Integer.parseInt(coords[0]);
z = Integer.parseInt(coords[1]);
factionId = entry2.getValue();
flocationIds.put(new FLocation(worldName, x, z), factionId);
}
}