this should work

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

View file

@ -16,5 +16,5 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="temurin-20" project-jdk-type="JavaSDK" />
</project> </project>

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.FilteredPlayer;
import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry; import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerEntry;
import land.chipmunk.chayapak.chomens_bot.data.chat.PlayerMessage; 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.PersistentDataUtilities;
import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities; import land.chipmunk.chayapak.chomens_bot.util.UUIDUtilities;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
@ -103,6 +104,19 @@ public class FilterPlugin extends PlayersPlugin.Listener {
doAll(target); 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) { public void commandSpyMessageReceived (PlayerEntry sender) {
final FilteredPlayer player = getPlayer(sender.profile.getName()); final FilteredPlayer player = getPlayer(sender.profile.getName());