From a9d4d5e9e1fb8f2cc79ed7c60e83f0ef3947cadb Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sun, 17 Mar 2019 22:56:17 +0100 Subject: [PATCH 1/2] Use previous version of D4J Hopefully resolves mysterious NoSuchMethodError --- pom.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 270da7f..4fb93cb 100755 --- a/pom.xml +++ b/pom.xml @@ -162,15 +162,10 @@ provided - - - com.github.SizableShrimp - Discord4J - httprequestchange-SNAPSHOT From 8e2538e5532bb60fd1a274b377edfd408ecdd76e Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 5 Apr 2019 17:26:10 +0200 Subject: [PATCH 2/2] Ignore case for role command --- .../discordplugin/role/RoleCommand.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java b/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java index 19d78cf..3381ae4 100755 --- a/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java +++ b/src/main/java/buttondevteam/discordplugin/role/RoleCommand.java @@ -7,6 +7,7 @@ import buttondevteam.discordplugin.commands.ICommand2DC; import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.chat.Command2; import buttondevteam.lib.chat.CommandClass; +import lombok.val; import sx.blah.discord.handle.obj.IRole; import java.util.List; @@ -63,12 +64,17 @@ public class RoleCommand extends ICommand2DC { } private IRole checkAndGetRole(Command2DCSender sender, String rolename) { - if (!grm.GameRoles.contains(rolename)) { - sender.sendMessage("that role cannot be found."); - list(sender); - return null; + String rname = rolename; + if (!grm.GameRoles.contains(rolename)) { //If not found as-is, correct case + val orn = grm.GameRoles.stream().filter(r -> r.equalsIgnoreCase(rolename)).findAny(); + if (!orn.isPresent()) { + sender.sendMessage("that role cannot be found."); + list(sender); + return null; + } + rname = orn.get(); } - final List roles = DiscordPlugin.mainServer.getRolesByName(rolename); + final List roles = DiscordPlugin.mainServer.getRolesByName(rname); if (roles.size() == 0) { sender.sendMessage("the specified role cannot be found on Discord! Removing from the list."); grm.GameRoles.remove(rolename);