feat: re-add ClearChatNameAnnouncerPlugin (it's under a different name)

This commit is contained in:
ChomeNS
2024-12-07 16:01:18 +07:00
parent c2bab61c09
commit bf70930cd8
3 changed files with 35 additions and 1 deletions

View File

@@ -1 +1 @@
1208
1211

View File

@@ -88,6 +88,7 @@ public class Bot {
public AuthPlugin auth;
public ScreensharePlugin screenshare;
public FormatCheckerPlugin formatChecker;
public ClearChatNameAnnouncerPlugin clearChatNameAnnouncer;
public WhitelistPlugin whitelist;
public PlayersPersistentDataPlugin playersPersistent;
public IPFilterPlugin ipFilter;
@@ -137,6 +138,7 @@ public class Bot {
this.auth = new AuthPlugin(this);
// this.screenshare = new ScreensharePlugin(this);
this.formatChecker = new FormatCheckerPlugin(this);
this.clearChatNameAnnouncer = new ClearChatNameAnnouncerPlugin(this);
this.whitelist = new WhitelistPlugin(this);
this.playersPersistent = new PlayersPersistentDataPlugin(this);
this.ipFilter = new IPFilterPlugin(this);

View File

@@ -0,0 +1,32 @@
package me.chayapak1.chomens_bot.plugins;
import me.chayapak1.chomens_bot.Bot;
import me.chayapak1.chomens_bot.data.PlayerEntry;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
public class ClearChatNameAnnouncerPlugin extends CommandSpyPlugin.Listener {
private final Bot bot;
public ClearChatNameAnnouncerPlugin (Bot bot) {
this.bot = bot;
bot.commandSpy.addListener(this);
}
@Override
public void commandReceived(PlayerEntry sender, String command) {
if (
command.equals("/clearchat") ||
command.equals("/cc") ||
command.equals("/extras:clearchat") ||
command.equals("/extras:cc")
) {
bot.chat.tellraw(
Component.translatable("%s cleared the chat")
.arguments(Component.selector(sender.profile.getName()))
.color(NamedTextColor.DARK_GREEN)
);
}
}
}