fix: duplicate entry check for IPFilterCommand too

This commit is contained in:
ChomeNS
2025-01-03 17:54:40 +07:00
parent 145a7fe2fe
commit 0cf8d94ff9
2 changed files with 10 additions and 1 deletions

View File

@@ -43,6 +43,15 @@ public class IPFilterCommand extends Command {
case "add" -> {
final String ip = context.getString(true, true);
if (IPFilterPlugin.localList.contains(ip)) {
throw new CommandException(
Component.translatable(
"The IP %s is already in the filters",
Component.text(ip)
)
);
}
DatabasePlugin.executorService.submit(() -> bot.ipFilter.add(ip));
return Component.translatable(
"Added %s to the filters",