use of gartham.c10ver.economy.Server in project c10ver by Gartham.
the class CloverGuildMemberAddRoleConsumer method consume.
@Override
public boolean consume(GuildMemberRoleAddEvent event, InputProcessor<? extends GuildMemberRoleAddEvent> processor, InputConsumer<GuildMemberRoleAddEvent> consumer) {
var e = (GuildMemberRoleAddEvent) event;
Server s = clover.getEconomy().getServer(e.getGuild().getId());
var role = s.getVoteRole();
if (role != null)
for (Role r : e.getRoles()) if (r.getId().equals(role)) {
try {
e.getGuild().removeRoleFromMember(e.getMember(), r).queue();
} catch (Exception er) {
System.err.println("An error occurred while attempting to remove the vote role from a user!");
er.printStackTrace();
}
clover.getVoteManager().handleVoteRoleAdded(e.getMember());
break;
}
return false;
}
Aggregations