Schedule a new sync thread based on thread compare rather than the async setting
(Fixes #1151)
This commit is contained in:
parent
cb0cf6bb5a
commit
4e364c13a3
@ -74,17 +74,17 @@ public class BukkitService implements SettingsDependent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a synchronous task if async tasks are enabled; if not, it runs the task immediately.
|
* Schedules a synchronous task if we are currently on a async thread; if not, it runs the task immediately.
|
||||||
* Use this when {@link #runTaskOptionallyAsync(Runnable) optionally asynchronous tasks} have to
|
* Use this when {@link #runTaskOptionallyAsync(Runnable) optionally asynchronous tasks} have to
|
||||||
* run something synchronously.
|
* run something synchronously.
|
||||||
*
|
*
|
||||||
* @param task the task to be run
|
* @param task the task to be run
|
||||||
*/
|
*/
|
||||||
public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) {
|
public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) {
|
||||||
if (useAsyncTasks) {
|
if (Bukkit.isPrimaryThread()) {
|
||||||
scheduleSyncDelayedTask(task);
|
|
||||||
} else {
|
|
||||||
task.run();
|
task.run();
|
||||||
|
} else {
|
||||||
|
scheduleSyncDelayedTask(task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user