Skip to content

Commit

Permalink
Add new constructor for inheriting permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
fernferret committed Jul 17, 2011
1 parent 468162f commit 146c05f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/com/pneumaticraft/commandhandler/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public abstract class Command {
private int maximumArgLength;

private String commandName;
private String commandDesc;
private String commandExample;
private String commandUsage;

Expand Down Expand Up @@ -84,6 +83,13 @@ public void setPermission(String p, String desc, PermissionDefault defaultPerm)
this.permission = new Permission(p, desc, defaultPerm);
this.plugin.getServer().getPluginManager().addPermission(this.permission);
}

public void setPermission(Permission perm) {
this.opRequired = (perm.getDefault() == PermissionDefault.OP);
this.permissionString = perm.getName();
this.permission = perm;
this.plugin.getServer().getPluginManager().addPermission(this.permission);
}

public boolean isOpRequired() {
return this.opRequired;
Expand All @@ -94,7 +100,7 @@ public String getCommandName() {
}

public String getCommandDesc() {
return this.commandDesc;
return this.permission.getDescription();
}

public String getCommandExample() {
Expand Down

0 comments on commit 146c05f

Please sign in to comment.