Async schedule with consumer does not repeat

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • Environment:

      Server: Windows 10, 22H2

      Java:

      openjdk 21.0.7 2025-04-15 LTS
      OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.7+6 (build 21.0.7+6-LTS, mixed mode, sharing)

    • CraftBukkit version 4504-Spigot-270012a-dacd062 (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
    • Yes

      Using the bukkit scheduler to schedule a repeating task asynchronously will only run it once.

      Using the Runnable version of that same method will actually repeat it.

       

      Runs only once:

      Bukkit.getScheduler().runTaskTimerAsynchronously(this, task -> {
          System.out.println("test");
      }, 0L, 20L); 

      Repeats:

      Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
          System.out.println("test");
      }, 0L, 20L); 

            Assignee:
            Unassigned
            Reporter:
            Silent WT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: