mirror of
https://github.com/Shimeo98/DiscordWhitelisterSpigot.git
synced 2025-01-10 10:28:26 +01:00
changed role check to equals instead of contains
solves the issue where another role with a similar name as another permission role will be treated the same.
This commit is contained in:
parent
a860ca17b5
commit
bb9af73581
@ -1,5 +1,5 @@
|
||||
name: DiscordWhitelister
|
||||
version: 1.0.4
|
||||
version: 1.0.5
|
||||
author: Joe Shimell
|
||||
main: uk.co.angrybee.joe.DiscordWhitelister
|
||||
description: Discord whitelister bot.
|
||||
|
@ -73,7 +73,7 @@ public class ServerDiscordClient extends ListenerAdapter
|
||||
|
||||
for(Role role : messageReceivedEvent.getGuild().getMember(messageReceivedEvent.getAuthor()).getRoles())
|
||||
{
|
||||
if(Arrays.stream(allowedToAddRemoveRoles).parallel().anyMatch(role.getName()::contains))
|
||||
if(Arrays.stream(allowedToAddRemoveRoles).parallel().anyMatch(role.getName()::equalsIgnoreCase))
|
||||
{
|
||||
userCanAddRemove = true;
|
||||
}
|
||||
@ -81,7 +81,7 @@ public class ServerDiscordClient extends ListenerAdapter
|
||||
|
||||
for(Role role : messageReceivedEvent.getGuild().getMember(messageReceivedEvent.getAuthor()).getRoles())
|
||||
{
|
||||
if(Arrays.stream(allowedToAddRoles).parallel().anyMatch(role.getName()::contains))
|
||||
if(Arrays.stream(allowedToAddRoles).parallel().anyMatch(role.getName()::equalsIgnoreCase))
|
||||
{
|
||||
userCanAdd = true;
|
||||
}
|
||||
@ -93,7 +93,7 @@ public class ServerDiscordClient extends ListenerAdapter
|
||||
// check if user is in a limited add role
|
||||
for(Role role : messageReceivedEvent.getGuild().getMember(messageReceivedEvent.getAuthor()).getRoles())
|
||||
{
|
||||
if(Arrays.stream(allowedToAddLimitedRoles).parallel().anyMatch(role.getName()::contains))
|
||||
if(Arrays.stream(allowedToAddLimitedRoles).parallel().anyMatch(role.getName()::equalsIgnoreCase))
|
||||
{
|
||||
userHasLimitedAdd = true;
|
||||
}
|
||||
@ -124,7 +124,7 @@ public class ServerDiscordClient extends ListenerAdapter
|
||||
if(userCanAddRemove || userCanAdd)
|
||||
{
|
||||
channel.sendMessage("```Discord Whitelister Bot For Spigot" + System.lineSeparator() +
|
||||
"Version: 1.0.4" + System.lineSeparator() + "Links:" + System.lineSeparator() +
|
||||
"Version: 1.0.5" + System.lineSeparator() + "Links:" + System.lineSeparator() +
|
||||
"https://www.spigotmc.org/resources/discord-whitelister.69929/" + System.lineSeparator() + "https://github.com/JoeShimo/DiscordWhitelisterBot-Spigot" + System.lineSeparator() +
|
||||
"Commands:" + System.lineSeparator() + "Add:" + System.lineSeparator() +
|
||||
"!whitelist add <MinecraftUsername> -- Usage: Adds a user to the whitelist" + System.lineSeparator() +
|
||||
|
Loading…
Reference in New Issue
Block a user