Change players name over head and skin

Discussion in 'Spigot Plugin Development' started by Kingbluesapphire, May 24, 2016.

  1. For a disguise command i need to change the players name tag over their head i tried using

    Code (Text):
    nick = nick.replace("&", "§");
            PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, (((CraftPlayer)player).getHandle()));
            MinecraftServer.getServer().getPlayerList().sendAll(info);
            PacketPlayOutPlayerInfo newNick = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, (((CraftPlayer)player).getHandle()));
            MinecraftServer.getServer().getPlayerList().sendAll(newNick);
            player.setPlayerListName(RankManager.getPrefix(player) + ChatColor.WHITE + nick);
            player.setCustomName(nick);
            player.setDisplayName(nick);
    But that only changes the tab name and the packets don't seem to be doing anything,
    I'm also trying to get the skin of the player with the name the same as the value of "nick" but i don't even know how to start there

    Also, It doesnt print out any errors just doesn't work...
     
  2. MiniDigger

    Supporter

    I think you need to respawn the player to let it update the tag.
    send an destroy packet before you remove the player and a spawn packet after you added him back.
     
    • Agree Agree x 1
  3. Okx

    Okx

    You can use md-5's iTag, go check it out on his profile.
     
  4. MiniDigger

    Supporter

    iTag is not compatible with the latest protocollib versions iirc
     
  5. Okx

    Okx

    Isn't there yet another one called iTag-API?
     
  6. MiniDigger

    Supporter

  7. MiniDigger

    Supporter

  8. Any other suggestions to update/change a players name tag (and skin)? Hiding then showing the player didn't seem to work.
     
  9. MiniDigger

    Supporter

    just look at the source of iTag...
     
  10. iTag just shows then rehides the player it seems, didnt work for me...
     
  11. MiniDigger

    Supporter