TagAPI - Change/color the name over people's heads!

Discussion in 'Resources' started by mbaxter, Sep 6, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Name tag and skin are tied, client side
     
  2. Offline

    morshu9001

    Darn. Thanks for the answer.
     
  3. Offline

    aradabir007

    is it has pex support? so pex prefixes names in players head names?
     
  4. Offline

    Ultimate_n00b

    This is an API in the Plugin Development forum.. try searching BukkitDev.
     
  5. Offline

    amhokies

    With players that have longer usernames, I'm getting this error, and it's kicking everyone off the server:
    http://gyazo.com/4d8f6dfbf620f569de676e9d7e0550c4

    Is there anyway I can fix this other than trimming the usernames manually before setting the tag?
     
  6. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

  7. Offline

    amhokies

    Yeah, I figured that was the case. I read in the original post that it trims the tags if they are longer than 16 characters. To the best of my knowledge, there are no other plugins on the server that could be doing this, so I have no idea what the problem is.
    Here is my EventHandler method:
    http://pastebin.com/NLK2H1ij
    If anyone has any idea what this could be, or has had this problem, please let me know so I can try and fix it. Until then, I'll just be manually trimming the players' names to 14 characters before adding color codes.
     
  8. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    amhokies Are you perhaps using the scoreboard API?
     
    amhokies likes this.
  9. Offline

    amhokies

    Wow, I can't believe I missed that. I am indeed using the scoreboards to list the players in an arena. I know what the problem is now. Thanks!
     
  10. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Testing a 1.7 update currently :)
     
    jorisk322 likes this.
  11. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    The 1.7 version is now available on BukkitDev :)
     
  12. Offline

    bars96

    I want to change PlayerReceiveNameTagEvent event priority via command /tag. How I can do it?
     
  13. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Multiple listeners that you toggle listening based on the command? This isn't really a TagAPI question but a general bukkit question ;)
     
    bars96 likes this.
  14. Offline

    Swords761

  15. Offline

    Muhammadazka

    Can i create like example: If i Hit or hitted by entity player, may nametag or enemy nametag will change into Any color what i want. Can you help me for this?
     
  16. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Read the information on the first post :)
     
  17. Offline

    DavidSBB

    Hi, just a little question...
    The ProtocolLib page says I should use the developer build of TagAPI, where can I find them?

    -DavidSBB
     
  18. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    There is nothing special about the latest dev build, nor should you ever use dev builds of TagAPI unless you know exactly why you're doing it (And "ProtocolLib said to!" is not a reason). Just use the release.

    Comphenix
     
  19. Offline

    DavidSBB

    Thanks! I tried it and it works perfectly fine.

    Just in case you thought I was - I'm not a unexperienced little Bukkit Kiddie ;), but I wondered why it's on the ProtocolLib page then.

    -DavidSBB
     
  20. I get an error on
    Code:java
    1. PlayerReceiveNametagEvent
     
  21. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Without seeing the error I can't help
     
    drtshock likes this.
  22. Offline

    Comphenix

    Have you added TagAPI to your ClassPath?
     
  23. Comphenix
    Yes

    mbaxter
    Code:java
    1.  
    2. public class Tag {
    3.  
    4. @EventHandler
    5. public void onNameTag(PlayerReceiveNametagEvent event) {
    6. if (event.getPlayer().getName().equals("bill4788")) {
    7. event.setTag(ChatColor.RED + "notch");
    8. }
    9. }
    10.  
    11. }
    12.  


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  24. Offline

    valon750

    mbaxter

    Just got round to playing around with this, but there's one thing that just doesn't make much sense to me.

    You explain how I can have it so only a specific player can see the altered name, that being TagAPI.refreshPlayer(player, forWhom);, however, I wasn't too sure how I can link that to the PlayerReceiveNameTagEvent.

    What I'm going for, is if a player sees another player, let's make this player1 and player2, if player1 and player2 are "friends" (they're on each others friend list, set in plugin), then it will display their names in green.

    I can see how I would change it with the event, but only so everyone would see the name change, as refreshPlayer toggles the event in itself I get a bit lost.
     
  25. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    That's not a Listener.

    Refresh is only for if you wish to update a tag as seen by a player when both are in game within vision range. Otherwise just listen for the event. The refresh method will hide and then reveal the player to another player(s), which this fires the event letting you decide what tag the player receiving the tag sees. Remember that two players are available in the event: The one whose tag you are setting and the player who will see the tag.
     
    drtshock likes this.
  26. Offline

    valon750

    mbaxter

    Oh, sorry but it was under my impression that simply listening for the event, and using the methods available will result in either everyone seeing the coloured name, or everyone around the seen person will change?

    Edit:
    Side-Note: event.setTag(string) will simply change it for everyone, so everyone would see the players name in green. What I need is it to be limited to people on the persons friends list, but I don't see a solution without refreshPlayer, which just confuses me xD
     
  27. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Please read the first post in this thread which explains how the event works
     
    drtshock likes this.
  28. Offline

    valon750

    mbaxter

    I've already read it, thank you.

    All it explains is how I can set it so that every name one of the players see will be the same, OR that everyone will see the players new name.

    Neither of these achieve what I wanted.
     
  29. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    It looks like you've read the two examples bit not the paragraphs around the which explain how the event does not fire only once when the player joins but once per player-seeing-player. You can affect every single player's name tags as seen by every single other player individually.
     
    drtshock likes this.
  30. Offline

    valon750

    mbaxter

    So all I see is the refreshPlayer methods, which I mentioned in my first post confuses me, as It simply refreshes the name, but if I were to set the tag during the event, then use the refreshPlayer method, surely they wouldn't work together, as the setTag would of already set it to either show every player the seen players name, or show everyone elses new name to the seen player.
     
Thread Status:
Not open for further replies.

Share This Page