Scheduler - Repeating a task X times, then stop it

Discussion in 'Plugin Development' started by Zeryther, Aug 1, 2014.

Thread Status:
Not open for further replies.
  1. I'm creating a bleeding effect. When a Entity gets hit, it bleeds with redstone particles and drip lava particles. When the Entity gets hit, it bleeds 5 seconds, drops particles and loses HP. Does anybody know the best way to stop the scheduler after 5 seconds? I know I could make an int with a value of 0 and if it reaches 5 the scheduler stops, but then it would be for every entity.

    - Zeryther
     
  2. Offline

    TheMcScavenger

  3. TheMcScavenger
    I think you didn't understand. I want a method to cancel the task after it ran 5 times for this entity..
     
  4. Offline

    BaranCODE

    You could store the task's ID somewhere, and also have an integer value that you increase each time the task runs. If the integer reaches a certain value, when the task runs, it should make the scheduler cancel it, using the task's ID. It's a simple concept, really; just some variables and an if statement.
     
Thread Status:
Not open for further replies.

Share This Page