BukkitTask.cancel() vs. BukkitScheduler.cancelTask(int)

Discussion in 'Plugin Development' started by WithinRafael, Dec 27, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    WithinRafael

    Hi all,

    We're in the process of removing use of deprecated API calls and had a small question regarding task cancellation. BukkitScheduler.scheduleAsyncRepeatingTask(...) used to return a task identifier that we stored internally. We then used to pass this to BukkitScheduler.cancelTask(...) to cancel the task.

    We now understand scheduleAsyncRepeatingTask has been deprecated in favor of new task API, specifically in this case BukkitScheduler.runTaskTimerAsynchronously(...). This returns a BukkitTask object we stow away. But we noticed BukkitScheduler.cancelTask(int) was not marked as deprecated. Should we keep using this method or use the BukkitTask object's .cancel() method? I suspect both work (and that the latter is ideal) but just checking. If that's the case, I would recommend the Bukkit team deprecate the cancelTask method too.
     
  2. Offline

    fireblast709

    you can still get the ID from the BukkitTask object, and store that ;3
     
  3. Offline

    WithinRafael

    Right, just wanted to confirm which method is preferred by the team :)
     
Thread Status:
Not open for further replies.

Share This Page