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:
parent
6888386225
commit
0312fd2b42
1 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue