this should work

This commit is contained in:
ChomeNS
2023-09-29 20:56:47 +07:00
parent a830b7a701
commit 1f177de955
2 changed files with 15 additions and 1 deletions

View File

@@ -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());