I’m looking to obfuscate a player’s name tag so other players can’t read it unless the 2 players are “friends”. I’m guessing the best way to go about this is to set all non-friend players team prefix to &k. My problem is that all players will have different friend lists so all players will require different players to have the obfuscate team prefix, is this possible?
This is possible, through the use of per-player scoreboards.
To make this work, you’ll want to give each player a different scoreboard instance (which you can create by getting a
ScoreboardBuilder from the
GameRegistry). Each scoreboard will have a unique
Team associated with it, with an obfuscated prefix set. You can than control which names will appear obfuscated for a particular player, by adding player’s to their
Note that due to a bug with the Text API, you’ll need to set the prefix to
Texts.of(TextStyles.OBFUSCATED, ""), in order for it to properly display on the client.
Thanks, I’ll test this ASAP. Also, will this change the name in the player list as well?
Yes, it will.