Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by Dark4ty, May 16, 2015.
How could I change the name above the head in Spigot/bukkit 1.8?
PacketPlayOutPlayerInfo with action REMOVE_PLAYER
PacketPlayOutPlayerInfo with action ADD_PLAYER with a different name (perhaps through reflecting on the packet data)
PacketPlayOutDestroyEntity to all players except you.
PacketPlayOutNamedEntitySpawn to all players except you.
I got a class from another website
but it say's 'The constructor PlayerInfoData(PacketPlayOutPlayerInfo, GameProfile, int, WorldSettings.EnumGamemode, IChatBaseComponent) is undefined' -> Line 58
and 'The constructor PlayerInfoData(PacketPlayOutPlayerInfo, GameProfile, int, null, null) is undefined' -> Line 50
What's wrong with my code?
I'm assuming your spigot dependency is outdated. Are you depending on 1.8.3 (note: not your server version!)
Yes I do, 10 minutes ago I updated to the newest Spigot version, but it's still the same issue @DarkSeraphim
If I understand you're question right, you want to change the player's nametag. Check out this tutorial by PogoStick29Dev.
Thanks for trying to help me, but TagAPI is already outdated :/ I'm searching a way for 1.8...
Ah well then it may be a bit more complex
Hey, set the playerinfodata over the instance from the packet that you defined.
PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo();
setInfo(info, EnumPlayerInfoAction.ADD_PLAYER, info.new PlayerInfoData(prof, entity.ping, entity.playerInteractManager.getGameMode(), CraftChatMessage.fromString(name)));
TagAPI no longer works for 1.8+
Thanks dude, now it works !
So I send the packet to all players and then when someone joins the game, do I have to send him too ?
Depends. If you change their name internally (the name field in the GameProfile instance in EntityHuman), then no.
Ok thanks!But I have no clue on how to change name field in the GameProfile xD maybe you could do a tutorial or post pseudocode?
If you just want to do colors/prefixes/suffixes you can use Bukkits Team/Scoreboard API
Im also wondering how to do this.
Yes, I know but I'd like to have an alternative through packets.