New permission nodes to disable any command, factions.disableCommand.<command>, along with factions.disableCommand.none node which forcibly makes none disabled (for * permission users or similar); for <command>, you must use the first command alias given in the /f help information (for example, "show" instead of "who" for that particular command)

This commit is contained in:
Brettflan
2011-07-20 16:22:54 -05:00
parent 5b73ebc456
commit 1e9c83decc
3 changed files with 134 additions and 0 deletions

View File

@ -340,6 +340,10 @@ public class Factions extends JavaPlugin {
return hasPerm(sender, "factions.worldOptions");
}
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);