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:
@ -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);
|
||||
|
@ -87,6 +87,12 @@ public class FBaseCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure player doesn't have their access to the command revoked
|
||||
if (Factions.isCommandDisabled(sender, aliases.get(0))) {
|
||||
sendMessage("You lack the permissions to "+this.helpDescription.toLowerCase()+".");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parameters.size() < requiredParameters.size()) {
|
||||
sendMessage("Usage: "+this.getUseageTemplate(false));
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user