1.16.5 send packets

Discussion in 'Spigot Plugin Development' started by TitoMaren, Feb 21, 2021.

  1. Hello, I want to send packages that are in the main class from another class so that it is more organized, if you need me to answer something so that you can help me ask me calmly, in my case I want to send nms packages, if you can help me I would appreciate it
  2. reference them as a public variable in your main class.
  3. that doesn't work for me, what I want to do is send packages to the player from another class, but thanks anyway for trying to help me
  4. What do you mean by "send packages"?
  5. the typical method
    Code (Text):
    ((CraftPlayer) p).getHandle().playerConnection.sendPacket(thepacket);
    what happens is that the package that I want to send is configured in the main, but in another class I have the event in which I want the package to be sent, but I don't know how to send the package that I have in the main from another class
  6. Why don't you store the packet in the class you're sending it from?
  7. because the code is very long and disorganized
  8. Uhm, why don't you learn OOP then?
    • Agree Agree x 1
  9. I just want to send the package that I have in the main class from the other class
  10. You have to learn OOP first before you can do that
  11. if you can't help me then please don't comment
    • Winner Winner x 1
  12. Well, I am trying to help you. If you knew more about object-oriented programming, you would simply have no such problems. Understanding OOP is vital for code organization/optimization in java. From what you've said I've determined that your project must be pretty complex, you're going to have a hard time working on it without the knowledge of OOP
  13. Learn OOP rather than asking newbie questions and being rude to people when they won't spoonfeed you
    • Like Like x 2
    • Agree Agree x 1