From 93e7821fe3f9d0721052810ff00449f389c40887 Mon Sep 17 00:00:00 2001 From: Elikill58 Date: Mon, 18 Sep 2023 08:45:25 +0200 Subject: Fix not deleted bossbar --- .../leonardobishop/quests/bukkit/hook/bossbar/BossBar_Bukkit.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bukkit/src') 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 2431abd8..1aa5268e 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 @@ -19,6 +19,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()) { -- cgit v1.2.3-70-g09d2