Factions3/src/com/massivecraft/factions/Perm.java

94 lines
2.1 KiB
Java
Raw Normal View History

package com.massivecraft.factions;
2011-10-08 18:44:47 +02:00
2013-04-10 10:45:47 +02:00
import org.bukkit.permissions.Permissible;
import com.massivecraft.mcore.util.PermUtil;
2011-10-08 18:44:47 +02:00
public enum Perm
2011-10-08 18:44:47 +02:00
{
// -------------------------------------------- //
// ENUM
// -------------------------------------------- //
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"),
ACCESS_ANY("access.any"),
ACCESS_VIEW("access.view"),
ADMIN("adminmode"),
2011-10-09 21:57:43 +02:00
AUTOCLAIM("autoclaim"),
CLAIM("claim"),
CLAIM_RADIUS("claim.radius"),
2011-10-09 21:57:43 +02:00
CREATE("create"),
DEMOTE("demote"),
2011-10-09 21:57:43 +02:00
DESCRIPTION("description"),
DISBAND("disband"),
2011-10-23 20:50:49 +02:00
FLAG("flag"),
FLAG_SET("flag.set"),
2011-10-09 21:57:43 +02:00
HOME("home"),
INVITE("invite"),
JOIN("join"),
JOIN_ANY("join.any"),
JOIN_OTHERS("join.others"),
2011-10-09 21:57:43 +02:00
KICK("kick"),
LEADER("leader"),
LEADER_ANY("leader.any"),
2011-10-09 21:57:43 +02:00
LEAVE("leave"),
LIST("list"),
MAP("map"),
MONEY_BALANCE("money.balance"),
MONEY_BALANCE_ANY("money.balance.any"),
MONEY_DEPOSIT("money.deposit"),
MONEY_F2F("money.f2f"),
MONEY_F2P("money.f2p"),
MONEY_P2F("money.p2f"),
MONEY_WITHDRAW("money.withdraw"),
OFFICER("officer"),
OFFICER_ANY("officer.any"),
2011-10-09 21:57:43 +02:00
OPEN("open"),
PERM("perm"),
POWERBOOST("powerboost"),
PROMOTE("promote"),
2011-10-09 21:57:43 +02:00
RELATION("relation"),
SAVE("save"),
2012-01-28 19:49:01 +01:00
SEE_CHUNK("seechunk"),
2011-10-09 21:57:43 +02:00
SETHOME("sethome"),
SHOW("show"),
NAME("name"),
2011-10-09 21:57:43 +02:00
TITLE("title"),
UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"),
VERSION("version"),
// END OF LIST
2011-10-08 18:44:47 +02:00
;
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
2011-10-08 18:44:47 +02:00
public final String node;
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
Perm(final String node)
2011-10-08 18:44:47 +02:00
{
this.node = "factions."+node;
}
2011-10-08 18:44:47 +02:00
// -------------------------------------------- //
// HAS
// -------------------------------------------- //
2013-04-10 10:45:47 +02:00
public boolean has(Permissible permissible, boolean informSenderIfNot)
2011-10-08 23:22:02 +02:00
{
2013-04-10 10:45:47 +02:00
return PermUtil.has(permissible, this.node, informSenderIfNot);
2011-10-08 23:22:02 +02:00
}
2013-04-10 10:45:47 +02:00
public boolean has(Permissible permissible)
2011-10-08 23:22:02 +02:00
{
2013-04-10 10:45:47 +02:00
return has(permissible, false);
2011-10-08 23:22:02 +02:00
}
2013-04-10 10:45:47 +02:00
2011-10-08 18:44:47 +02:00
}