From dd82ab6dcc03c217e7c0a6a2e86e4749dd6cacfb Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Wed, 28 Jun 2017 15:55:39 +0200 Subject: [PATCH] fixed permissions error with 0 required permissions --- src/main/java/handiebot/command/Commands.java | 1 + src/main/java/handiebot/command/types/Command.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/handiebot/command/Commands.java b/src/main/java/handiebot/command/Commands.java index 9a00c50..2c36f9e 100644 --- a/src/main/java/handiebot/command/Commands.java +++ b/src/main/java/handiebot/command/Commands.java @@ -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; diff --git a/src/main/java/handiebot/command/types/Command.java b/src/main/java/handiebot/command/types/Command.java index ec88e45..13ae7fe 100644 --- a/src/main/java/handiebot/command/types/Command.java +++ b/src/main/java/handiebot/command/types/Command.java @@ -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); } }