diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index cb7afaa7..27102572 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -752,6 +752,7 @@ public class Jobs extends JavaPlugin { if (paymentThread != null) paymentThread.shutdown(); + Bukkit.getOnlinePlayers().forEach(p -> getPlayerManager().getJobsPlayer(p).clearBossMaps()); getPlayerManager().saveAll(); if (dao != null) { diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index c1247804..8f1a9a41 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -202,11 +202,10 @@ public class PlayerManager { if (jPlayer == null) return; + jPlayer.onDisconnect(); if (Jobs.getGCManager().saveOnDisconnect()) { - jPlayer.onDisconnect(); jPlayer.save(); - } else - jPlayer.onDisconnect(); + } } /** diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 4f820ae8..1d8ac7bd 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -26,7 +26,6 @@ import java.util.Map.Entry; import java.util.UUID; import org.bukkit.Bukkit; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; @@ -739,6 +738,7 @@ public class JobsPlayer { public void clearBossMaps() { for (BossBarInfo one : barMap) { + one.getBar().removeAll(); one.cancel(); } barMap.clear();