diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java index 81519493..29a7bdcb 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/DiscordToMinecraftListener.java @@ -58,7 +58,7 @@ public class DiscordToMinecraftListener extends ListenerAdapter final Message msg = event.getMessage(); final String content = msg.getContentStripped(); - if (content.startsWith(ConfigEntry.DISCORD_PREFIX.getString()) && Discord.DISCORD_COMMAND_MANAGER.parse(content, member, textChannel)) + if (content.toLowerCase().startsWith(ConfigEntry.DISCORD_PREFIX.getString().toLowerCase()) && Discord.DISCORD_COMMAND_MANAGER.parse(content, member, textChannel)) { return; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/discord/command/DiscordCommandManager.java b/src/main/java/me/totalfreedom/totalfreedommod/discord/command/DiscordCommandManager.java index 1426444b..4f669230 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/discord/command/DiscordCommandManager.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/discord/command/DiscordCommandManager.java @@ -48,20 +48,20 @@ public class DiscordCommandManager public boolean parse(String content, Member member, TextChannel channel) { - List args = new ArrayList<>(Arrays.asList(content.split(" "))); + final String actualContent = content.substring(PREFIX.length()).trim(); + List args = new ArrayList<>(Arrays.asList(actualContent.split(" "))); if (args.isEmpty()) { return false; } - final String[] aliasParts = args.remove(0).split(PREFIX); - if (aliasParts.length < 2) + final String alias = args.get(0); + + if (alias.isEmpty()) { return false; } - final String alias = aliasParts[1]; - for (DiscordCommand command : commands) { if (command.getCommandName().equalsIgnoreCase(alias) || command.getAliases().contains(alias.toLowerCase()))