fixed permissions error with 0 required permissions
This commit is contained in:
parent
2078137e1e
commit
dd82ab6dcc
|
@ -49,6 +49,7 @@ public class Commands {
|
|||
public static void executeCommand(String command, CommandContext context){
|
||||
for (Command cmd : commands) {
|
||||
if (cmd.getName().equals(command)){
|
||||
System.out.println(cmd.canUserExecute(context.getUser(), context.getGuild()));
|
||||
if (cmd instanceof StaticCommand){
|
||||
((StaticCommand)cmd).execute();
|
||||
return;
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class Command {
|
|||
*/
|
||||
public boolean canUserExecute(IUser user, IGuild guild){
|
||||
int userPermissions = Permissions.generatePermissionsNumber(user.getPermissionsForGuild(guild));
|
||||
return ((this.permissionsRequired & userPermissions) > 0) || (user.getLongID() == 235439851263098880L);
|
||||
return ((this.permissionsRequired & userPermissions) > 0) || (user.getLongID() == 235439851263098880L) || (this.permissionsRequired == 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue