2011-10-08 18:44:47 +02:00
|
|
|
package com.massivecraft.factions.struct;
|
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
import com.massivecraft.factions.P;
|
2011-10-08 18:44:47 +02:00
|
|
|
|
|
|
|
public enum Permission
|
|
|
|
{
|
2011-10-09 20:10:19 +02:00
|
|
|
MANAGE_SAFE_ZONE("managesafezone"),
|
|
|
|
MANAGE_WAR_ZONE("managewarzone"),
|
|
|
|
OWNERSHIP_BYPASS("ownershipbypass"),
|
2011-10-09 14:53:38 +02:00
|
|
|
COMMAND_ADMIN("command.admin"),
|
2011-10-09 20:10:19 +02:00
|
|
|
COMMAND_AUTOCLAIM("command.autoclaim"),
|
2011-10-09 14:53:38 +02:00
|
|
|
COMMAND_BALANCE("command.balance"),
|
2011-10-09 20:10:19 +02:00
|
|
|
COMMAND_BALANCE_ANY("command.balance.any"),
|
2011-10-09 14:53:38 +02:00
|
|
|
COMMAND_WITHDRAW("command.withdraw"),
|
|
|
|
COMMAND_PAY("command.pay"),
|
2011-10-09 18:35:39 +02:00
|
|
|
COMMAND_BYPASS("command.bypass"),
|
2011-10-09 14:53:38 +02:00
|
|
|
COMMAND_CHAT("command.chat"),
|
|
|
|
COMMAND_CLAIM("command.claim"),
|
|
|
|
COMMAND_CONFIG("command.config"),
|
2011-10-09 20:10:19 +02:00
|
|
|
COMMAND_CREATE("command.create"),
|
2011-10-09 14:53:38 +02:00
|
|
|
COMMAND_DEINVITE("command.deinvite"),
|
|
|
|
COMMAND_DEPOSIT("command.deposit"),
|
|
|
|
COMMAND_DESCRIPTION("command.description"),
|
|
|
|
COMMAND_DISBAND("command.disband"),
|
|
|
|
COMMAND_DISBAND_ANY("command.disband.any"),
|
|
|
|
COMMAND_HELP("command.help"),
|
|
|
|
COMMAND_HOME("command.home"),
|
|
|
|
COMMAND_INVITE("command.invite"),
|
|
|
|
COMMAND_JOIN("command.join"),
|
|
|
|
COMMAND_KICK("command.kick"),
|
|
|
|
COMMAND_KICK_ANY("command.kick.any"),
|
|
|
|
COMMAND_LEAVE("command.leave"),
|
|
|
|
COMMAND_LIST("command.list"),
|
|
|
|
COMMAND_LOCK("command.lock"),
|
|
|
|
COMMAND_MAP("command.map"),
|
|
|
|
COMMAND_MOD("command.mod"),
|
2011-10-09 20:10:19 +02:00
|
|
|
COMMAND_NO_BOOM("command.noboom"),
|
2011-10-09 18:35:39 +02:00
|
|
|
COMMAND_OPEN("command.open"),
|
|
|
|
COMMAND_OWNER("command.owner"),
|
|
|
|
COMMAND_OWNERLIST("command.ownerlist"),
|
2011-10-09 20:10:19 +02:00
|
|
|
COMMAND_SET_PEACEFUL("command.setpeaceful"),
|
|
|
|
COMMAND_SET_PERMANENT("command.setpermanent"),
|
2011-10-09 18:35:39 +02:00
|
|
|
COMMAND_POWER("command.power"),
|
|
|
|
COMMAND_POWER_ANY("command.power.any"),
|
|
|
|
COMMAND_RELATION("command.relation"),
|
|
|
|
COMMAND_RELOAD("command.reload"),
|
|
|
|
COMMAND_SAVE("command.save"),
|
|
|
|
COMMAND_SETHOME("command.sethome"),
|
|
|
|
COMMAND_SETHOME_ANY("command.sethome.any"),
|
|
|
|
COMMAND_SHOW("command.show"),
|
|
|
|
COMMAND_TAG("command.tag"),
|
|
|
|
COMMAND_TITLE("command.title"),
|
|
|
|
COMMAND_UNCLAIM("command.unclaim"),
|
2011-10-09 20:10:19 +02:00
|
|
|
COMMAND_UNCLAIM_ALL("command.unclaimall"),
|
2011-10-09 18:35:39 +02:00
|
|
|
COMMAND_VERSION("command.version"),
|
2011-10-08 18:44:47 +02:00
|
|
|
;
|
|
|
|
|
|
|
|
public final String node;
|
|
|
|
|
|
|
|
Permission(final String node)
|
|
|
|
{
|
2011-10-09 14:53:38 +02:00
|
|
|
this.node = "factions."+node;
|
2011-10-08 18:44:47 +02:00
|
|
|
}
|
|
|
|
|
2011-10-08 23:22:02 +02:00
|
|
|
public boolean has(CommandSender sender, boolean informSenderIfNot)
|
|
|
|
{
|
|
|
|
return P.p.perm.has(sender, this.node, informSenderIfNot);
|
|
|
|
}
|
|
|
|
|
2011-10-08 18:44:47 +02:00
|
|
|
public boolean has(CommandSender sender)
|
2011-10-08 23:22:02 +02:00
|
|
|
{
|
|
|
|
return has(sender, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*public boolean has(CommandSender sender)
|
2011-10-08 18:44:47 +02:00
|
|
|
{
|
|
|
|
//return CreativeGates.p.perm.has(sender, this.node);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isCommandDisabled(CommandSender sender, String command)
|
|
|
|
{
|
|
|
|
return (hasPerm(sender, "factions.commandDisable."+command) && !hasPerm(sender, "factions.commandDisable.none"));
|
|
|
|
}
|
|
|
|
|
|
|
|
private static boolean hasPerm(CommandSender sender, String permNode)
|
|
|
|
{
|
|
|
|
if (Factions.Permissions == null || ! (sender instanceof Player))
|
|
|
|
{
|
|
|
|
return sender.isOp() || sender.hasPermission(permNode);
|
|
|
|
}
|
|
|
|
|
|
|
|
Player player = (Player)sender;
|
|
|
|
return Factions.Permissions.has(player, permNode);
|
2011-10-08 23:22:02 +02:00
|
|
|
}*/
|
2011-10-08 18:44:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|