2013-04-09 13:24:55 +02:00
|
|
|
package com.massivecraft.factions;
|
2011-10-23 17:30:41 +02:00
|
|
|
|
2011-10-23 23:17:02 +02:00
|
|
|
import java.util.Arrays;
|
2013-04-17 13:16:22 +02:00
|
|
|
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.EnumSet;
|
2013-04-22 10:37:04 +02:00
|
|
|
import java.util.LinkedHashMap;
|
2013-04-17 13:16:22 +02:00
|
|
|
import java.util.LinkedHashSet;
|
2013-04-22 10:37:04 +02:00
|
|
|
import java.util.Map;
|
2011-10-23 23:17:02 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
2011-10-24 01:37:51 +02:00
|
|
|
import org.bukkit.Location;
|
2013-04-17 10:34:48 +02:00
|
|
|
import org.bukkit.command.CommandSender;
|
2011-10-25 21:18:08 +02:00
|
|
|
import org.bukkit.command.ConsoleCommandSender;
|
2011-10-24 01:37:51 +02:00
|
|
|
|
2013-04-22 12:26:13 +02:00
|
|
|
import com.massivecraft.factions.entity.BoardColls;
|
2013-04-22 09:37:53 +02:00
|
|
|
import com.massivecraft.factions.entity.FPlayer;
|
|
|
|
import com.massivecraft.factions.entity.Faction;
|
2013-04-11 11:11:31 +02:00
|
|
|
import com.massivecraft.mcore.ps.PS;
|
2011-10-23 23:17:02 +02:00
|
|
|
|
2011-10-23 17:30:41 +02:00
|
|
|
/**
|
|
|
|
* Permissions that you (a player) may or may not have in the territory of a certain faction.
|
2011-10-23 20:50:49 +02:00
|
|
|
* Each faction have many Rel's assigned to each one of these Perms.
|
2011-10-23 17:30:41 +02:00
|
|
|
*/
|
2011-10-24 01:37:51 +02:00
|
|
|
public enum FPerm
|
2011-10-23 17:30:41 +02:00
|
|
|
{
|
2013-04-17 13:16:22 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// ENUM
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2013-01-06 21:44:29 +01:00
|
|
|
BUILD("build", "edit the terrain", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY),
|
2011-11-27 19:21:24 +01:00
|
|
|
PAINBUILD("painbuild", "edit but take damage"),
|
2013-01-06 21:44:29 +01:00
|
|
|
DOOR("door", "use doors", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY),
|
|
|
|
BUTTON("button", "use stone buttons", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY),
|
|
|
|
LEVER("lever", "use levers", Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY),
|
2011-10-25 21:18:08 +02:00
|
|
|
CONTAINER("container", "use containers", Rel.LEADER, Rel.OFFICER, Rel.MEMBER),
|
2013-04-17 16:21:25 +02:00
|
|
|
|
2012-05-09 03:24:07 +02:00
|
|
|
INVITE("invite", "invite players", Rel.LEADER, Rel.OFFICER),
|
2011-10-25 21:18:08 +02:00
|
|
|
KICK("kick", "kick members", Rel.LEADER, Rel.OFFICER),
|
|
|
|
SETHOME("sethome", "set the home", Rel.LEADER, Rel.OFFICER),
|
|
|
|
WITHDRAW("withdraw", "withdraw money", Rel.LEADER, Rel.OFFICER),
|
|
|
|
TERRITORY("territory", "claim or unclaim", Rel.LEADER, Rel.OFFICER),
|
2012-05-09 03:24:07 +02:00
|
|
|
CAPE("cape", "set the cape", Rel.LEADER, Rel.OFFICER),
|
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
|
|
|
ACCESS("access", "grant territory access", Rel.LEADER, Rel.OFFICER),
|
2011-10-25 21:18:08 +02:00
|
|
|
DISBAND("disband", "disband the faction", Rel.LEADER),
|
|
|
|
PERMS("perms", "manage permissions", Rel.LEADER),
|
2013-04-17 13:16:22 +02:00
|
|
|
|
|
|
|
// END OF LIST
|
2011-10-23 23:17:02 +02:00
|
|
|
;
|
|
|
|
|
2013-04-17 13:16:22 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// FIELDS
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2011-10-23 23:17:02 +02:00
|
|
|
private final String nicename;
|
2013-04-17 13:16:22 +02:00
|
|
|
public String getNicename() { return this.nicename; }
|
|
|
|
|
2011-10-23 23:17:02 +02:00
|
|
|
private final String desc;
|
2013-04-17 13:16:22 +02:00
|
|
|
public String getDescription() { return this.desc; }
|
|
|
|
|
2013-04-22 10:37:04 +02:00
|
|
|
public final Set<Rel> defaultDefault;
|
|
|
|
public Set<Rel> getDefaultDefault() { return new LinkedHashSet<Rel>(this.defaultDefault); }
|
2011-10-23 23:17:02 +02:00
|
|
|
|
2013-04-17 13:16:22 +02:00
|
|
|
// -------------------------------------------- //
|
|
|
|
// CONSTRUCT
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2011-10-24 01:37:51 +02:00
|
|
|
private FPerm(final String nicename, final String desc, final Rel... rels)
|
2011-10-23 23:17:02 +02:00
|
|
|
{
|
|
|
|
this.nicename = nicename;
|
|
|
|
this.desc = desc;
|
2013-04-17 13:16:22 +02:00
|
|
|
|
|
|
|
Set<Rel> defaultDefaultValue = new LinkedHashSet<Rel>();
|
|
|
|
defaultDefaultValue.addAll(Arrays.asList(rels));
|
|
|
|
defaultDefaultValue = Collections.unmodifiableSet(defaultDefaultValue);
|
2013-04-22 10:37:04 +02:00
|
|
|
this.defaultDefault = defaultDefaultValue;
|
2011-10-23 23:17:02 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 13:16:22 +02:00
|
|
|
// -------------------------------------------- //
|
2013-04-22 10:37:04 +02:00
|
|
|
// DEFAULTS
|
2013-04-17 13:16:22 +02:00
|
|
|
// -------------------------------------------- //
|
2011-10-23 23:17:02 +02:00
|
|
|
|
|
|
|
public Set<Rel> getDefault()
|
|
|
|
{
|
2013-04-09 13:15:25 +02:00
|
|
|
Set<Rel> ret = ConfServer.factionPermDefaults.get(this);
|
2013-04-22 10:37:04 +02:00
|
|
|
if (ret == null) return this.getDefaultDefault();
|
2013-04-17 13:16:22 +02:00
|
|
|
ret = new LinkedHashSet<Rel>(ret);
|
|
|
|
return ret;
|
2011-10-23 23:17:02 +02:00
|
|
|
}
|
|
|
|
|
2013-04-22 10:37:04 +02:00
|
|
|
public static Map<FPerm, Set<Rel>> getDefaultDefaults()
|
|
|
|
{
|
|
|
|
Map<FPerm, Set<Rel>> ret = new LinkedHashMap<FPerm, Set<Rel>>();
|
|
|
|
for (FPerm fperm : values())
|
|
|
|
{
|
|
|
|
ret.put(fperm, fperm.getDefaultDefault());
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------------------- //
|
|
|
|
// FROOODLDLLD
|
|
|
|
// -------------------------------------------- //
|
|
|
|
|
2011-10-24 01:37:51 +02:00
|
|
|
public static FPerm parse(String str)
|
2011-10-23 23:17:02 +02:00
|
|
|
{
|
|
|
|
str = str.toLowerCase();
|
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 (str.startsWith("a")) return ACCESS;
|
2011-10-23 23:17:02 +02:00
|
|
|
if (str.startsWith("bui")) return BUILD;
|
2011-10-25 21:18:08 +02:00
|
|
|
if (str.startsWith("pa")) return PAINBUILD;
|
|
|
|
if (str.startsWith("do")) return DOOR;
|
2011-10-23 23:17:02 +02:00
|
|
|
if (str.startsWith("but")) return BUTTON;
|
2011-10-25 21:18:08 +02:00
|
|
|
if (str.startsWith("l")) return LEVER;
|
|
|
|
if (str.startsWith("co")) return CONTAINER;
|
2012-05-09 03:24:07 +02:00
|
|
|
if (str.startsWith("i")) return INVITE;
|
2011-10-25 21:18:08 +02:00
|
|
|
if (str.startsWith("k")) return KICK;
|
|
|
|
if (str.startsWith("s")) return SETHOME;
|
|
|
|
if (str.startsWith("w")) return WITHDRAW;
|
|
|
|
if (str.startsWith("t")) return TERRITORY;
|
2012-05-09 03:32:04 +02:00
|
|
|
if (str.startsWith("ca")) return CAPE;
|
2011-10-25 21:18:08 +02:00
|
|
|
if (str.startsWith("di")) return DISBAND;
|
|
|
|
if (str.startsWith("pe")) return PERMS;
|
2011-10-23 23:17:02 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2011-10-24 11:56:41 +02:00
|
|
|
public static String getStateHeaders()
|
2011-10-23 23:17:02 +02:00
|
|
|
{
|
2011-10-24 11:56:41 +02:00
|
|
|
String ret = "";
|
|
|
|
for (Rel rel : Rel.values())
|
2011-10-24 09:28:08 +02:00
|
|
|
{
|
2011-10-24 11:56:41 +02:00
|
|
|
ret += rel.getColor().toString();
|
|
|
|
ret += rel.toString().substring(0, 3);
|
|
|
|
ret += " ";
|
2011-10-24 09:28:08 +02:00
|
|
|
}
|
2011-10-24 11:56:41 +02:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getStateInfo(Set<Rel> value, boolean withDesc)
|
|
|
|
{
|
|
|
|
String ret = "";
|
|
|
|
|
|
|
|
for (Rel rel : Rel.values())
|
2011-10-24 09:28:08 +02:00
|
|
|
{
|
2011-10-24 11:56:41 +02:00
|
|
|
if (value.contains(rel))
|
|
|
|
{
|
|
|
|
ret += "<g>YES";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret += "<b>NOO";
|
|
|
|
}
|
|
|
|
ret += " ";
|
2011-10-24 09:28:08 +02:00
|
|
|
}
|
2011-10-23 23:17:02 +02:00
|
|
|
|
2011-10-24 13:02:48 +02:00
|
|
|
ret +="<c>"+this.getNicename();
|
2011-10-23 23:17:02 +02:00
|
|
|
if (withDesc)
|
|
|
|
{
|
2011-10-24 11:56:41 +02:00
|
|
|
ret += " <i>" + this.getDescription();
|
2011-10-23 23:17:02 +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
|
|
|
|
|
|
|
// Perms which apply strictly to granting territory access
|
2013-04-17 16:21:25 +02:00
|
|
|
// TODO: This should be a boolean field within the class itself!
|
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 final Set<FPerm> TerritoryPerms = EnumSet.of(BUILD, DOOR, BUTTON, LEVER, CONTAINER);
|
|
|
|
public boolean isTerritoryPerm()
|
|
|
|
{
|
|
|
|
return TerritoryPerms.contains(this);
|
|
|
|
}
|
|
|
|
|
2011-10-25 21:18:08 +02:00
|
|
|
private static final String errorpattern = "%s<b> does not allow you to %s<b>.";
|
|
|
|
public boolean has(Object testSubject, Faction hostFaction, boolean informIfNot)
|
2011-10-24 01:37:51 +02:00
|
|
|
{
|
2011-10-25 21:18:08 +02:00
|
|
|
if (testSubject instanceof ConsoleCommandSender) return true;
|
2011-10-24 13:02:48 +02:00
|
|
|
|
2011-10-25 21:18:08 +02:00
|
|
|
RelationParticipator rpSubject = null;
|
2011-10-24 13:02:48 +02:00
|
|
|
|
2013-04-17 10:34:48 +02:00
|
|
|
if (testSubject instanceof CommandSender)
|
2011-10-25 21:18:08 +02:00
|
|
|
{
|
2013-04-22 12:26:13 +02:00
|
|
|
rpSubject = FPlayer.get(testSubject);
|
2011-10-25 21:18:08 +02:00
|
|
|
}
|
|
|
|
else if (testSubject instanceof RelationParticipator)
|
|
|
|
{
|
|
|
|
rpSubject = (RelationParticipator) testSubject;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Rel rel = rpSubject.getRelationTo(hostFaction);
|
|
|
|
|
|
|
|
// TODO: Create better description messages like: "You must at least be officer".
|
2011-10-24 13:02:48 +02:00
|
|
|
boolean ret = hostFaction.getPermittedRelations(this).contains(rel);
|
|
|
|
|
2013-04-16 11:27:03 +02:00
|
|
|
if (rpSubject instanceof FPlayer && ret == false && ((FPlayer)rpSubject).isUsingAdminMode()) ret = true;
|
2011-10-25 21:18:08 +02:00
|
|
|
|
|
|
|
if (!ret && informIfNot && rpSubject instanceof FPlayer)
|
2011-10-24 01:37:51 +02:00
|
|
|
{
|
2011-10-25 21:18:08 +02:00
|
|
|
FPlayer fplayer = (FPlayer)rpSubject;
|
|
|
|
fplayer.msg(errorpattern, hostFaction.describeTo(fplayer, true), this.getDescription());
|
2013-04-09 12:56:29 +02:00
|
|
|
if (Perm.ADMIN.has(fplayer.getPlayer()))
|
2011-10-25 21:18:08 +02:00
|
|
|
{
|
2013-04-16 11:27:03 +02:00
|
|
|
fplayer.msg("<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
|
2011-10-25 21:18:08 +02:00
|
|
|
}
|
2011-10-24 01:37:51 +02:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2011-10-25 21:18:08 +02:00
|
|
|
public boolean has(Object testSubject, Faction hostFaction)
|
2011-10-24 11:56:41 +02:00
|
|
|
{
|
|
|
|
return this.has(testSubject, hostFaction, false);
|
|
|
|
}
|
2013-04-11 11:11:31 +02:00
|
|
|
public boolean has(Object testSubject, PS ps, boolean informIfNot)
|
2011-10-24 11:56:41 +02:00
|
|
|
{
|
2013-04-22 12:26:13 +02:00
|
|
|
TerritoryAccess access = BoardColls.get().getTerritoryAccessAt(ps);
|
2013-04-11 11:11:31 +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 (this.isTerritoryPerm())
|
|
|
|
{
|
|
|
|
if (access.subjectHasAccess(testSubject)) return true;
|
2012-05-16 22:29:00 +02:00
|
|
|
if (access.subjectAccessIsRestricted(testSubject))
|
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 (informIfNot)
|
|
|
|
{
|
|
|
|
FPlayer notify = null;
|
2013-04-17 10:41:38 +02:00
|
|
|
if (testSubject instanceof CommandSender)
|
2013-04-22 12:26:13 +02:00
|
|
|
notify = FPlayer.get(testSubject);
|
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
|
|
|
else if (testSubject instanceof FPlayer)
|
|
|
|
notify = (FPlayer)testSubject;
|
|
|
|
if (notify != null)
|
|
|
|
notify.msg("<b>This territory owned by your faction has restricted access.");
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2012-05-16 22:29:00 +02:00
|
|
|
return this.has(testSubject, access.getHostFaction(), informIfNot);
|
2011-10-24 11:56:41 +02:00
|
|
|
}
|
2011-10-25 21:18:08 +02:00
|
|
|
public boolean has(Object testSubject, Location loc, boolean informIfNot)
|
2011-10-24 01:37:51 +02:00
|
|
|
{
|
2013-04-11 11:11:31 +02:00
|
|
|
PS ps = PS.valueOf(loc);
|
|
|
|
return this.has(testSubject, ps, informIfNot);
|
2011-10-24 01:37:51 +02:00
|
|
|
}
|
2011-10-25 21:18:08 +02:00
|
|
|
public boolean has(Object testSubject, Location loc)
|
2011-10-24 01:37:51 +02:00
|
|
|
{
|
|
|
|
return this.has(testSubject, loc, false);
|
|
|
|
}
|
2013-04-11 11:11:31 +02:00
|
|
|
public boolean has(Object testSubject, PS ps)
|
2011-10-24 01:37:51 +02:00
|
|
|
{
|
2013-04-11 11:11:31 +02:00
|
|
|
return this.has(testSubject, ps, false);
|
2011-10-24 01:37:51 +02:00
|
|
|
}
|
2011-10-23 17:30:41 +02:00
|
|
|
}
|