Class FreedomExecutor

java.lang.Object
me.totalfreedom.service.FreedomExecutor

public class FreedomExecutor extends Object
This is a holder class for Executor objects that are used to delegate runnable tasks to the Bukkit Scheduler. This class is here for both convenience purposes, and also for the sake of providing easy access to executors for CompletableFuture invocations.
  • Constructor Details

    • FreedomExecutor

      public FreedomExecutor()
      Creates a new FreedomExecutor instance.
  • Method Details

    • singleExecutor

      public Executor singleExecutor(org.bukkit.plugin.java.JavaPlugin plugin)
      Creates a new Executor that is capable of executing a runnable one singular time, synchronously.
      Parameters:
      plugin - The plugin to run the task for.
      Returns:
      A new Executor instance.
    • delayedExecutor

      public Executor delayedExecutor(org.bukkit.plugin.java.JavaPlugin plugin, long delay)
      Creates a new Executor that is capable of executing a runnable one singular time, synchronously. This Executor will wait for the supplied delay before executing the runnable.
      Parameters:
      plugin - The plugin to run the task for.
      delay - The delay to wait before executing the runnable.
      Returns:
      A new Executor instance.
    • periodicExecutor

      public Executor periodicExecutor(org.bukkit.plugin.java.JavaPlugin plugin, long initialDelay, long period)
      Creates a new Executor tthat is capable of executing a runnable on a periodic basis, synchronously. This executor can also be supplied a delay to indicate it should wait the specified amount of time before executing the runnable for the first time.
      Parameters:
      plugin - The plugin to run the task for.
      initialDelay - The delay to wait before executing the runnable for the first time.
      period - The period to wait between each execution of the runnable.
      Returns:
      A new Executor instance.
    • asynchronousSingleExecutor

      public Executor asynchronousSingleExecutor(org.bukkit.plugin.java.JavaPlugin plugin)
      Creates a new Executor that is capable of executing a runnable one singular time, asynchronously.
      Parameters:
      plugin - The plugin to run the task for.
      Returns:
      A new Executor instance.
    • asynchronousDelayedExecutor

      public Executor asynchronousDelayedExecutor(org.bukkit.plugin.java.JavaPlugin plugin, long delay)
      Creates a new Executor that is capable of executing a runnable one singular time, asynchronously. This Executor will wait for the supplied delay before executing the runnable.
      Parameters:
      plugin - The plugin to run the task for.
      delay - The delay to wait before executing the runnable.
      Returns:
      A new Executor instance.
    • asynchronousPeriodicExecutor

      public Executor asynchronousPeriodicExecutor(org.bukkit.plugin.java.JavaPlugin plugin, long delay, long period)
      Creates a new Executor tthat is capable of executing a runnable on a periodic basis, asynchronously. This executor can also be supplied a delay to indicate it should wait the specified amount of time before executing the runnable for the first time.
      Parameters:
      plugin - The plugin to run the task for.
      delay - The delay to wait before executing the runnable for the first time.
      period - The period to wait between each execution of the runnable.
      Returns:
      A new Executor instance.
    • getSync

      public Executor getSync()
      Gets the synchronous executor instance. This is a convenience for CompletableFuture invocations, when defining a custom executor for the CompletableFuture.
      Returns:
      The synchronous executor instance.
    • getAsync

      public Executor getAsync()
      Gets the asynchronous executor instance. This is a convenience for CompletableFuture invocations, when defining a custom executor for the CompletableFuture.
      Returns:
      The asynchronous executor instance.