Class BossBarManager
java.lang.Object
net.minestom.server.adventure.bossbar.BossBarManager
-
Constructor Summary
Constructors -
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
-
removeBossBar
-
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
-