Skip to content

DisplayBar

Peter edited this page Jul 10, 2023 · 2 revisions

Documentation

public class DisplayBar

In between class for Minecraft's built in bossbar and timers

public BossBar bar

Minecraft BossBar

private String name

Display name of bar

private boolean showName

If the name should be included in bar title

private boolean showTime

If time remaining should be in bar title

public DisplayBar(String name, BarColor color, BarStyle style)

Create a new DisplayBar with name, color and style. Shows both name and time in title

  • Parameters:
    • name — Display name
    • color — Bar display color
    • style — Bar display style

public DisplayBar(String name, BarColor color, BarStyle style, boolean showName, boolean showTime)

Create a new DisplayBar with name, color and style. Shows both name and time in title

  • Parameters:
    • name — Display name
    • color — Bar display color
    • style — Bar display style
    • showName — Show name in title
    • showTime — Show time remaining in title

public void update(String time, double progress)

Update time remaining text and bar progress

  • Parameters:
    • time — Time remaining formated string
    • progress — Bar progress from 0 to 1

public void setName(String name)

Set the display name of the bar

  • Parameters: name — Display name

public void setColor(BarColor color)

Set the display color of the bar

  • Parameters: color — Display color

public void setStyle(BarStyle style)

Set the display style of the bar

  • Parameters: style — Display style

public void setVisible(boolean visible)

Set bar visibility

  • Parameters: visible — If the bar should be visible

public void removePlayer(Player p)

Hide the bar from a player

  • Parameters: p — Player to hide the bar from

public void addPlayer(Player p)

Show the bar to a player

  • Parameters: p — Player to show the bar to

public List<Player> getPlayers()

Get all of the players who can see this bar

  • Returns: List of all players who can see the bar

public void remove()

Hide this bar (Does to remove players)

public void showName()

Sets the display name to be included in the title

public void showName(boolean showName)

Sets whether the display name should be included in the title

  • Parameters: showName — If the display name should be included in the title

public void hideName()

Sets the display name to not be show in title

public void showTime()

Sets the time remaining to be show in the title

public void showTime(boolean showTime)

Sets whether the time remaining to be show in the title

  • Parameters: showTime — If the time remaining should be in the title

public void hideTime()

Sets the time remaining to not be shown in the title