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

    IDragonfire

    Can you add NPC support?
     
  2. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    How would you propose I do that? :)
     
  3. Offline

    IDragonfire

    Fire a new Event ...
    like PlayerReceiveHumanNPCTagEvent ?

    I am not sure if these is possible ...
     
  4. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    I'd want to provide more info than blindly sending just an entity id
     
  5. Offline

    Lolmewn

    How about adding an NPC api to bukkit first, then? ^^
     
    chasechocolate likes this.
  6. Offline

    IDragonfire

    I am not sure if that happen ...

    Atm the NPCLib, based on top-cat, works very well ...

    I am sure that TagAPI can catch TagSend events also from NPCEntities, or?
    https://github.com/kumpelblase2/NPC...n/java/com/topcat/npclib/NPCManager.java#L121
    https://github.com/kumpelblase2/NPC...java/com/topcat/npclib/nms/NPCEntity.java#L19

    newest version:
    http://forums.bukkit.org/threads/npcspawner-lib-spawn-basic-npcs.3298/

    Packet20NamedEntitySpawn fired here:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/EntityTrackerEntry.java#L267

    I take a look into the MC code, I think it is a NPC problem,
    because the NPCManager add the Entity correct and the Server calls the Tracker,
    but somewhere the Server say "stop, that is no player" and it does not call the method fire the event:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/EntityTrackerEntry.java#L192
    called from:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/EntityTracker.java#L20
    called from:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/WorldManager.java#L17
    called from:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/World.java#L764
    called from:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/World.java#L738

    (Hope I am not wrong)
     
  7. Offline

    iZanax

    I'm new to TagAPI,

    and I got a question.
    • Is it possible to make Player A appear in Green to Player B and appear Red to Player C?
    Another question is just about learning how TagAPI works.
    When does the Event get's called? In the documentation it says that "whenever one player is about to receive the nametag for another player", but this is for me a bit unclear, the event get's also triggers when someone log in, if I'm right and can't this cause any name updates that are unwanted like in the first Question. And when TagAPI."Reference" is called the event get's triggerd, right? Because player D must have no effect on the first Question.

    Hope someone can help me out.
    If u got any example or other documentation about TagAPI, please leave it behind. -Zanax
     
  8. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    You can make player A appear green to B, red to C, while no change to D, easily. Each event is for one player seeing another, so for each player seeing player A, there is an event.

    The event is called when a player comes within visible range, teleports to, joins near, or unvanishes near another player.
     
  9. Offline

    zeeveener

    Question: Does using a premade API (TagAPI) for an already premade API (Bukkit) make someone less of a developer and more of a builder? Does it demand less respect than making your own?
    What is the general attitude of some of the more skilled programmers on this site in regards to that question?
     
  10. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    If everyone wrote their own TagAPI implementation they'd all break each other and that'd suck. I don't think using existing APIs like this should result in any less respect.
     
  11. I want to be able to: TagAPI.setTag(Player, String); could this be possible?
     
  12. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    What's wrong with storing a map of playername->tag in your plugin and handling the event with that?
     
  13. Offline

    iZanax

    I'm not completely understanding how TagAPI works.
    I want to call the event only by reference, because otherwise it might do some unwanted changes.
    And how do I change the Tag,
    that Set<> A sees each other Green, and sees Set<> B Red and otherwise..That is really a mystery how that is done with TagAPI.
     
  14. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Each event fires for Player X seeing player Y. Your plugin should figure out if X should see Y as red, green, or whatever color and set the event to do that.
     
  15. Offline

    iZanax

    So checking if getPlayer is in Set<> A and getNamedPlayer is in Set <> B then make him red?
     
  16. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Yeah! getPlayer is the person who is seeing the tag, getNamedPlayer is the person whose tag you're changing.
     
  17. Offline

    Derthmonuter

    mbaxter
    Is there any conceivable way to change a player's name tag and have them keep their skin?
     
  18. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    No, it's clientside
     
  19. Offline

    Uniclaw

    Hi!

    is there a possibility to change Tags of a NPC with this api?
     
  20. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    If the NPC fully emulates a player, yes.
     
  21. Offline

    Uniclaw

    Hm, do a Citizensnpc emulate a player? (I would set Tags of the Citizens NPC witout changing his name (for the skin)) :D
     
  22. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    I don't know, that's up for them to do. :)
     
  23. Offline

    Uniclaw

    mbaxter Thanks :) !

    PS: Do you know how to Spawn "Tags" on a Location?
     
  24. Offline

    xXSniperzzXx_SD

    Get the player's location and if it's a certain location, then change their tag color
     
  25. Offline

    lol768

    Works great if I logout and back in again, but refreshing doesn't seem to actually change the tag, only make it flicker as it refreshes. Code:
    Code:
        @EventHandler
        public void onNameTag(PlayerReceiveNameTagEvent event) {
            if (plugin.tags.containsKey(event.getNamedPlayer().getName())) { //See if a tag is defined
                event.setTag(plugin.tags.get(event.getNamedPlayer().getName()) + ChatColor.RED + event.getNamedPlayer().getName()); //Set new tag -- RED is debug
            }
        }
    
    Refresh code:
    Code:
                         /**
                          * Handles TagAPI stuff
                          */
                         if (plugin.getConfig().contains("kits." + className + ".tagPrefix") && plugin.useTags) {
                             String tagPrefix = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("kits." + className + ".tagPrefix"));
                             plugin.tags.put(p.getName(), tagPrefix);
                             plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                                    public void run() {
                                        TagAPI.refreshPlayer(p);
                                    }
                                }, 100L);
                             
                         }
    
     
  26. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    Add some debugging in there to see what you're actually setting the tag to
     
  27. Offline

    lol768

    I force added the red chatcolor, so it shouldn't make a difference what the value in the hashmap is
     
  28. Offline

    TeamGen0ez

    WHAT ABOUT PERMISSIONS!?
     
  29. Offline

    mbaxter ʇıʞʞnq ɐ sɐɥ ı

    WHAT ABOUT THEM!?

    TagAPI is just an API for other plugins to use. It has no config, no permissions. Other plugins (such as NameTags which is permission-based) can choose to implement it however they want.
     
    TfT_02, lol768 and KeybordPiano459 like this.
  30. Offline

    TeamGen0ez

    i found the permissions
     
    dark navi likes this.
Thread Status:
Not open for further replies.

Share This Page