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

    Ubuntu

    I'm confused, how do I make the event get called to set the players name?
     
  2. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    The event is called automagically whenever a player is about to receive the name tag of another player. You can also force name tags to update (And thus call the event) with the refresh method.
     
  3. Offline

    Ubuntu

    I want to update the tag colour at different points in the plugin, i've got it to set every players name to green when they join but after that it won't change, i'm calling the TagAPI.refresh...(p); (p being the player who i wants tag to change). Is that correct?
     
  4. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    That is correct.
     
  5. Offline

    Ubuntu

    it isnt working:

    Code:
        @EventHandler
        public void onNameTag(PlayerReceiveNameTagEvent event) {
            MSTeam pt = new MSTeam(event.getNamedPlayer());
            String name = event.getNamedPlayer().getName();
           
            if (pt.isInBlueTeam()) {
                event.setTag(ChatColor.BLUE + name);
            } else if (pt.isInRedTeam()) {
                event.setTag(ChatColor.DARK_RED + name);
            } else {
                event.setTag(ChatColor.GREEN + name);
            }
        }
    Code:
        public boolean isInBlueTeam() {
            if (blueteam != null) {
                return blueteam.contains(p.getName());
            }
            return false;
        }
    Code:
        public void setBlueTeam(Player p) {
            blueteam.add(p.getName());
            TagAPI.refreshPlayer(p);
        }
     
  6. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    I have noticed that some people are using hacked, broken CraftBukkit builds that break TagAPI and other plugins. I'm adding some more code to hopefully detect sooner when a bad build is being used.
     
  7. Offline

    Limeth

    Hello,
    Not sure if this question was already answered, but I've looked all around the internet and haven't found anything.
    Is there a way to completely remove player's nametag without leaveing a dark box above head?
     
  8. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    Rumor has it four ChatColor.COLOR_CHAR does it.
     
  9. Offline

    YoFuzzy3

    I have a BukkitRunnable that starts when my plugin enables, it refreshes the name tags using TagAPI.refreshPlayer(player) and works fine. But if I do a /reload it starts generating exceptions saying org.kitteh.tag.api.TagAPIException: Can't fire TagAPI method while TagAPI is disabled!

    I do have depend: [TagAPI] in my plugin.yml and it loads after TagAPI.
     
  10. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    Is it firing in your onEnable? Are you sure TagAPI is properly starting up? Can I get a log?
     
  11. Offline

    YoFuzzy3

    I think I fixed it, the problem seemed to be that I wasn't correctly cancelling my tasks in onDisable().
     
  12. Offline

    sensus12

    Code:
    failed to register events for class me.sensus.......    because org/kitteh/tag/playerreceivenametagevent doesn't exsists
     
  13. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    Add a depend for TagAPI in plugin.yml
     
  14. Offline

    SniperFodder

    Sweet. I've been out of the community way too long or I would have thought about adding support sooner.
     
  15. Offline

    suckycomedian

    Does this work with RemoteEntites?
    I'm trying to do this
    Code:
    @EventHandler
        public void enemyFollow(PlayerReceiveNameTagEvent event) {
            if(RTS.getManager().getAllEntities().contains(event.getNamedPlayer())){
                RemotePlayer rp = (RemotePlayer) event.getNamedPlayer();
                if(rp.getFeatures().hasFeature(RemoteTamingFeature.class)){
                    RemoteTamingFeature feature = rp.getFeatures().getFeature(RemoteTamingFeature.class);
                    if(event.getPlayer().getName().equalsIgnoreCase(feature.getTamer().getName())){
                        event.setTag(ChatColor.DARK_RED + rp.getName());
                    }   
                }
            }
        }
     
  16. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    suckycomedian if those entities are 100% perfect emulations of players including firing all the relevant events (join, quit), then yes.
     
  17. Offline

    william9518

    src code?
     
  18. Offline

    Comphenix

  19. Offline

    Tdarnell

    so when I do the following...
    @EventHandler(priority = EventPriority.NORMAL)
    public void onNameTag(PlayerReceiveNameTagEvent event) {
    if (event.getNamedPlayer().getName().equals("Notch")) {
    event.setTag(ChatColor.GOLD + "" + ChatColor.BOLD + "N" + ChatColor.DARK_RED + "" + ChatColor.BOLD + "ot" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + "ch");
    }
    }
    I don't see a change in my name tag, am I doing something wrong? (replaced my username with notch for privacy)

    Just to explain. Im trying to add a multicolored name, with format, I've seen it done, though im not sure if tagAPI was used. please get back to me

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

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    Tdarnell how are you going to see a change in your own name tag? :p
     
  21. Offline

    Tdarnell

    I have two minecraft accounts, I was on both so I could see. It didn't show anything
     
  22. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    Try out just setting all name tags to ChatColor.RED+event.getNamedPlayer().getName() to make sure you have it going fine.
     
  23. Offline

    SniperFodder

    I know on Spout at least you can see the nametag when you go into 3rd person. I haven't tested 3rd person in vanilla in awhile. But if it shows in Vanilla then he could see it that way too.

    EDIT: Just tested. Can't see it in vanilla. So ignore teh foddah.
     
  24. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    Doesn't work that way ;)
     
  25. Offline

    SniperFodder

    So I begin TagAPI integration at the tail end of today. We'll see if I can get it to work in my mess of a plugin :D
     
  26. Offline

    Tdarnell

    I'm still not seeing anything with just red, do I need to make an on join event, or a refresh?

    No matter what I do, I'm not seeing anything at all :'(

    Sorry, It was me being ignorant, I forgot to add onEnable and onDisable to my plugin xD feel like such a noob now, so sorry to bother you about this.

    How do I make this load after TagAPI?

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

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    plugin.yml
    softdepend: [TagAPI]
     
  28. Offline

    Tdarnell

    All working now, sorry for derping like that xD
    btw whats the most efficient way of refreshing name tags? my current way sends a lot of packets :(
     
  29. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı Retired Staff

    You only need to do a refresh when you want the nametag to change.
     
  30. Offline

    Tdarnell

    Yes, currently my nametag (and tablist) only change when another player see's me, so its white until my nametag is seen, is there a way of refreshing it say every min?

    Edit: and on player join event
    So how do I make it refresh even If I am the only one online basically :L
    Edit 2: the tab list is the problem Im having, I'll find a way of fixing that :p the name tag is fine
     
Thread Status:
Not open for further replies.

Share This Page