1
0

add blocked message alert

This commit is contained in:
Lee
2024-03-28 19:25:04 +00:00
parent 9a599f319e
commit 74deffbf82
6 changed files with 35 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import cc.fascinated.account.Account;
import cc.fascinated.account.AccountManager;
import cc.fascinated.config.Lang;
import cc.fascinated.utils.Manager;
import cc.fascinated.utils.MessageUtils;
import cc.fascinated.utils.Style;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.kyori.adventure.text.Component;
@ -38,6 +39,10 @@ public class ChatManager extends Manager {
// Check if the message contains a domain and is not the server's domain.
if (domainPattern.matcher(messageContent).find() && !messageContent.contains("aetheria.cc")) {
blockedMessage = true;
MessageUtils.messageOps(Lang.BLOCKED_MESSAGE_ALERT.getAsString()
.replace("%player%", account.getName())
.replace("%message%", messageContent)
);
}
// Block the message if it is the same as the last message sent.