2011-07-18 22:06:02 +02:00
|
|
|
package com.massivecraft.factions;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-03-26 15:01:48 +01:00
|
|
|
import java.io.*;
|
2011-03-18 17:33:23 +01:00
|
|
|
import java.lang.reflect.Type;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Map;
|
2011-02-06 13:36:11 +01:00
|
|
|
import java.util.Map.Entry;
|
2011-03-23 12:45:21 +01:00
|
|
|
import java.util.TreeMap;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
2011-10-25 21:18:08 +02:00
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.block.Block;
|
2011-07-18 22:06:02 +02:00
|
|
|
|
2011-07-27 22:56:45 +02:00
|
|
|
import com.google.gson.reflect.TypeToken;
|
2012-01-15 19:41:33 +01:00
|
|
|
import com.massivecraft.factions.integration.LWCFeatures;
|
2011-10-24 09:28:08 +02:00
|
|
|
import com.massivecraft.factions.iface.RelationParticipator;
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
import com.massivecraft.factions.struct.TerritoryAccess;
|
2011-07-18 22:06:02 +02:00
|
|
|
import com.massivecraft.factions.util.AsciiCompass;
|
2011-10-08 23:22:02 +02:00
|
|
|
import com.massivecraft.factions.zcore.util.DiscUtil;
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
|
2011-10-08 22:03:44 +02:00
|
|
|
public class Board
|
|
|
|
{
|
|
|
|
private static transient File file = new File(P.p.getDataFolder(), "board.json");
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
private static transient HashMap<FLocation, TerritoryAccess> flocationIds = new HashMap<FLocation, TerritoryAccess>();
|
2011-03-18 17:33:23 +01:00
|
|
|
|
2011-03-19 13:00:03 +01:00
|
|
|
//----------------------------------------------//
|
|
|
|
// Get and Set
|
|
|
|
//----------------------------------------------//
|
2011-10-08 23:22:02 +02:00
|
|
|
public static String getIdAt(FLocation flocation)
|
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
if ( ! flocationIds.containsKey(flocation)) return "0";
|
2011-03-19 13:00:03 +01:00
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
return flocationIds.get(flocation).getHostFactionID();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static TerritoryAccess getTerritoryAccessAt(FLocation flocation)
|
|
|
|
{
|
|
|
|
if ( ! flocationIds.containsKey(flocation))
|
|
|
|
flocationIds.put(flocation, new TerritoryAccess("0"));
|
2011-03-23 12:45:21 +01:00
|
|
|
return flocationIds.get(flocation);
|
2011-03-18 17:33:23 +01:00
|
|
|
}
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static Faction getFactionAt(FLocation flocation)
|
|
|
|
{
|
|
|
|
return Factions.i.get(getIdAt(flocation));
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
2011-10-25 21:18:08 +02:00
|
|
|
public static Faction getFactionAt(Location location)
|
|
|
|
{
|
|
|
|
return getFactionAt(new FLocation(location));
|
|
|
|
}
|
|
|
|
public static Faction getFactionAt(Block block)
|
|
|
|
{
|
|
|
|
return getFactionAt(new FLocation(block));
|
|
|
|
}
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static void setIdAt(String id, FLocation flocation)
|
|
|
|
{
|
|
|
|
if (id == "0")
|
2011-03-19 13:00:03 +01:00
|
|
|
removeAt(flocation);
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
|
|
|
|
flocationIds.put(flocation, new TerritoryAccess(id));
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static void setFactionAt(Faction faction, FLocation flocation)
|
|
|
|
{
|
2011-03-22 17:20:21 +01:00
|
|
|
setIdAt(faction.getId(), flocation);
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static void removeAt(FLocation flocation)
|
|
|
|
{
|
2012-01-15 19:41:33 +01:00
|
|
|
if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
|
|
|
LWCFeatures.clearAllChests(flocation);
|
|
|
|
|
2011-03-23 12:45:21 +01:00
|
|
|
flocationIds.remove(flocation);
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
2011-04-08 16:22:00 +02:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static void unclaimAll(String factionId)
|
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Iterator<Entry<FLocation, TerritoryAccess>> iter = flocationIds.entrySet().iterator();
|
2011-10-08 23:22:02 +02:00
|
|
|
while (iter.hasNext())
|
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Entry<FLocation, TerritoryAccess> entry = iter.next();
|
|
|
|
if (entry.getValue().getHostFactionID().equals(factionId))
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
2012-03-02 02:16:45 +01:00
|
|
|
if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
|
|
|
LWCFeatures.clearAllChests(entry.getKey());
|
2012-01-15 19:41:33 +01:00
|
|
|
|
2012-03-02 02:16:45 +01:00
|
|
|
iter.remove();
|
2011-04-08 16:22:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-03-19 13:00:03 +01:00
|
|
|
|
2011-02-12 18:05:05 +01:00
|
|
|
// Is this coord NOT completely surrounded by coords claimed by the same faction?
|
|
|
|
// Simpler: Is there any nearby coord with a faction other than the faction here?
|
2011-10-08 23:22:02 +02:00
|
|
|
public static boolean isBorderLocation(FLocation flocation)
|
|
|
|
{
|
2011-03-19 13:00:03 +01:00
|
|
|
Faction faction = getFactionAt(flocation);
|
|
|
|
FLocation a = flocation.getRelative(1, 0);
|
|
|
|
FLocation b = flocation.getRelative(-1, 0);
|
|
|
|
FLocation c = flocation.getRelative(0, 1);
|
|
|
|
FLocation d = flocation.getRelative(0, -1);
|
|
|
|
return faction != getFactionAt(a) || faction != getFactionAt(b) || faction != getFactionAt(c) || faction != getFactionAt(d);
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
2011-06-21 04:15:41 +02:00
|
|
|
|
|
|
|
// Is this coord connected to any coord claimed by the specified faction?
|
2011-10-08 23:22:02 +02:00
|
|
|
public static boolean isConnectedLocation(FLocation flocation, Faction faction)
|
|
|
|
{
|
2011-06-21 04:15:41 +02:00
|
|
|
FLocation a = flocation.getRelative(1, 0);
|
|
|
|
FLocation b = flocation.getRelative(-1, 0);
|
|
|
|
FLocation c = flocation.getRelative(0, 1);
|
|
|
|
FLocation d = flocation.getRelative(0, -1);
|
|
|
|
return faction == getFactionAt(a) || faction == getFactionAt(b) || faction == getFactionAt(c) || faction == getFactionAt(d);
|
|
|
|
}
|
2011-02-06 13:36:11 +01:00
|
|
|
|
2011-03-19 13:00:03 +01:00
|
|
|
|
2011-02-13 11:18:08 +01:00
|
|
|
//----------------------------------------------//
|
2011-03-19 13:00:03 +01:00
|
|
|
// Cleaner. Remove orphaned foreign keys
|
2011-02-13 11:18:08 +01:00
|
|
|
//----------------------------------------------//
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static void clean()
|
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Iterator<Entry<FLocation, TerritoryAccess>> iter = flocationIds.entrySet().iterator();
|
2011-03-23 12:45:21 +01:00
|
|
|
while (iter.hasNext()) {
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Entry<FLocation, TerritoryAccess> entry = iter.next();
|
|
|
|
if ( ! Factions.i.exists(entry.getValue().getHostFactionID()))
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
2012-01-15 19:41:33 +01:00
|
|
|
if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
|
|
|
LWCFeatures.clearAllChests(entry.getKey());
|
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
P.p.log("Board cleaner removed "+entry.getValue().getHostFactionID()+" from "+entry.getKey());
|
2011-03-23 12:45:21 +01:00
|
|
|
iter.remove();
|
2011-02-13 15:18:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-13 11:18:08 +01:00
|
|
|
//----------------------------------------------//
|
|
|
|
// Coord count
|
|
|
|
//----------------------------------------------//
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static int getFactionCoordCount(String factionId)
|
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
int ret = 0;
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
for (TerritoryAccess thatFactionId : flocationIds.values())
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
if(thatFactionId.getHostFactionID().equals(factionId))
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
2011-03-23 12:45:21 +01:00
|
|
|
ret += 1;
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2011-02-13 11:18:08 +01:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static int getFactionCoordCount(Faction faction)
|
|
|
|
{
|
2011-03-22 17:20:21 +01:00
|
|
|
return getFactionCoordCount(faction.getId());
|
2011-02-13 11:18:08 +01:00
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static int getFactionCoordCountInWorld(Faction faction, String worldName)
|
|
|
|
{
|
|
|
|
String factionId = faction.getId();
|
2011-06-30 13:13:47 +02:00
|
|
|
int ret = 0;
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Iterator<Entry<FLocation, TerritoryAccess>> iter = flocationIds.entrySet().iterator();
|
2011-06-30 13:13:47 +02:00
|
|
|
while (iter.hasNext()) {
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Entry<FLocation, TerritoryAccess> entry = iter.next();
|
|
|
|
if (entry.getValue().getHostFactionID().equals(factionId) && entry.getKey().getWorldName().equals(worldName))
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
2011-06-30 13:13:47 +02:00
|
|
|
ret += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
//----------------------------------------------//
|
|
|
|
// Map generation
|
|
|
|
//----------------------------------------------//
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The map is relative to a coord and a faction
|
|
|
|
* north is in the direction of decreasing x
|
|
|
|
* east is in the direction of decreasing z
|
|
|
|
*/
|
2011-10-24 09:28:08 +02:00
|
|
|
public static ArrayList<String> getMap(RelationParticipator observer, FLocation flocation, double inDegrees)
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
ArrayList<String> ret = new ArrayList<String>();
|
2011-08-02 02:59:48 +02:00
|
|
|
Faction factionLoc = getFactionAt(flocation);
|
2011-10-24 09:28:08 +02:00
|
|
|
ret.add(P.p.txt.titleize("("+flocation.getCoordString()+") "+factionLoc.getTag(observer)));
|
2011-02-06 13:36:11 +01:00
|
|
|
|
|
|
|
int halfWidth = Conf.mapWidth / 2;
|
|
|
|
int halfHeight = Conf.mapHeight / 2;
|
2012-01-13 10:18:34 +01:00
|
|
|
FLocation topLeft = flocation.getRelative(-halfWidth, -halfHeight);
|
2011-02-06 13:36:11 +01:00
|
|
|
int width = halfWidth * 2 + 1;
|
|
|
|
int height = halfHeight * 2 + 1;
|
|
|
|
|
2011-10-24 11:07:06 +02:00
|
|
|
//Make room for the list of tags
|
|
|
|
height--;
|
|
|
|
|
2011-05-29 23:28:29 +02:00
|
|
|
|
2011-10-24 09:28:08 +02:00
|
|
|
Map<Faction, Character> fList = new HashMap<Faction, Character>();
|
2011-05-29 23:28:29 +02:00
|
|
|
int chrIdx = 0;
|
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
// For each row
|
2012-01-13 10:18:34 +01:00
|
|
|
for (int dz = 0; dz < height; dz++)
|
2011-10-22 17:18:44 +02:00
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
// Draw and add that row
|
|
|
|
String row = "";
|
2012-01-13 10:18:34 +01:00
|
|
|
for (int dx = 0; dx < width; dx++)
|
2011-10-22 17:18:44 +02:00
|
|
|
{
|
2012-01-13 10:18:34 +01:00
|
|
|
if(dx == halfWidth && dz == halfHeight)
|
2011-10-22 17:18:44 +02:00
|
|
|
{
|
2011-02-06 13:36:11 +01:00
|
|
|
row += ChatColor.AQUA+"+";
|
2011-10-24 09:28:08 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
FLocation flocationHere = topLeft.getRelative(dx, dz);
|
|
|
|
Faction factionHere = getFactionAt(flocationHere);
|
|
|
|
if (factionHere.isNone())
|
|
|
|
{
|
|
|
|
row += ChatColor.GRAY+"-";
|
2011-10-22 17:18:44 +02:00
|
|
|
}
|
2011-10-24 11:07:06 +02:00
|
|
|
else
|
2011-10-22 17:18:44 +02:00
|
|
|
{
|
2011-10-24 11:07:06 +02:00
|
|
|
if (!fList.containsKey(factionHere))
|
2011-10-24 09:28:08 +02:00
|
|
|
fList.put(factionHere, Conf.mapKeyChrs[chrIdx++]);
|
2011-10-24 11:07:06 +02:00
|
|
|
char fchar = fList.get(factionHere);
|
|
|
|
row += factionHere.getColorTo(observer) + "" + fchar;
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ret.add(row);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the compass
|
2011-10-08 23:22:02 +02:00
|
|
|
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, P.p.txt.parse("<a>"));
|
2011-02-07 21:42:14 +01:00
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
// Add the compass
|
|
|
|
ret.set(1, asciiCompass.get(0)+ret.get(1).substring(3*3));
|
|
|
|
ret.set(2, asciiCompass.get(1)+ret.get(2).substring(3*3));
|
|
|
|
ret.set(3, asciiCompass.get(2)+ret.get(3).substring(3*3));
|
2011-10-24 09:28:08 +02:00
|
|
|
|
|
|
|
String fRow = "";
|
|
|
|
for(Faction keyfaction : fList.keySet())
|
2011-10-21 20:08:54 +02:00
|
|
|
{
|
2011-10-24 11:07:06 +02:00
|
|
|
fRow += ""+keyfaction.getColorTo(observer) + fList.get(keyfaction) + ": " + keyfaction.getTag() + " ";
|
2011-05-29 23:28:29 +02:00
|
|
|
}
|
2011-10-24 11:07:06 +02:00
|
|
|
fRow = fRow.trim();
|
2011-10-24 09:28:08 +02:00
|
|
|
ret.add(fRow);
|
2011-05-29 23:28:29 +02:00
|
|
|
|
2011-02-06 13:36:11 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// Persistance
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
public static Map<String,Map<String,TerritoryAccess>> dumpAsSaveFormat()
|
2011-10-22 17:18:44 +02:00
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Map<String,Map<String,TerritoryAccess>> worldCoordIds = new HashMap<String,Map<String,TerritoryAccess>>();
|
2011-03-23 12:45:21 +01:00
|
|
|
|
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
2011-07-31 03:17:00 +02:00
|
|
|
String worldName, coords;
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
TerritoryAccess data;
|
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
2011-07-31 03:17:00 +02:00
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
for (Entry<FLocation, TerritoryAccess> entry : flocationIds.entrySet())
|
2011-10-22 17:18:44 +02:00
|
|
|
{
|
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
2011-07-31 03:17:00 +02:00
|
|
|
worldName = entry.getKey().getWorldName();
|
|
|
|
coords = entry.getKey().getCoordString();
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
data = entry.getValue();
|
2011-10-22 17:18:44 +02:00
|
|
|
if ( ! worldCoordIds.containsKey(worldName))
|
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
worldCoordIds.put(worldName, new TreeMap<String,TerritoryAccess>());
|
2011-03-23 12:45:21 +01:00
|
|
|
}
|
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
worldCoordIds.get(worldName).put(coords, data);
|
2011-03-23 12:45:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return worldCoordIds;
|
|
|
|
}
|
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
public static void loadFromSaveFormat(Map<String,Map<String,TerritoryAccess>> worldCoordIds)
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
2011-03-23 12:45:21 +01:00
|
|
|
flocationIds.clear();
|
|
|
|
|
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
2011-07-31 03:17:00 +02:00
|
|
|
String worldName;
|
|
|
|
String[] coords;
|
2011-10-08 23:22:02 +02:00
|
|
|
int x, z;
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
TerritoryAccess data;
|
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
2011-07-31 03:17:00 +02:00
|
|
|
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
for (Entry<String,Map<String,TerritoryAccess>> entry : worldCoordIds.entrySet())
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
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
2011-07-31 03:17:00 +02:00
|
|
|
worldName = entry.getKey();
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
for (Entry<String,TerritoryAccess> entry2 : entry.getValue().entrySet())
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
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
2011-07-31 03:17:00 +02:00
|
|
|
coords = entry2.getKey().trim().split("[,\\s]+");
|
|
|
|
x = Integer.parseInt(coords[0]);
|
|
|
|
z = Integer.parseInt(coords[1]);
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
data = entry2.getValue();
|
|
|
|
flocationIds.put(new FLocation(worldName, x, z), data);
|
2011-03-23 12:45:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static boolean save()
|
|
|
|
{
|
2011-03-22 22:31:04 +01:00
|
|
|
//Factions.log("Saving board to disk");
|
2011-03-18 17:33:23 +01:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
try
|
|
|
|
{
|
2011-10-08 22:03:44 +02:00
|
|
|
DiscUtil.write(file, P.p.gson.toJson(dumpAsSaveFormat()));
|
2011-10-08 23:22:02 +02:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2011-03-18 17:33:23 +01:00
|
|
|
e.printStackTrace();
|
2011-10-08 23:22:02 +02:00
|
|
|
P.p.log("Failed to save the board to disk.");
|
2011-03-18 17:33:23 +01:00
|
|
|
return false;
|
|
|
|
}
|
2011-03-23 12:45:21 +01:00
|
|
|
|
2011-03-18 17:33:23 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public static boolean load()
|
|
|
|
{
|
|
|
|
P.p.log("Loading board from disk");
|
2011-03-23 12:00:38 +01:00
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
if ( ! file.exists())
|
|
|
|
{
|
|
|
|
P.p.log("No board to load from disk. Creating new file.");
|
2011-03-18 17:33:23 +01:00
|
|
|
save();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
try
|
|
|
|
{
|
New "access" system to replace old ownership system. Access can be granted to build, destroy, and fully interact within any chunk for specific players or factions. Access can also optionally be denied to normal members of the host faction.
Some further info display to go with this feature is yet to come, and further testing for possible bugs is also needed.
Related info:
New FPerm "ACCESS" which is granted to faction leaders and officers by default. This FPerm allows you to bypass access restrictions throughout your faction territory, and (along with the "factions.access" Bukkit permission below) allows you to change access settings for any chunk owned by your faction.
New permissions:
factions.access - Ability to grant territory access for your faction, if you have the proper "ACCESS" FPerm (defaults to leaders and officers only). Added to factions.kit.halfplayer permission kit.
factions.access.any - Ability to grant territory access for any faction on the server. Added to factions.kit.mod permission kit.
factions.access.view - Ability to view territory access info for your own faction. Added to factions.kit.halfplayer permission kit.
New command:
/f access [view|p|f|player|faction=view] [name=you] - view or change the access information for the chunk you are in. If "view" or nothing is specified, it will simply display the info. If "p" or "player" is specified, a player will be granted access, or removed from the list if they were already granted access. If "f" or "faction" is specified, the same will be done for the specified faction. The name defaults to yourself or your faction if not specified. If your own faction is specified, you will toggle restricted access for the chunk so that normal faction members can be denied access, unless they are in the access list.
Examples:
/f access - view access list, if in your own territory
/f access p SomePlayer - grant access to player "SomePlayer" for the current chunk, or remove them from the access list if already there
/f access f - toggle restricted access for the current chunk (since faction name isn't specified, uses your own faction), assuming you're in your own factions territory
2012-05-15 04:41:13 +02:00
|
|
|
Type type = new TypeToken<Map<String,Map<String,TerritoryAccess>>>(){}.getType();
|
|
|
|
Map<String,Map<String,TerritoryAccess>> worldCoordIds = P.p.gson.fromJson(DiscUtil.read(file), type);
|
2011-03-23 12:45:21 +01:00
|
|
|
loadFromSaveFormat(worldCoordIds);
|
2011-10-08 23:22:02 +02:00
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
2011-03-18 17:33:23 +01:00
|
|
|
e.printStackTrace();
|
2011-10-08 23:22:02 +02:00
|
|
|
P.p.log("Failed to load the board from disk.");
|
2011-03-18 17:33:23 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-02-06 13:36:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|