Fixing big mistake in SchedulerUtil.runOnServerThread(). Provided Runnable was run twice if the method was called from Server Thread.

This commit is contained in:
Marc Baloup 2023-08-03 23:32:29 +02:00
parent 2969d51f72
commit 75e292b1b8

View File

@ -20,8 +20,10 @@ public class SchedulerUtil {
* @param task the task to run on the main thread.
*/
public static void runOnServerThread(Runnable task) {
if (Bukkit.isPrimaryThread())
if (Bukkit.isPrimaryThread()) {
task.run();
return;
}
Bukkit.getScheduler().runTask(PandaLibPaper.getPlugin(), task);
}