From 12cf3e67ad58c585ff8016c022f9c421afeda389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sat, 6 Jan 2024 12:27:30 +0100 Subject: [PATCH] Fix: Prevents creation of unnecessary threads when bossbar is in async --- .../com/gamingmesh/jobs/config/BossBarManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java index 6ca39104..79c55a22 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java @@ -36,6 +36,12 @@ public class BossBarManager { } public void ShowJobProgression(final JobsPlayer player, final JobProgression jobProg, double expGain) { + if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault) + return; + + if (!ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId().toString(), true)) + return; + if (Jobs.getGCManager().isBossBarAsync()) { CMIScheduler.get().runTaskAsynchronously(() -> ShowJobProgressionInTask(player, jobProg, expGain)); } else { @@ -44,12 +50,6 @@ public class BossBarManager { } private synchronized void ShowJobProgressionInTask(final JobsPlayer player, final JobProgression jobProg, double expGain) { - if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault) - return; - - if (!ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId().toString(), true)) - return; - BossBar bar = null; BossBarInfo oldOne = null; for (BossBarInfo one : player.getBossBarInfo()) {