Hello, I am looking to remove a boss bar from a player and for that boss bar to go away from their screen. Code (Text): ON DISABLE: public void clearBossBar(Player player) { for (@Nonnull Iterator<KeyedBossBar> it = Bukkit.getBossBars(); it.hasNext(); ) { final BossBar bossBar = it.next(); bossBar.removePlayer(player); } while (Bukkit.getBossBars().hasNext()) { Bukkit.broadcastMessage("have next"); KeyedBossBar bossBar = Bukkit.getBossBars().next(); if (bossBar.getPlayers().contains(player)) { Bukkit.broadcastMessage("removed"); bossBar.removePlayer(player); } } } ON PLAYER DEATH: public void clearBossBar(Player player) { for (@Nonnull Iterator<KeyedBossBar> it = Bukkit.getBossBars(); it.hasNext(); ) { final BossBar bossBar = it.next(); bossBar.removePlayer(player); } while (Bukkit.getBossBars().hasNext()) { Bukkit.broadcastMessage("have next"); KeyedBossBar bossBar = Bukkit.getBossBars().next(); if (bossBar.getPlayers().contains(player)) { Bukkit.broadcastMessage("removed"); bossBar.removePlayer(player); } } } Nether of any two of the methods have been called or does the bar go away.
How are you registering these methods? Are they in a class that implements Listener and are the methods annotated by EventHandler?