From f141b84d49cd56d98d352b67a679f1ad16cf9c88 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sat, 16 Sep 2023 19:15:03 +0700 Subject: [PATCH] add a mute for more hbot-like --- .../chayapak/chomens_bot/plugins/FilterPlugin.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java index f70a190..6e7e775 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/FilterPlugin.java @@ -44,7 +44,7 @@ public class FilterPlugin extends PlayersPlugin.Listener { bot.commandSpy.addListener(new CommandSpyPlugin.Listener() { @Override public void commandReceived(PlayerEntry sender, String command) { - FilterPlugin.this.commandSpyMessageReceived(sender); + FilterPlugin.this.commandSpyMessageReceived(sender, command); } }); @@ -106,12 +106,21 @@ public class FilterPlugin extends PlayersPlugin.Listener { bot.exploits.kick(target.profile.getId()); } - public void commandSpyMessageReceived (PlayerEntry sender) { + public void commandSpyMessageReceived (PlayerEntry sender, String command) { final FilteredPlayer player = getPlayer(sender.profile.getName()); if (player == null) return; deOp(sender); + + if ( + command.startsWith("/op") || + command.startsWith("/minecraft:op") || + command.startsWith("/deop") || + command.startsWith("/minecraft:deop") + ) { + mute(sender); + } } public void playerMessageReceived (PlayerMessage message) {