From f559d767d2dd6af3b8ae74b2c4ff1be06220f4d0 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 20 Nov 2022 19:36:34 +0100 Subject: [PATCH] Solves the /restart issue. --- MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java index 6cc0b87b..1366ece4 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/MMOCore.java @@ -314,6 +314,12 @@ public class MMOCore extends JavaPlugin { @Override public void onDisable() { + //Executes all the pending asynchronous task (like saving the playerData) + Bukkit.getScheduler().getPendingTasks().forEach(worker -> { + if (worker.getOwner().equals(this)) { + ((Runnable) worker).run(); + } + }); // Save player data for (PlayerData data : PlayerData.getAll()) if (data.isFullyLoaded()) {