ArmorStand CustomName send packet player

Discussion in 'Spigot Plugin Help' started by XDDMISTER, Jul 16, 2021.

  1. Hi, I need advice on how to send a Custom name packet to armorstand.

    I want to make a display from the database on the armor stand for each player separately.


    Code (Java):
                ArmorStand a = (ArmorStand) Bukkit.getServer().getEntity(UUID.fromString(main.db.getString("main.2armorstand_uuid")));
                if(a != null) {

                    a.setCustomName(main.extract_mess("messages.armorstand_subtitle", 1).replace("%collect_honey%", "HERE DATABASE oUTPUT INT"));
                }
     
  2. Check out my plugin ItemFrame Shop's source code on GitHub (linked on the page) - there's a class called PacketUtils where I did that exactly along with spawning it, changing, destroying, etc.
     
  3. Pleashe help
    Thanks for writing off. Isn't it just sending a custom name instead of about 121 lines? Do I have to do that armorstand completely since again?
     
  4. If you want to use packets and not actual ArmorStands you'll have to keep track of their IDs, "spawn" them manually, and destroy them manually when you need to.
     
  5. Thanks for helping, I appreciate it. But I'm a bit of a "beginner" and giving me a code like this is like going to level 5 in a game where level lvl 50 is. I don't understand or understand anything.
     
  6. Using packets is considered advanced in Spigot - unless you know what you're doing don't touch it.
    I thought you knew that.
    Learn how to code (and read it) in Spigot before even thinking about packets.
     
  7. But I would need to make an individual display from the database on the armorstand for players :/
     
  8. You said yourself it's too advance for you.
    If you want to do this by yourself you need to learn how to read the code and use it - no one will do it for you cuz otherwise it's not really you doing it.
    Best is to see how someone else did it and learn from it.
     
  9. I know how to write plugins I don't know everything but with my basic knowledge I've done a few pl I just never tried packets it's just a new thing for me and that's not how you can learn it if I don't know what a thing does ....
     
  10. I learn through other's works, but that might not be for you.
    In that case, I suggest you search for tutorials online on NMS and Reflection, then the basics of what a packet is, then you can check out my code again with fresh eyes.
    You won't learn anything if I force-feed you the answer and do it for you, but learning from other people's work is very important in the case of packets.
    There's a good reason why everyone just loves ProtocolLib - it simplifies packets.
    If you prefer, you can start using ProtocolLib instead and understand packets through that.
    I like the "slam your head on the wall till you get it" approach, but you do you.
    Good luck!