mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-01-23 16:01:21 +01:00
Merge pull request #22 from divios/patch-1
Added `DataManagerAbstract#asyncFuture`
This commit is contained in:
commit
7a85bd7a2a
@ -11,6 +11,7 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@ -80,6 +81,16 @@ public class DataManagerAbstract {
|
||||
public void async(Runnable runnable) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a task to be run asynchronously with all the
|
||||
* advantages of CompletableFuture api <br>
|
||||
*
|
||||
* @param runnable task to run
|
||||
*/
|
||||
public CompletableFuture<Void> asyncFuture(Runnable runnable) {
|
||||
return CompletableFuture.runAsync(runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a task to be run synchronously.
|
||||
|
Loading…
Reference in New Issue
Block a user