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

    If you're the only person online there's nothing to change. You should only need to refresh once a minute if you're changing the name tag once every minute. You only need to call refresh if you want to change what the nametag is from its current value. If you want a player to join the server looking green, and stay green the entire time you never have to call refresh.
  2. Offline


    Is it possible to use player.getName (instead of md_5 or joehot200 etc)

    edit: whats the code for setting the name back to normal (like is there a SetNameTagOFF, or just set the tag to the players name again?)
  3. Offline


    If you mean in a method that takes a string, then yes?
  4. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    To set back to normal just call a refresh and don't change it in your event.
  5. Offline


    Whats the code for that? I don't see it anywhere (I have done things mostly with players, I am bad at packets, blocks, configs, etc)
  6. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    The refresh method? Documented on the first page of this topic.
  7. Offline


    thanks for pointing out my stupidity :D
  8. Offline



    Sorry to bug you, but what's wrong with this code?
    The message never gets sent to me when I log in. (I'm not sure if my nametag changed, haven't checked)

        public void onPlayerJoin(PlayerJoinEvent e){
            Player p = e.getPlayer();
        public void onNameTag(PlayerReceiveNameTagEvent e){
            Player p = e.getNamedPlayer();
            String name = p.getName();
                e.setTag(ChatColor.RED + name);
                p.sendMessage("Your nameplate has been set to " + e.getTag() + ".");
    There's no errors in the console, and I have "depend: [TagAPI]" in my plugin.yml. TagAPI and my plugin both start as they should.
    Thanks! :)
  9. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    You're joining the server alone. Nothing will fire until a second player joins within vision range ;)

    Also you don't need to fire refreshPlayer in join. Only needed if you're wanting to change the player's name tag some time after they've joined.
  10. Offline


    Thanks! Helpful as ever ;)
  11. Offline


    I am getting a VERY weird error!

    When I make my plugin change the players name, everyone who looks at me see's THEIR name!

    e.g. adam57175717 joined and said HEY! STOP USING MOBDISGUISE AS ME! then, another person said the same thing, and then another..

    and yet, Im only making the plugin change the colour?

    Here is the code:

    publicvoid onNameTag(PlayerReceiveNameTagEvent event){

    if (red.contains(event.getNamedPlayer().getName())){

    event.setTag(ChatColor.RED + event.getPlayer().getName());

    }elseif (blue.contains(event.getNamedPlayer().getName())){

    event.setTag(ChatColor.BLUE + event.getPlayer().getName());

    (well that's the change name code)

    I can probably fix it, but i thought I would let you be aware of the bug (or if it isn't a bug, then you will know my stupidity :) )

  12. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    joehot2000 getPlayer is the person receiving the packet for the other player's nametag. You want to be using getNamedPlayer() for the name tag. You called it correctly in the if statements, but not for setTag ;)

    joehot2000 Why are you calling the refresh method inside the event? Didn't we go over this already.

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


    Hello. What can I do if I have to build MCPC server 1.4.7. And your plugin tightly bound to the Bukit 1.4.7 0.1, and we have Version Plugin no load. Sorry english = translate
  14. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    If MCPC is based on craftbukkit, it'll work fine. If not, you're out of luck.
  15. Offline


    Console log:

    22:52:17 [INFO] [TagAPI] Enabling TagAPI v1.9.3
    22:52:17 [SEVERE] [TagAPI] Could not find support for this CraftBukkit version.
    Check for an update or pester mbaxter.
    22:52:17 [INFO] [TagAPI] Update hopefully available at http://dev.bukkit.org/ser

    There is a chance one day to correct this incompatibility? Or is it such a problem of the current version of the kernel?
  16. Offline


    Thanks for this API! I have set so players get diffrent colors depending on permission, if I change the permission the color wont change until they see the person again. Even if it doesnt refresh immediately its till great to know it will take care if itself next time the player is seen. Not sure how to implement refresh since I cant use a asynk timer.
  17. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Use a sync task to fire the refresh. Also you should be changing permissions sync as well.
  18. Offline


    Thank you!
    If I want to do just for players that have permission a color how can I do that?
    I tried this:
        public void onNameTag(PlayerReceiveNameTagEvent e){
        e.setTag(ChatColor.RED + e.getNamedPlayer().getPlayer().getName());
  19. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    orikenig getPlayer is the person seeing the other player ;)
  20. Offline


    I'm presuming you're referring to MCPC-Plus 1.4.7.

    As for TagAPI compatibility, I'm sure it's possible, though it would have to be specifically made compatible with MCPC. So, in the meantime, try using the latest developer build of ProtocolLib. I've just finished making it compatible, and TagAPI should detect it and use it instead of its own custom NMS hook.
  21. Offline


    This should be implemented into bukkit
  22. Offline


    Minecraft seemed to fix the unnecessary space at the end of the tag (when you add colors) :)
    xWatermelon likes this.
  23. Offline


    Whenever I try to refresh players they disappear. Is there a way to fix this?
  24. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    I've only seen one other report of this, where the refresh was being called in an inventory event. What are you triggering refresh on?
  25. Offline


    In one plugin it is when a player is joining a faction and in another it is when they are added to a team.
  26. Offline


    If I want to give a person a nickname like notch with a command, is that possible? also if I want to give a nickname to somebody when they kill somebody, i'd had to listen to playerdeathevent. how can I implement that into your plugin?
  27. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    If you want to change mid-game, you use the refresh method.
  28. Offline


    So if The named player kills someone, will I then go under playerdeathevent and refreshing their name there?
  29. Offline


    The snag I'm currently running into is that refreshing a player's tag causes all armor the player is wearing to disappear for all other players, until the player leaves the vicinity and returns, which I'm assuming has to do with the packet sorcery required to make this work. Is there any way you could do MORE packet sorcery to fix this, or is it something I'll just have to live with?
  30. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    That... shouldn't be happening. You sure you're using the latest version and not like, months old versions? :p
Thread Status:
Not open for further replies.

Share This Page