added command to set roles for which experience gain is disabled

and separate command to remove them from the list again
added command to see all roles for which experience gain is disabled
This commit is contained in:
Sheldan
2020-05-17 20:35:53 +02:00
parent cf1816597c
commit 0260862e8e
27 changed files with 380 additions and 13 deletions

View File

@@ -14,11 +14,9 @@ import net.dv8tion.jda.api.entities.Emote;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.TextChannel;
import net.dv8tion.jda.api.utils.cache.CacheFlag;
import org.springframework.stereotype.Service;
import javax.security.auth.login.LoginException;
import java.util.EnumSet;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

View File

@@ -87,6 +87,11 @@ public class RoleServiceBean implements RoleService {
return roles.stream().map(this::getRoleFromGuild).collect(Collectors.toList());
}
@Override
public boolean hasAnyOfTheRoles(Member member, List<ARole> roles) {
return member.getRoles().stream().anyMatch(role1 -> roles.stream().anyMatch(role -> role.getId() == role1.getIdLong()));
}
@Override
public boolean memberHasRole(Member member, Role role) {
return member.getRoles().stream().anyMatch(role1 -> role1.getIdLong() == role.getIdLong());