Changing player nametags

Discussion in 'Spigot Plugin Development' started by Debugged, May 12, 2016.

  1. Hello,

    Is the thing mentioned in the title still possible with spigot 1.8? I have been googling and trying for so long now but I can't seem to find out how to do this.
    Does anyone know a a way to do this?

    Thanks,
    Alex
     
  2. MiniDigger

    Supporter

    do you want to completly change the nametag or just color it or add a prefix/suffix?
    if you want to completly change it, then there are libs for you, for the other parts use the scoreboard.
     
  3. I know how to add prefix and suffix but I want to completely change it.
     
  4. MiniDigger

    Supporter

    you need to send 4 packets in the right order:
    PacketPlayOutEntityDestroy "kill" the player
    PacketPlayOutPlayerInfo (with action remove) "disconnect" the player
    PacketPlayOutPlayerInfo (with action add) "connect" a new player (your old player with a new name)
    PacketPlayOutNamedEntitySpawn "spawn" the new player

    I suggest using wiki.vg to find out what paramters the packets need
     
  5. Look at some reflection to change name field in craftplayer and respawning him (hiding + respawning from other players).
     
  6. Wouldn't this mean that the player kind of flickers for other players?
    I'm wanting to update the name every second so I think it would be pretty flickery, wouldn't it?
     
  7. MiniDigger

    Supporter

    don't, just don't.
    I have no idea if it would flicker or not, but when you send 4 packets to every player every seconds, some of your players with bad pcs or bad connections get basicly dosed
     
    • Useful Useful x 1
  8. Would there be another way to change the nametag?
     
  9. Why should you send destroy and spawn packets?
     
  10. MiniDigger

    Supporter

    else the client will not detected the player as a new player
     
  11. Are you sure? :cool:
     
  12. MiniDigger

    Supporter

    no, did nothing related to that stuff for like a year ^^