Added more concurrency

This commit is contained in:
Anthony committed 2018-04-02 10:15:42 -04:00
1 parent 51c470a9bc
commit 6276a68d98
1 file changed
+13 -16
@@ -55,24 +55,21 @@ public class MessageFunction {
public static void checkBlacklist(String guildId, Message message, TextChannel channel,String msg) {
try {
((DBBlacklist) DBController.get("blacklist")).getBlacklistFromServer(guildId, new Consumer<ArrayList<MBlacklist>>() {
@Override
public void accept(ArrayList<MBlacklist> mBlacklists) {
if (!mBlacklists.isEmpty()) {
((DBBlacklist) DBController.get("blacklist")).getBlacklistFromServer(guildId, mBlacklists -> {
if (!mBlacklists.isEmpty()) {
boolean found = false;
for (MBlacklist aBlacklist : mBlacklists) {
if (msg.toLowerCase().contains(aBlacklist.getWord()))
found = true;
}
boolean found = false;
for (MBlacklist aBlacklist : mBlacklists) {
if (msg.toLowerCase().contains(aBlacklist.getWord()))
found = true;
}
if (found) {
message.delete().queue();
channel.sendMessage("Not in my christian server").queue();
}
}
}
});
if (found) {
message.delete().queue();
channel.sendMessage("Not in my christian server").queue();
}
}
});
} catch (RuntimeException ignored) {
}
}