public class BossbarBuilder extends Object
BossBar instance for
a player to be displayed, to set messages, color and styles.
It can be animated to change messages, colors, styles and change
the progress as the display time runs out.
// Creating an instance of the builder
BossbarBuilder builder = new BossbarBuilder(
yourPlugin, player,
Arrays.asList("My bossbar message", "It changes :D"),
0, // if interval is 0, will be default interval
Arrays.asList("SOLID:BLUE", "YELLOW", "SEGMENTED_10"),
0, // if interval is 0, will be default interval
5, // 5 is the display time in seconds
true // if bossbar progress will decrease over time
);
builder.display(); // Displays the bossbar to the player.
| Constructor and Description |
|---|
BossbarBuilder(@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull org.bukkit.entity.Player player,
@NotNull org.bukkit.configuration.ConfigurationSection section)
Creates a new builder using a
ConfigurationSection of a file. |
BossbarBuilder(@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull org.bukkit.entity.Player player,
@NotNull List<String> messages,
int messageInterval,
@Nullable List<String> formats,
int formatInterval,
int time,
boolean progressDecrease)
Creates a new builder with all the specified configuration.
|
BossbarBuilder(@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull org.bukkit.entity.Player player,
String string)
Creates a new builder using a single line to parse all the necessary arguments.
|
| Modifier and Type | Method and Description |
|---|---|
void |
display()
Displays the bossbar message to the player.
|
static @Nullable Set<BossbarBuilder> |
getBuilders(org.bukkit.entity.Player player)
Gets the BeansLib bossbar object from the bossbar map.
|
void |
unregister()
Unregisters the bossbar from the player.
|
public BossbarBuilder(@NotNull
@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull
@NotNull org.bukkit.entity.Player player,
@NotNull
@NotNull List<String> messages,
int messageInterval,
@Nullable
@Nullable List<String> formats,
int formatInterval,
int time,
boolean progressDecrease)
plugin - plugin's instance of your projectplayer - a player, can not be nullmessages - a list of the messages to be displayedmessageInterval - custom interval of messages
if 0, will use the default intervalformats - a list of BarColor and/or BarStyle of the bossbarformatInterval - custom interval of formats
if 0, will use the default intervaltime - the display time of the bossbar in secondsprogressDecrease - if bossbar progress will decrease over timepublic BossbarBuilder(@NotNull
@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull
@NotNull org.bukkit.entity.Player player,
@NotNull
@NotNull org.bukkit.configuration.ConfigurationSection section)
ConfigurationSection of a file.
Basic example: bossbars.ymlplugin - plugin's instance of your projectplayer - a player, can not be nullsection - a ConfigurationSection to format the bossbarpublic BossbarBuilder(@NotNull
@NotNull org.bukkit.plugin.Plugin plugin,
@NotNull
@NotNull org.bukkit.entity.Player player,
String string)
MessageExecutor.BOSSBAR_EXECUTOR pattern.plugin - plugin's instance of your projectplayer - a player, can not be nullstring - an input stringpublic void display()
public void unregister()
@Nullable public static @Nullable Set<BossbarBuilder> getBuilders(org.bukkit.entity.Player player)
player - the player that has the bossbar.Copyright © 2023. All rights reserved.