Merge branch 'master' into dev
This commit is contained in:
commit
c8680ae92c
2 changed files with 12 additions and 11 deletions
7
pom.xml
7
pom.xml
|
@ -171,15 +171,10 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
|
<!-- https://mvnrepository.com/artifact/com.discord4j/Discord4J -->
|
||||||
<!-- <dependency>
|
<dependency>
|
||||||
<groupId>com.discord4j</groupId>
|
<groupId>com.discord4j</groupId>
|
||||||
<artifactId>Discord4J</artifactId>
|
<artifactId>Discord4J</artifactId>
|
||||||
<version>2.10.1</version>
|
<version>2.10.1</version>
|
||||||
</dependency> -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.SizableShrimp</groupId>
|
|
||||||
<artifactId>Discord4J</artifactId>
|
|
||||||
<version>httprequestchange-SNAPSHOT</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
|
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import buttondevteam.discordplugin.commands.ICommand2DC;
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
import buttondevteam.lib.chat.Command2;
|
import buttondevteam.lib.chat.Command2;
|
||||||
import buttondevteam.lib.chat.CommandClass;
|
import buttondevteam.lib.chat.CommandClass;
|
||||||
|
import lombok.val;
|
||||||
import sx.blah.discord.handle.obj.IRole;
|
import sx.blah.discord.handle.obj.IRole;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -63,12 +64,17 @@ public class RoleCommand extends ICommand2DC {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IRole checkAndGetRole(Command2DCSender sender, String rolename) {
|
private IRole checkAndGetRole(Command2DCSender sender, String rolename) {
|
||||||
if (!grm.GameRoles.contains(rolename)) {
|
String rname = rolename;
|
||||||
sender.sendMessage("that role cannot be found.");
|
if (!grm.GameRoles.contains(rolename)) { //If not found as-is, correct case
|
||||||
list(sender);
|
val orn = grm.GameRoles.stream().filter(r -> r.equalsIgnoreCase(rolename)).findAny();
|
||||||
return null;
|
if (!orn.isPresent()) {
|
||||||
|
sender.sendMessage("that role cannot be found.");
|
||||||
|
list(sender);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
rname = orn.get();
|
||||||
}
|
}
|
||||||
final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rolename);
|
final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rname);
|
||||||
if (roles.size() == 0) {
|
if (roles.size() == 0) {
|
||||||
sender.sendMessage("the specified role cannot be found on Discord! Removing from the list.");
|
sender.sendMessage("the specified role cannot be found on Discord! Removing from the list.");
|
||||||
grm.GameRoles.remove(rolename);
|
grm.GameRoles.remove(rolename);
|
||||||
|
|
Loading…
Reference in a new issue