diff --git a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/bossbar/BossBar_Bukkit.java b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/bossbar/BossBar_Bukkit.java index 2431abd8f..69a55198a 100644 --- a/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/bossbar/BossBar_Bukkit.java +++ b/bukkit/src/main/java/com/leonardobishop/quests/bukkit/hook/bossbar/BossBar_Bukkit.java @@ -10,6 +10,7 @@ import org.bukkit.boss.BarStyle; import org.bukkit.entity.Player; +import com.google.common.collect.Lists; import com.leonardobishop.quests.bukkit.BukkitQuestsPlugin; public class BossBar_Bukkit implements BossBar { @@ -19,6 +20,13 @@ public class BossBar_Bukkit implements BossBar { public BossBar_Bukkit(BukkitQuestsPlugin plugin) { this.plugin = plugin; + String pluginNamespace = new NamespacedKey(plugin, "test").getNamespace(); // get namespace + Lists.newArrayList(Bukkit.getBossBars()).forEach(bb -> { // copy list to prevent current modification + if(bb.getKey().namespace().equals(pluginNamespace)) { + bb.removeAll(); // hide it + Bukkit.removeBossBar(bb.getKey()); // remove it + } + }); plugin.getScheduler().runTaskTimer(() -> { for (Entry entry : new HashMap<>(players).entrySet()) { if (entry.getValue() < System.currentTimeMillis()) {