Change name above Head Spigot 1.8

Discussion in 'Spigot Plugin Development' started by Dark4ty, May 16, 2015.

Thread Status:
Not open for further replies.
  1. How could I change the name above the head in Spigot/bukkit 1.8?
     
  2. Send a
    • 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.
     
    • Useful Useful x 4
    • Like Like x 1
    • Informative Informative x 1
  3. 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?

    @DarkSeraphim
     
    #3 Dark4ty, May 16, 2015
    Last edited: May 20, 2015
  4. I'm assuming your spigot dependency is outdated. Are you depending on 1.8.3 (note: not your server version!)
     
  5. Yes I do, 10 minutes ago I updated to the newest Spigot version, but it's still the same issue:( @DarkSeraphim
     
  6. If I understand you're question right, you want to change the player's nametag. Check out this tutorial by PogoStick29Dev.

     
  7. Thanks for trying to help me, but TagAPI is already outdated :/ I'm searching a way for 1.8... :)
     
  8. Ah well then it may be a bit more complex :D
     
  9. Hey, set the playerinfodata over the instance from the packet that you defined.

    Example

    Code (Text):
    PacketPlayOutPlayerInfo info = new PacketPlayOutPlayerInfo();
    setInfo(info, EnumPlayerInfoAction.ADD_PLAYER, info.new PlayerInfoData(prof, entity.ping, entity.playerInteractManager.getGameMode(), CraftChatMessage.fromString(name)[0]));
     
    • Agree Agree x 2
  10. JamesJ

    Supporter

    Lol.
    TagAPI no longer works for 1.8+
     
    • Friendly Friendly x 1
  11. Thanks dude, now it works :) !
     
  12. So I send the packet to all players and then when someone joins the game, do I have to send him too ?
     
  13. Depends. If you change their name internally (the name field in the GameProfile instance in EntityHuman), then no.
     
    • Like Like x 1
  14. 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?
     
  15. If you just want to do colors/prefixes/suffixes you can use Bukkits Team/Scoreboard API
     
    • Agree Agree x 1
    • Informative Informative x 1
  16. Im also wondering how to do this.
     
  17. Yes, I know but I'd like to have an alternative through packets.
     
Thread Status:
Not open for further replies.