Add getMainThreadExecutor to BukkitScheduler
This commit is contained in:
@@ -633,4 +633,15 @@ public class CraftScheduler implements BukkitScheduler {
|
|||||||
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
|
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
|
||||||
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)");
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user