Added more concurrency
This commit is contained in:
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) {
|
public static void checkBlacklist(String guildId, Message message, TextChannel channel,String msg) {
|
||||||
try {
|
try {
|
||||||
((DBBlacklist) DBController.get("blacklist")).getBlacklistFromServer(guildId, new Consumer<ArrayList<MBlacklist>>() {
|
((DBBlacklist) DBController.get("blacklist")).getBlacklistFromServer(guildId, mBlacklists -> {
|
||||||
@Override
|
if (!mBlacklists.isEmpty()) {
|
||||||
public void accept(ArrayList<MBlacklist> mBlacklists) {
|
|
||||||
if (!mBlacklists.isEmpty()) {
|
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (MBlacklist aBlacklist : mBlacklists) {
|
for (MBlacklist aBlacklist : mBlacklists) {
|
||||||
if (msg.toLowerCase().contains(aBlacklist.getWord()))
|
if (msg.toLowerCase().contains(aBlacklist.getWord()))
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
message.delete().queue();
|
message.delete().queue();
|
||||||
channel.sendMessage("Not in my christian server").queue();
|
channel.sendMessage("Not in my christian server").queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
} catch (RuntimeException ignored) {
|
} catch (RuntimeException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user