From 1f177de955ac2c1b10a0f9b87e15b296258641de Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 29 Sep 2023 20:56:47 +0700 Subject: [PATCH] this should work --- .idea/misc.xml | 2 +- .../chayapak/chomens_bot/plugins/FilterPlugin.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 58ae056..305d43a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -16,5 +16,5 @@ - + \ No newline at end of file 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 f1cb9ec..e3b4403 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 @@ -7,6 +7,7 @@ import land.chipmunk.chayapak.chomens_bot.Bot; import land.chipmunk.chayapak.chomens_bot.data.FilteredPlayer; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; +import land.chipmunk.chayapak.chomens_bot.util.ComponentUtilities; import land.chipmunk.chayapak.chomens_bot.util.PersistentDataUtilities; import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities; import net.kyori.adventure.text.Component; @@ -103,6 +104,19 @@ public class FilterPlugin extends PlayersPlugin.Listener { doAll(target); } + @Override + public void playerDisplayNameUpdated(PlayerEntry target, Component displayName) { + final FilteredPlayer player = getPlayer(target.profile.getName()); + + if (player == null) return; + + // we use the stringified instead of the component because you can configure the OP and DeOP tag in + // the extras config + final String stringifiedDisplayName = ComponentUtilities.stringify(displayName); + + if (stringifiedDisplayName.equals("[OP]")) deOp(target); + } + public void commandSpyMessageReceived (PlayerEntry sender) { final FilteredPlayer player = getPlayer(sender.profile.getName());