Class BossBarManager
java.lang.Object
net.minestom.server.adventure.bossbar.BossBarManager
Manages all boss bars known to this Minestom instance. Although this class can be used
to show boss bars to players, it is preferable to use the boss bar methods in the
Audience
class instead.
This implementation is heavily based on Velocity's boss bar management system.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBossBar
(@NotNull Collection<Player> players, @NotNull BossBar bar) Adds the specified players to the boss bar's viewers and spawns the boss bar, registering the boss bar if needed.void
addBossBar
(@NotNull Player player, @NotNull BossBar bar) Adds the specified player to the boss bar's viewers and spawns the boss bar, registering the boss bar if needed.void
destroyBossBar
(@NotNull BossBar bossBar) Completely destroys a boss bar, removing it from all players.@NotNull Collection
<Player> getBossBarViewers
(@NotNull BossBar bossBar) Gets all the players for whom the given boss bar is currently visible.@NotNull Collection
<BossBar> getPlayerBossBars
(@NotNull Player player) Gets a collection of all boss bars currently visible to a given player.void
removeAllBossBars
(@NotNull Player player) Removes a player from all of their boss bars.void
removeBossBar
(@NotNull Collection<Player> players, @NotNull BossBar bar) Removes the specified players from the boss bar's viewers and despawns the boss bar.void
removeBossBar
(@NotNull Player player, @NotNull BossBar bar) Removes the specified player from the boss bar's viewers and despawns the boss bar.
-
Constructor Details
-
BossBarManager
public BossBarManager()Creates a new boss bar manager.- See Also:
-
-
Method Details
-
addBossBar
Adds the specified player to the boss bar's viewers and spawns the boss bar, registering the boss bar if needed.- Parameters:
player
- the intended viewerbar
- the boss bar to show
-
removeBossBar
Removes the specified player from the boss bar's viewers and despawns the boss bar.- Parameters:
player
- the intended viewerbar
- the boss bar to hide
-
addBossBar
Adds the specified players to the boss bar's viewers and spawns the boss bar, registering the boss bar if needed.- Parameters:
players
- the playersbar
- the boss bar
-
removeBossBar
public void removeBossBar(@NotNull @NotNull Collection<Player> players, @NotNull @NotNull BossBar bar) Removes the specified players from the boss bar's viewers and despawns the boss bar.- Parameters:
players
- the intended viewersbar
- the boss bar to hide
-
destroyBossBar
Completely destroys a boss bar, removing it from all players.- Parameters:
bossBar
- the boss bar
-
removeAllBossBars
Removes a player from all of their boss bars. Note that this method does not send any removal packets to the player. It is meant to be used when a player is disconnecting from the server.- Parameters:
player
- the player
-
getPlayerBossBars
Gets a collection of all boss bars currently visible to a given player.- Parameters:
player
- the player- Returns:
- the boss bars
-
getBossBarViewers
Gets all the players for whom the given boss bar is currently visible.- Parameters:
bossBar
- the boss bar- Returns:
- the players
-