AnimatedNames Development Help

Discussion in 'Spigot Plugin Development' started by Futurize, Mar 8, 2018.

  1. Hello, is there any way to get the player that is viewing the name tag? I am trying to get the faction relationship between the player viewing the name tag and the player himself. I have seen other servers that use animatednames accomplish this and am wondering if it is possible. Thanks!
  2. just set the name tag for a specific player.. or use a hashmap with the players and each of their factions.

    Code (Text):
    if(Hashmap.contains(factionfriend)) {
    } else {
    nametag.set("Not Faction");
  3. I'm using AnimatedNames...
  4. Theoretically you could loop through every player and see if the angle between the vector they are looking at and the direct vector between the current player and another one in range is less than x degrees. Maybe you will need to do some fine tuning like taking out the y
  5. Yeah, not doing that :p
  6. Sounds like the best and only easiest solution to me. I am not familiar with the AnimatedNames plugin, so I don't know if it has an API that has this function built in to it. It is some basic linear algebra (vector calculation). You'll have to indeed test what values work best and what a nice range would be. You could simply check if a player is within that range of another player first in something such as a PlayerMoveEvent (this is relatively simple with some not too complex to understand maths. I haven't done it in Spigot, but I did something really similar with an Augmented Reality app for iOS that also used the position of a moving object (you) relative to another object in the world). Then when you have established that there is another player in the close vicinity, you could calculate if the direction that someone is looking at is roughly in the same direction as the nametag above the other player. If this is the case, you could update the nametag to whatever you want.
  7. Not going to work very well with 200+ players online. Is there no way to get the player that is viewing the name tag to set player-specific tags?
  8. Mine would be 7 lines of code. You would have the Player viewing and the viewed player....
  9. What makes you think that this doesn't work well with 200+ players online? You would only start calculating if someone is looking at someone else if they are within each other's range. These calculations are far from intensive, and if they are, you could even send the 2 locations to an async task/thread to perform the calculations there to then return back to the main thread to display the nametag. It all comes down to how efficient you create it yourself.
    • Agree Agree x 1
    • Optimistic Optimistic x 1
  10. Maximvdw


    You guys are way over complicating things.

    Scoreboards are unique per player (if you use packets) - meaning ... lets say we have Alice and Bob and Michael. Alice is aly to bob
    but ennemy to Michael.

    Simply send a packet to michael saying the prefi of alice is red, and a packet to bob the prefix is green.

    As for animatednames - an API feature of this does not exist yet, however it is under development
    • Winner Winner x 1
  11. Ah yes, I forgot about scoreboards, indeed that would work a lot easier. :l
    • Funny Funny x 1

Share This Page