2013-04-09 13:24:55 +02:00
|
|
|
package com.massivecraft.factions;
|
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
|
|
|
|
2017-03-24 13:05:58 +01:00
|
|
|
import com.massivecraft.factions.entity.Faction;
|
|
|
|
import com.massivecraft.factions.entity.MPlayer;
|
2017-03-25 00:47:01 +01:00
|
|
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
2017-03-24 13:05:58 +01:00
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
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 java.util.Set;
|
|
|
|
|
2013-04-09 13:53:37 +02:00
|
|
|
public class TerritoryAccess
|
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
|
|
|
{
|
2013-04-09 14:05:00 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// FIELDS: RAW
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
// no default value, can't be null
|
2017-03-25 00:47:01 +01:00
|
|
|
private final String hostFactionId;
|
2013-04-10 08:47:52 +02:00
|
|
|
public String getHostFactionId() { return this.hostFactionId; }
|
2013-04-09 14:05:00 +02:00
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
// default is true
|
|
|
|
private final boolean hostFactionAllowed;
|
2013-04-09 14:05:00 +02:00
|
|
|
public boolean isHostFactionAllowed() { return this.hostFactionAllowed; }
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
// default is empty
|
2017-03-25 00:47:01 +01:00
|
|
|
private final Set<String> factionIds;
|
2013-04-09 14:05:00 +02:00
|
|
|
public Set<String> getFactionIds() { return this.factionIds; }
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
// default is empty
|
2015-05-16 12:19:36 +02:00
|
|
|
private final Set<String> playerIds;
|
2013-04-29 10:23:39 +02:00
|
|
|
public Set<String> getPlayerIds() { return this.playerIds; }
|
|
|
|
|
2013-04-09 14:05:00 +02:00
|
|
|
// -------------------------------------------- //
|
2013-04-29 10:23:39 +02:00
|
|
|
// FIELDS: DELTA
|
2013-04-09 14:05:00 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
// The simple ones
|
|
|
|
public TerritoryAccess withHostFactionId(String hostFactionId) { return valueOf(hostFactionId, hostFactionAllowed, factionIds, playerIds); }
|
|
|
|
public TerritoryAccess withHostFactionAllowed(Boolean hostFactionAllowed) { return valueOf(hostFactionId, hostFactionAllowed, factionIds, playerIds); }
|
|
|
|
public TerritoryAccess withFactionIds(Collection<String> factionIds) { return valueOf(hostFactionId, hostFactionAllowed, factionIds, playerIds); }
|
|
|
|
public TerritoryAccess withPlayerIds(Collection<String> playerIds) { return valueOf(hostFactionId, hostFactionAllowed, factionIds, playerIds); }
|
|
|
|
|
|
|
|
// The intermediate ones
|
|
|
|
public TerritoryAccess withFactionId(String factionId, boolean with)
|
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
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
if (this.getHostFactionId().equals(factionId))
|
|
|
|
{
|
|
|
|
return valueOf(hostFactionId, with, factionIds, playerIds);
|
|
|
|
}
|
2013-04-09 14:05:00 +02:00
|
|
|
|
2017-03-25 00:47:01 +01:00
|
|
|
Set<String> factionIds = new MassiveSet<>(this.getFactionIds());
|
2013-04-29 10:23:39 +02:00
|
|
|
if (with)
|
|
|
|
{
|
|
|
|
factionIds.add(factionId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
factionIds.remove(factionId);
|
|
|
|
}
|
|
|
|
return valueOf(hostFactionId, hostFactionAllowed, factionIds, playerIds);
|
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
|
|
|
}
|
2013-04-09 14:05:00 +02:00
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
public TerritoryAccess withPlayerId(String playerId, boolean with)
|
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
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
playerId = playerId.toLowerCase();
|
2017-03-25 00:47:01 +01:00
|
|
|
Set<String> playerIds = new MassiveSet<>(this.getPlayerIds());
|
2013-04-29 10:23:39 +02:00
|
|
|
if (with)
|
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
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
playerIds.add(playerId);
|
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
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
else
|
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
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
playerIds.remove(playerId);
|
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
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
return valueOf(hostFactionId, hostFactionAllowed, factionIds, playerIds);
|
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
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
2014-09-17 13:33:09 +02:00
|
|
|
// FIELDS: DIRECT
|
2013-04-29 10:23:39 +02:00
|
|
|
// -------------------------------------------- //
|
2013-04-09 14:05:00 +02:00
|
|
|
|
2017-05-15 07:18:12 +02:00
|
|
|
// This method intentionally returns null if the Faction no longer exists.
|
|
|
|
// In Board we don't even return this TerritoryAccess if that is the case.
|
2014-09-17 13:29:58 +02:00
|
|
|
public Faction getHostFaction()
|
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
|
|
|
{
|
2017-05-15 07:18:12 +02:00
|
|
|
return Faction.get(this.getHostFactionId());
|
2013-04-29 10:23:39 +02:00
|
|
|
}
|
|
|
|
|
2017-03-25 00:47:01 +01:00
|
|
|
public Set<MPlayer> getGrantedMPlayers()
|
2013-04-29 10:23:39 +02:00
|
|
|
{
|
2017-03-25 00:47:01 +01:00
|
|
|
// Create
|
|
|
|
Set<MPlayer> ret = new MassiveSet<>();
|
|
|
|
|
|
|
|
// Fill
|
2013-04-29 10:23:39 +02:00
|
|
|
for (String playerId : this.getPlayerIds())
|
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
|
|
|
{
|
2014-09-17 13:17:33 +02:00
|
|
|
ret.add(MPlayer.get(playerId));
|
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
|
|
|
}
|
2017-03-25 00:47:01 +01:00
|
|
|
|
|
|
|
// Return
|
2013-04-29 10:23:39 +02:00
|
|
|
return ret;
|
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
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
|
2017-03-25 00:47:01 +01:00
|
|
|
public Set<Faction> getGrantedFactions()
|
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
|
|
|
{
|
2017-03-25 00:47:01 +01:00
|
|
|
// Create
|
|
|
|
Set<Faction> ret = new MassiveSet<>();
|
|
|
|
|
|
|
|
// Fill
|
2013-04-29 10:23:39 +02:00
|
|
|
for (String factionId : this.getFactionIds())
|
|
|
|
{
|
2017-05-15 07:18:12 +02:00
|
|
|
Faction faction = Faction.get(factionId);
|
|
|
|
if (faction == null) continue;
|
|
|
|
ret.add(faction);
|
2013-04-29 10:23:39 +02:00
|
|
|
}
|
2017-03-25 00:47:01 +01:00
|
|
|
|
|
|
|
// Return
|
2013-04-29 10:23:39 +02:00
|
|
|
return ret;
|
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
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// PRIVATE CONSTRUCTOR
|
|
|
|
// -------------------------------------------- //
|
2013-04-09 14:05:00 +02:00
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
private TerritoryAccess(String hostFactionId, Boolean hostFactionAllowed, Collection<String> factionIds, Collection<String> playerIds)
|
2013-04-09 14:05:00 +02:00
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
if (hostFactionId == null) throw new IllegalArgumentException("hostFactionId was null");
|
|
|
|
this.hostFactionId = hostFactionId;
|
|
|
|
|
2017-03-25 00:47:01 +01:00
|
|
|
Set<String> factionIdsInner = new MassiveSet<>();
|
2013-04-29 10:23:39 +02:00
|
|
|
if (factionIds != null)
|
|
|
|
{
|
|
|
|
factionIdsInner.addAll(factionIds);
|
|
|
|
if (factionIdsInner.remove(hostFactionId))
|
|
|
|
{
|
|
|
|
hostFactionAllowed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.factionIds = Collections.unmodifiableSet(factionIdsInner);
|
|
|
|
|
2017-03-25 00:47:01 +01:00
|
|
|
Set<String> playerIdsInner = new MassiveSet<>();
|
2013-04-29 10:23:39 +02:00
|
|
|
if (playerIds != null)
|
|
|
|
{
|
|
|
|
for (String playerId : playerIds)
|
|
|
|
{
|
|
|
|
playerIdsInner.add(playerId.toLowerCase());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.playerIds = Collections.unmodifiableSet(playerIdsInner);
|
|
|
|
|
|
|
|
this.hostFactionAllowed = (hostFactionAllowed == null || hostFactionAllowed);
|
2013-04-09 14:05:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
2013-04-29 10:23:39 +02:00
|
|
|
// FACTORY: VALUE OF
|
2013-04-09 14:05:00 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
public static TerritoryAccess valueOf(String hostFactionId, Boolean hostFactionAllowed, Collection<String> factionIds, Collection<String> playerIds)
|
2013-04-09 14:05:00 +02:00
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
return new TerritoryAccess(hostFactionId, hostFactionAllowed, factionIds, playerIds);
|
2013-04-09 14:05:00 +02:00
|
|
|
}
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
public static TerritoryAccess valueOf(String hostFactionId)
|
2013-04-10 08:47:52 +02:00
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
return valueOf(hostFactionId, null, null, null);
|
2013-04-10 08:47:52 +02:00
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// INSTANCE METHODS
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2017-03-25 00:47:01 +01:00
|
|
|
public boolean isFactionGranted(Faction faction)
|
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
|
|
|
{
|
2017-03-25 00:47:01 +01:00
|
|
|
String factionId = faction.getId();
|
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
if (this.getHostFactionId().equals(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
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
return this.isHostFactionAllowed();
|
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
|
|
|
}
|
2017-03-25 00:47:01 +01:00
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
return this.getFactionIds().contains(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
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
|
|
|
|
// Note that the player can have access without being specifically granted.
|
|
|
|
// The player could for example be a member of a granted faction.
|
2017-03-25 00:47:01 +01:00
|
|
|
public boolean isMPlayerGranted(MPlayer mplayer)
|
2013-04-29 10:23:39 +02:00
|
|
|
{
|
2017-03-25 00:47:01 +01:00
|
|
|
String mplayerId = mplayer.getId();
|
|
|
|
return this.getPlayerIds().contains(mplayerId);
|
2013-04-29 10:23:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// A "default" TerritoryAccess could be serialized as a simple string only.
|
|
|
|
// The host faction is still allowed (default) and no faction or player has been granted explicit access (default).
|
|
|
|
public boolean isDefault()
|
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
|
|
|
{
|
2013-04-29 10:23:39 +02:00
|
|
|
return this.isHostFactionAllowed() && this.getFactionIds().isEmpty() && this.getPlayerIds().isEmpty();
|
|
|
|
}
|
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
|
|
|
|
2013-04-29 10:23:39 +02:00
|
|
|
// -------------------------------------------- //
|
2017-03-30 00:03:58 +02:00
|
|
|
// ACCESS STATUS
|
2013-04-29 10:23:39 +02:00
|
|
|
// -------------------------------------------- //
|
2013-04-29 12:48:11 +02:00
|
|
|
|
2017-03-30 00:03:58 +02:00
|
|
|
public AccessStatus getTerritoryAccess(MPlayer mplayer)
|
2012-05-16 22:29:00 +02:00
|
|
|
{
|
2017-03-30 00:03:58 +02:00
|
|
|
if (this.isMPlayerGranted(mplayer)) return AccessStatus.ELEVATED;
|
2013-04-29 12:48:11 +02:00
|
|
|
|
2017-03-24 22:59:44 +01:00
|
|
|
String factionId = mplayer.getFaction().getId();
|
2017-03-30 00:03:58 +02:00
|
|
|
if (this.getFactionIds().contains(factionId)) return AccessStatus.ELEVATED;
|
2013-04-29 12:48:11 +02:00
|
|
|
|
2017-03-30 00:03:58 +02:00
|
|
|
if (this.getHostFactionId().equals(factionId) && !this.isHostFactionAllowed()) return AccessStatus.DECREASED;
|
2013-04-29 12:48:11 +02:00
|
|
|
|
2017-03-30 00:03:58 +02:00
|
|
|
return AccessStatus.STANDARD;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
public Boolean hasTerritoryAccess(MPlayer mplayer)
|
|
|
|
{
|
|
|
|
return this.getTerritoryAccess(mplayer).hasAccess();
|
2012-05-16 22:29:00 +02:00
|
|
|
}
|
2013-04-29 10:23:39 +02:00
|
|
|
|
2017-03-30 00:03:58 +02:00
|
|
|
}
|