📊Bossbar Builder

Creates bossbars for the player

Overview

The BossBarBuilder class simplifies the creation and management of boss bars for players in a Minecraft Bukkit server environment. It provides methods for setting the title, color, style, progress, and flags of boss bars, as well as creating and updating boss bars for individual players.

Constructor

BossBarBuilder

public BossBarBuilder(JavaPlugin plugin)

Initializes a new instance of the BossBarBuilder class with the specified JavaPlugin instance.

Parameters

  • plugin: The JavaPlugin instance associated with the boss bar builder.

Methods

setTitle

public BossBarBuilder setTitle(String title)

Sets the title of the boss bar.

setColor

public BossBarBuilder setColor(BarColor color)

Sets the color of the boss bar.

setStyle

public BossBarBuilder setStyle(BarStyle style)

Sets the style of the boss bar.

setProgress

public BossBarBuilder setProgress(float progress)

Sets the progress (percentage filled) of the boss bar.

setFlags

public BossBarBuilder setFlags(BarFlag... flags)

Sets the flags of the boss bar.

create

public BossBarBuilder create(Player player)

Creates a boss bar for the specified player with the configured properties.

Parameters

  • player: The player for whom the boss bar is created.

update

public BossBarBuilder update(Player player)

Updates the boss bar for the specified player with the current configuration.

Parameters

  • player: The player whose boss bar is updated.

Notes

  • The BossBarBuilder class allows for the creation and management of dynamic boss bars to provide players with visual indicators or progress trackers.

  • Developers can configure various properties of the boss bar, including title, color, style, progress, and flags, to suit different gameplay scenarios.

  • Boss bars created using this builder pattern can be easily updated to reflect changes in player status or game events.

Last updated