From 4e364c13a377319ed09e5db3413e96bb74870591 Mon Sep 17 00:00:00 2001 From: games647 Date: Wed, 29 Mar 2017 09:45:39 +0200 Subject: [PATCH] Schedule a new sync thread based on thread compare rather than the async setting (Fixes #1151) --- src/main/java/fr/xephi/authme/service/BukkitService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/service/BukkitService.java b/src/main/java/fr/xephi/authme/service/BukkitService.java index 4d94b62d..6180750a 100644 --- a/src/main/java/fr/xephi/authme/service/BukkitService.java +++ b/src/main/java/fr/xephi/authme/service/BukkitService.java @@ -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 * run something synchronously. * * @param task the task to be run */ public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) { - if (useAsyncTasks) { - scheduleSyncDelayedTask(task); - } else { + if (Bukkit.isPrimaryThread()) { task.run(); + } else { + scheduleSyncDelayedTask(task); } }