Solved How to unsend packet after it has been sent?

Discussion in 'Spigot Plugin Development' started by Orangemaster123, May 27, 2017.

  1. I am trying to make particle trails in my plugin. I have made it so when they click on a item in a gui it adds a particle trail. The particle trails are sent using packets, but the only problem is when the player clicks on a item in the gui and the particle trail is sent, if the player then clicks on another particle trail, the first one stays there. Is there a way to make the first particle trail go away?
    Here's the code i use to send the packets.
    Code (Text):

    if(hearts.contains(e.getPlayer().getUniqueId())) {

    fire.remove(player.getUniqueId());

    dark.remove(player.getUniqueId());

    ((CraftPlayer)e.getPlayer()).getHandle().playerConnection.sendPacket(heart);


    }
     
     
  2. I think you can't unsend a packet.
    I wouldn't work in here with packets.
     
  3. The particle dont really last for long . If your packet sending rapidly to the player in the runnable , you shall stop the runnable or make the particle to a variable then change that variable to change the particle's type
     
  4. Thanks for the reply but i have fixed it now. It was a stupid mistake but i forgot to remove the player from the "hearts" array i made when they clicked a different particle effect, which made the hearts stay.
     
    • Like Like x 1