1.8.8 runTaskLaterAsynchronously

Discussion in 'Spigot Plugin Development' started by MrAxeTv, Jan 19, 2020.

  1. So having question about
    Bukkit.getScheduler().runTaskLaterAsynchronously - is in method which I call thru constructor in another class
    wont run in OnEnable method
    But it can be run from command or event

    Thing is that happens only with mc server which are running on windows machine
    on Linux methods is working with no problem so that is dam strange xd
  2. Runnables run after the server has fully started (all worlds loaded, all plugins are enabled, etc). Even if you put it in your onEnable(), they won't start immediately.
  3. interesting need to check it
  4. after debugging my code was still not executed but on Linux work
    but windows nop
  5. To make an Asynchronously task, I usually do this:
    Code (Text):

    public class TaskClassName extends BukkitRunnable {

        private MainClassName plugin;

        public TaskClassName (MainClassName plugin) { this.plugin = plugin; }

        public void run() {
             // Do your things
    And then call it in onEnable like this:
    Code (Text):

    public final class MainClassName extends JavaPlugin {

        public void onEnable() {
            Bukkit.getScheduler().runTaskLaterAsynchronously(this, new TaskClassName(this), delay);

        public void onDisable() {

  6. What is your code? What you do mean that it doesn't work? Does the code never run?
  7. We really need to see your code before we can help I feel..
  8. https://gyazo.com/f7ce6b4b9752ed89d4d37b12f5387225
    Here regular example wont run and wont brodecast Hello in chat at all
    If I reload plugin with plugman line will show after 10 sec how it should
    or if I run plugin on Linux code will work only problem is it wont run on windows machines
  9. When you say it doesn't run on windows machines, do you mean that you do not get the message in console, or at all?
  10. any code which is on side runnable wont run on windows if method is called thru onEnable on windows
    machine so yes there is no message in chat or console log
  11. Is it possible that it actually runs, but you miss the printed message?
    • Agree Agree x 1
  12. no test it many times already
    searched true log file and message in not there
  13. Try to use the code I had written before.
    I use it on a Windows machine and it works perfectly!

    You just need to make a class for the Task.
  14. Instead of doing a delayed task, perhaps make it a task timer. This way you'll be able to tell for sure if it's running or not, as you'll be spammed with your debug message. Not sure if this will help you though.
  15. @SignorPollito Decide either use BukkitRunnable or BukkitScheduler and a Runnable.