Skip to content

Commit

Permalink
Check for permissions first.
Browse files Browse the repository at this point in the history
  • Loading branch information
fernferret committed Jul 10, 2011
1 parent 90dc8bd commit e915182
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/com/pneumaticraft/commandhandler/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ private String parseQuotedString(List<String> args, int start, int stop) {

private void checkAndRunCommand(CommandSender sender, List<String> parsedArgs, Command foundCommand) {
if (foundCommand.checkArgLength(parsedArgs)) {
if (this.permissions.hasPermission(sender, foundCommand.getPermission(), foundCommand.isOpRequired())) {
// Or used so if someone doesn't implement permissions interface, all commands will run.
if (this.permissions == null || this.permissions.hasPermission(sender, foundCommand.getPermission(), foundCommand.isOpRequired())) {
foundCommand.runCommand(sender, parsedArgs);
} else {
sender.sendMessage("You do not have the required permission (" + foundCommand.getPermission() + ").");
Expand Down

0 comments on commit e915182

Please sign in to comment.