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
|
|
|
|
{
|
|
|
|
PARTICIPATE("factions.participate"),
|
|
|
|
CREATE("factions.create"),
|
|
|
|
VIEW_ANY_POWER("factions.viewAnyPower"),
|
|
|
|
PEACEFUL_EXPLOTION_TOGGLE("factions.peacefulExplosionToggle"),
|
|
|
|
ADMIN_BYPASS("factions.adminBypass"),
|
|
|
|
CONFIG("factions.config"),
|
|
|
|
DISBAN("factions.disband"),
|
|
|
|
LOCK("factions.lock"),
|
|
|
|
MANAGE_SAFE_ZONE("factions.manageSafeZone"),
|
|
|
|
MANAGE_WAR_ZONE("factions.manageWarZone"),
|
|
|
|
OWNERSHIP_BYPASS("factions.ownershipBypass"),
|
|
|
|
RELOAD("factions.reload"),
|
|
|
|
SAVE_ALL("factions.saveall"),
|
|
|
|
SET_PEACEFUL("factions.setPeaceful"),
|
|
|
|
;
|
|
|
|
|
|
|
|
public final String node;
|
|
|
|
|
|
|
|
Permission(final String node)
|
|
|
|
{
|
|
|
|
this.node = node;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
}
|