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...
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.
looks like there is https://www.spigotmc.org/resources/itag-api.18685/ https://github.com/ataranlen/iTag
I'm trying to do this without using API and I'm alittle new to packets how would I destroy for his name and add the new one, I never really use packets
I just noticed you don't need to do that, hiding and showing should be enough. Take a look how iTag handles the refreshing https://github.com/ataranlen/iTag/blob/master/src/main/java/net/md_5/itag/iTag.java#L155
Any other suggestions to update/change a players name tag (and skin)? Hiding then showing the player didn't seem to work.
take a look at this then: https://www.spigotmc.org/resources/1-7-1-8-1-9-1-10-nicknamer-integrated-api.5341/