1.15.2 Set display name for player's nametag

Discussion in 'Spigot Plugin Development' started by ImSylent, Mar 22, 2020.

  1. I'm trying to put ranks into tab and above player's heads. I use Player.setPlayerListName() for tab, but is there a method similar to this for player nametags as well?
  2. For players? Nope,the way most plugins hadle this is spawning a invisible entity,naming it that certain tag,and using packets send it to people(if you want it client-sided) wich is the best for this
  3. Hey, I wrote a code for you to understand the logical things for setting the format / prefix / tag.

    Code (Java):
        public void onChat(AsyncPlayerChatEvent e) {
            Player player = e.getPlayer();
            String msg = e.getMessage();
            if(player.isOp()) {
                e.setFormat(ChatColor.RED + "OWNER" + ChatColor.DARK_AQUA + player.getName() + " " + msg);
    As I said, if you get the logic, you can start, trying to use for all ranks. Good luck!
  4. He's talking about placing a tag in the username above a player,not in chat..
  5. Oh, yeah. Sorry for that. But maybe, this will be needed in future. I won't delete it! :)
  6. You can use Scoreboard and Teams to add prefixes and suffixes to players. I even recall finding a way to change the displayed player name with them (and I didn't write it down, annoying me to no end).

    Alternatively using protocol hacks, e.g. via ProtocolLib, should do the trick as well.
  7. I've tried using scoreboard teams but they were a hassle to use so I might try and use ProtocolLib.
    That code is incorrect. You are meant to use %s to insert the username and chat message. That is also not what I asked.
    That sounds a bit over-complicated compared to scoreboard teams/ProtocolLib.
    • Informative Informative x 1
  8. Bump. Has anyone found a solution? The ones I've found either use NMS or scoreboard teams. I'm looking for one that is purely protocollib
  9. I would like to know how to do this as well
    Is it possible to have multiple lines as well?