1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-20 22:18:58 +01:00

Add getMainThreadExecutor to BukkitScheduler

This commit is contained in:
Aleksander Jagiello 2021-01-24 22:17:54 +01:00
parent 6888386225
commit 0312fd2b42

View file

@ -633,4 +633,15 @@ public class CraftScheduler implements BukkitScheduler {
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)");
}
// Paper start - add getMainThreadExecutor
@Override
public Executor getMainThreadExecutor(Plugin plugin) {
Preconditions.checkArgument(plugin != null, "Plugin cannot be null");
return command -> {
Preconditions.checkArgument(command != null, "Command cannot be null");
this.runTask(plugin, command);
};
}
// Paper end
}