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ɐɥ ı

    valon750 the first post describes when it fires, which is more than when you call the method
     
    drtshock likes this.
  2. Offline

    valon750

    mbaxter

    Okay sorry but that just went right over my head. Granted it's 03:13am so give me a break..

    so I'm still very confused as to how I achieve this..

    I wait for the event to fire, I get the namedPlayer, check their name to see if it's on the other players friend list, if so, I set the players name to green, correct?
     
  3. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    valon750 correct. Refresh that specific player to player (there are three methods) relationship when friend status changes
     
    drtshock likes this.
  4. Offline

    valon750

    mbaxter

    Alright, I just imagined that event.setTag would of already set everything everything, at least that's the impression I get from reading the bits after the examples.

    mbaxter

    So I've woke up now (well, at least a tiny bit), am I correct in assuming this will achieve what I need?

    Code:
            List <String> friendlist = config.getStringList(playername + ".Friends");
            if (friendlist.contains(seenplayername)){
                event.setTag(ChatColor.GREEN + seenplayername);
                TagAPI.refreshPlayer(seenplayer, player);
            }
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 28, 2016
  5. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    valon750 do not refresh in the event. Read what the method does.
     
    drtshock likes this.
  6. Offline

    valon750

    mbaxter

    Yes sorry I noticed my mistake a bit ago, so I set it up so that it will refresh the players after doing a command... and I was met with something rather odd..

    Basically the name colours didn't change.. but one of the players became invisible..
     
  7. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    TagAPI 3.0 is now uploaded to BukkitDev. It introduces the AsyncPlayerReceiveNameTagEvent, and deprecates the previous PlayerReceiveNameTagEvent. It fires async (check isAsynchronous() to be sure) and thus doesn't have to wait on the main thread. Major improvement, since now all packets are coming into TagAPI async.

    Also, added code to the new event to let you change the UUID. No guarantee this will continue to be useful after 1.7, as Mojang is playing around with server/client communication, but I figured I'd add it anyway. If it becomes not useful in the future TagAPI will just ignore the changed UUID (Not breaking anything).

    Example code for confirming the latest is available:
    Code:
            try {
                Class.forName("org.kitteh.tag.AsyncPlayerReceiveNameTagEvent");
            } catch (final ClassNotFoundException e) {
                this.getLogger().severe("You need a newer version of TagAPI! Get it at http://dev.bukkit.org/server-mods/tag/");
                this.getServer().getPluginManager().disablePlugin(this);
                return;
            }
     
  8. Offline

    Comphenix

    Right, but isn't this a bit unnecessary? You could intercept the packet when its scheduled for transmission in the server thread, before it ever gets processed in the Netty thread. I do just that in ProtocolLib.

    Unlike AsyncPlayerChatEvent, the packet does originate from the server thread, so there's no technical reason for making it asynchronous. It's just easier to implement in TagAPI, but it's adds a whole new level of complexity for the plugins that use it. And as always, it only takes one misbehaving plugin for the server to randomly experience the dreaded ConcurrentModificationException. This may be an acceptable risk if the asynchronous event is unavoidable, though, but I don't think it is in this case.
     
    blablubbabc likes this.
  9. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    If developers can handle the chat event, with exceptions of newbie developers, I don't see the complexity argument having much merit. There's nothing pleasant about playing with packets in Minecraft, and I don't feel that what TagAPI is doing is sufficiently worse to warrant changing again. Your suggestion is neat, but I don't feel it's worth it in this case.
     
  10. Offline

    Comphenix

    Oh, don't get me wrong, I think most people can handle it. But it might be painful, depending on how the event handler is implemented.

    True, it's probably a bit late to change the now released API. That would either break newly updated plugins, or require depreciating a newly added event. I guess I should have brought this up sooner, but I didn't notice the change on GitHub.

    Yes, using TagAPI is certainly preferable to dealing with packets directly, no questions about it. Any plugin using ProtocolLib or NMS to rename players would have broken after 1.7.2 (as GameProfile was added to NAMED_ENTITY_SPAWN), whereas users of TagAPI was shielded from this change.

    But internal changes in the implementation shouldn't bubble up to the abstraction unless absolutely necessary, especially if you're writing an API. It was defensible in the case of Bukkit's chat event, though.

    At any rate, I don't want to make too much a fuss about this. I just felt I ought to point it out. :)
     
    mbaxter likes this.
  11. Offline

    Wizehh

    Does this break players' skins?
     
  12. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Skin is tied to the name over head, after colors are removed.
     
  13. Offline

    Wizehh

    mbaxter
    Code:java
    1. e.setTag(p.getDisplayName());

    Why does it break the skins?
    Edit (display name):
    Code:java
    1. p.setDisplayName(ChatColor.GREEN + p.getName());
     
  14. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    As documented, names get cut at 16 chars, so if your username is 15 or 16 long it's going to get cut and that'll result in a different name.
     
  15. Offline

    Wizehh

    mbaxter My name is 6 characters.
     
  16. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Well, if you just add color to it, the skin won't change. If you change the letters, it will.
     
  17. Offline

    Wizehh

    That's the thing; I didn't change the letters :/
     
  18. This is a great plugin! Can you please update it though?

    Mind making an updated version of this amazing plugin?

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

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Updated version? You want me to release updates for versions of minecraft that don't exist? The latest TagAPI is up to date.
     
  20. yeah I'm sorry for the double post. didn't realize that it worked. Anyway, well then why is it when I run my server, I get an error that says TagAPI isn't updated and won't work until I get an updated version?

    http://pastebin.com/aeAqEmEd
     
  21. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Because you're running the version of TagAPI that came out last April for Minecraft 1.5.2 ;)
     
  22. Well I downloaded the link from your page. So you should update your link ;)
     
  23. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    What page? Which link?
     
  24. I got it figured out. But thanks for your "effort"
     
  25. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Could you please tell me which of my pages has a link to 2.3 still?
     
  26. Offline

    97WaterPolo

    Is it possible to modify the nsme of a mob like a player? Normal named mobs name only show when your cross heirs are on it, looking for a way to have it at all times.
     
  27. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    setCustomNameVisible is your friend :)
     
  28. Offline

    Garris0n

    RIP TagAPI
     
    KingFaris11 likes this.
  29. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    From discussions with folks including Mojang staff on the #mcdevs channel, it should be doable still, just no skins anymore. Not going to make any big statement until I know for sure what I can and can't do.
     
  30. Offline

    97WaterPolo

    mbaxter
    I do use it but it still only works when the player is near the mob, not like a players tag that can be seen awhile out. Kind of hoping to use TagAPI to make it like a player name to be seen.
     
Thread Status:
Not open for further replies.

Share This Page