Calling a scheduled task to run

Discussion in 'Plugin Development' started by Betagear, Sep 21, 2015.

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

    Betagear

    1. because it's faster than instaceof
    2. It should resume any wait(), but for the moment it's just a placeholder.

    Anyways, there is no task.run() as some said. Maybe for a future version of Bukkit ?
     
  2. Offline

    mythbusterma

    @Betagear

    You really need to stop concerning yourself with "faster" and "more efficient." You're doing nothing but hurting yourself with it. The difference in this case is on the order of nanoseconds. NANOSECONDS. Do you understand how little nanoseconds matter?

    Also, it doesn't look like there's a way to get the actual Runnable by the BukkitTask, which is rather unfortunate. You'll have to keep track of your Runnables yourself.
     
  3. Offline

    Betagear

    Yep, but it's very large areas of blocks all calculated instantly, I tried to save the runnables then ran /tps, shifted from 20.00 to 12.54. Maybe it's nanos, but nanos and nanos makes a lot at the end. (I have a i5 4440S, and I'm alone on my server, imagine with a lot of people).

    Anyways, so is it a way to delay the OnDisable without delaying everything ?
     
  4. Offline

    mythbusterma

    @Betagear

    No. They don't.

    If you're losing that many ticks it's because of inefficient design, not how you perform comparisons. Readability trumps nanosecond performance gains. Another huge issue with it is that you don't understand algorithmic analysis or data structure design well enough to actually optimise in a meaningful way, so you're just wasting your time with micro-optimisations.

    You don't delay the stopping of the server. That's the end of that.

    Keep track of your Runnables, and run them when it shuts down. Or find another way of doing it before the server shuts down.

    Edit: You shouldn't be scheduling that many Runnables anyway.
     
  5. Offline

    Betagear

    So, How can I store the runnables ?
     
  6. Offline

    mythbusterma

    @Betagear

    Again, a Collection. List, Set, Map, whatever.
     
  7. Offline

    Betagear

    I've really not much worked on Collection, can you give me the code ?
     
  8. Offline

    teej107

Thread Status:
Not open for further replies.

Share This Page