Merge branch 'master' into dev

This commit is contained in:
Irinyi Kabinet Felhasználó 2019-04-15 14:51:45 +02:00
commit c8680ae92c
2 changed files with 12 additions and 11 deletions

View file

@ -171,15 +171,10 @@
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
<!-- <dependency>
<dependency>
<groupId>com.discord4j</groupId>
<artifactId>Discord4J</artifactId>
<version>2.10.1</version>
</dependency> -->
<dependency>
<groupId>com.github.SizableShrimp</groupId>
<artifactId>Discord4J</artifactId>
<version>httprequestchange-SNAPSHOT</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
<dependency>

View file

@ -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)) {
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;
}
final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rolename);
rname = orn.get();
}
final List<IRole> 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);