From 71f6911e2f6a1e15a16ee7b6ca7c5d8da87ac22d Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Tue, 27 Jun 2017 23:42:44 +0200 Subject: [PATCH] fixed pom file compile plugin version --- pom.xml | 1 + src/main/java/handiebot/HandieBot.java | 3 +++ src/main/java/handiebot/command/Commands.java | 3 +-- .../java/handiebot/command/commands/admin/QuitCommand.java | 2 +- src/main/java/handiebot/command/types/Command.java | 4 ++++ src/main/resources/Strings.properties | 0 src/main/resources/Strings_nl.properties | 0 7 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/Strings.properties create mode 100644 src/main/resources/Strings_nl.properties diff --git a/pom.xml b/pom.xml index ab44f7e..a90dabb 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ org.apache.maven.plugins maven-compiler-plugin + 3.6.1 1.8 1.8 diff --git a/src/main/java/handiebot/HandieBot.java b/src/main/java/handiebot/HandieBot.java index 53c72f8..716681f 100644 --- a/src/main/java/handiebot/HandieBot.java +++ b/src/main/java/handiebot/HandieBot.java @@ -22,6 +22,7 @@ import sx.blah.discord.util.RateLimitException; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; +import java.util.ResourceBundle; /** * @author Andrew Lalis @@ -34,6 +35,8 @@ public class HandieBot { public static final String APPLICATION_NAME = "HandieBot"; private static final String TOKEN = "MjgzNjUyOTg5MjEyNjg4Mzg0.C45A_Q.506b0G6my1FEFa7_YY39lxLBHUY"; + public static ResourceBundle resourceBundle = ResourceBundle.getBundle("Strings"); + //Discord client object. public static IDiscordClient client; diff --git a/src/main/java/handiebot/command/Commands.java b/src/main/java/handiebot/command/Commands.java index 02d2431..f2833ed 100644 --- a/src/main/java/handiebot/command/Commands.java +++ b/src/main/java/handiebot/command/Commands.java @@ -8,7 +8,6 @@ import handiebot.command.commands.support.InfoCommand; import handiebot.command.types.Command; import handiebot.command.types.ContextCommand; import handiebot.command.types.StaticCommand; -import handiebot.utils.DisappearingMessage; import handiebot.view.BotLog; import java.util.ArrayList; @@ -50,7 +49,7 @@ public class Commands { if (cmd.getName().equals(command)){ if (!cmd.canUserExecute(context.getUser(), context.getGuild())){ log.log(BotLog.TYPE.ERROR, context.getGuild(), "User "+context.getUser().getName()+" does not have permission to execute "+cmd.getName()); - new DisappearingMessage(context.getChannel(), "You do not have permission to use that command.", 5000); + context.getChannel().sendMessage("You do not have permission to use the command `"+command+"`."); } if (cmd instanceof ContextCommand){ ((ContextCommand)cmd).execute(context); diff --git a/src/main/java/handiebot/command/commands/admin/QuitCommand.java b/src/main/java/handiebot/command/commands/admin/QuitCommand.java index 2986f05..0b8431e 100644 --- a/src/main/java/handiebot/command/commands/admin/QuitCommand.java +++ b/src/main/java/handiebot/command/commands/admin/QuitCommand.java @@ -13,7 +13,7 @@ public class QuitCommand extends StaticCommand { super("quit", "", "Shuts down the bot on all servers.", - 0); + 8); } @Override diff --git a/src/main/java/handiebot/command/types/Command.java b/src/main/java/handiebot/command/types/Command.java index ec88e45..c4b12ac 100644 --- a/src/main/java/handiebot/command/types/Command.java +++ b/src/main/java/handiebot/command/types/Command.java @@ -1,10 +1,13 @@ package handiebot.command.types; import handiebot.command.CommandHandler; +import handiebot.view.BotLog; import sx.blah.discord.handle.obj.IGuild; import sx.blah.discord.handle.obj.IUser; import sx.blah.discord.handle.obj.Permissions; +import static handiebot.HandieBot.log; + /** * @author Andrew Lalis * Basic type of command. @@ -51,6 +54,7 @@ public abstract class Command { */ public boolean canUserExecute(IUser user, IGuild guild){ int userPermissions = Permissions.generatePermissionsNumber(user.getPermissionsForGuild(guild)); + log.log(BotLog.TYPE.INFO, guild, "User "+user.getName()+" has permissions: "+userPermissions); return ((this.permissionsRequired & userPermissions) > 0) || (user.getLongID() == 235439851263098880L); } diff --git a/src/main/resources/Strings.properties b/src/main/resources/Strings.properties new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/Strings_nl.properties b/src/main/resources/Strings_nl.properties new file mode 100644 index 0000000..e69de29