Fixing big mistake in SchedulerUtil.runOnServerThread(). Provided Runnable was run twice if the method was called from Server Thread.
This commit is contained in:
parent
2969d51f72
commit
75e292b1b8
@ -20,8 +20,10 @@ public class SchedulerUtil {
|
|||||||
* @param task the task to run on the main thread.
|
* @param task the task to run on the main thread.
|
||||||
*/
|
*/
|
||||||
public static void runOnServerThread(Runnable task) {
|
public static void runOnServerThread(Runnable task) {
|
||||||
if (Bukkit.isPrimaryThread())
|
if (Bukkit.isPrimaryThread()) {
|
||||||
task.run();
|
task.run();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(PandaLibPaper.getPlugin(), task);
|
Bukkit.getScheduler().runTask(PandaLibPaper.getPlugin(), task);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user