Class BossBar

java.lang.Object
com.mrivanplays.ivancord.api.util.BossBar

public class BossBar extends Object
Represents a boss bar
  • Constructor Details

    • BossBar

      public BossBar(BaseComponent[] title, BossBar.Color color, BossBar.Style style, float health)
      Creates a new boss bar
      Parameters:
      title - boss bar title
      color - boss bar color
      style - boss bar style
      health - boss bar health. Should be a number between 0.1 and 1
    • BossBar

      public BossBar(BaseComponent[] title, BossBar.Color color, BossBar.Style style)
      Creates a new boss bar
      Parameters:
      title - boss bar title
      color - boss bar color
      style - boss bar style
    • BossBar

      public BossBar(BaseComponent[] title)
      Creates a new boss bar
      Parameters:
      title - boss bar title
  • Method Details

    • getPlayers

      public Collection<ProxiedPlayer> getPlayers()
      Returns a unmodifiable list, containing all of the players, added to this boss bar
      Returns:
      players, if no one added empty list
    • getFlags

      public Collection<BossBar.Flag> getFlags()
      Returns a unmodifiable set, containing all of the flags, added to this boss bar
      Returns:
      flags, if no one added empty set
    • addPlayers

      public void addPlayers(Iterable<ProxiedPlayer> players)
      Adds all players to the boss bar
      Parameters:
      players - the players you wish to add
      See Also:
    • addPlayer

      public void addPlayer(ProxiedPlayer player)
      Adds a player to the boss bar. This makes the player see the boss bar if it is visible.
      Parameters:
      player - the player you wish to add
    • removePlayers

      public void removePlayers(Iterable<ProxiedPlayer> players)
      Removes all specified players from the boss bar
      Parameters:
      players - the players you wish to remove
      See Also:
    • removeAllPlayers

      public void removeAllPlayers()
      Removes all added players from the boss bar
      See Also:
    • removePlayer

      public void removePlayer(ProxiedPlayer player)
      Removes a player from the boss bar. This makes the player not see the boss bar no matter if it is visible or not.
      Parameters:
      player - the player you wish to remove
    • setTitle

      public void setTitle(BaseComponent[] title)
      Sets a (new) boss bar title (name)
      Parameters:
      title - the title you wish to set
    • setHealth

      public void setHealth(float health)
      Sets the health of the boss bar. The health is being represented as a number between 0 and 1. The minimum is 0.1 and the maximum is 1
      Parameters:
      health - the health you wish to set.
    • setColor

      public void setColor(BossBar.Color color)
      Sets a (new) color of the boss bar
      Parameters:
      color - the color you wish to set
    • setStyle

      public void setStyle(BossBar.Style style)
      Sets a (new) boss bar style (overlay)
      Parameters:
      style - the style you wish to set
    • setVisible

      public void setVisible(boolean visible)
      Sets this boss bar's visible state
      Parameters:
      visible - value
    • addFlags

      public void addFlags(BossBar.Flag... flags)
      Adds flag(s) to the boss bar
      Parameters:
      flags - the flag(s) you wish to add
    • addFlags

      public void addFlags(Iterable<BossBar.Flag> flags)
      Adds flag(s) to the boss bar
      Parameters:
      flags - the flag(s) you wish to add
    • removeFlag

      public void removeFlag(BossBar.Flag flag)
      Removes a flag from the boss bar
      Parameters:
      flag - the flag you wish to remove
    • removeFlags

      public void removeFlags(BossBar.Flag... flags)
      Removes the specified flag(s) from the boss bar
      Parameters:
      flags - the flag(s) you wish to remove
    • builder

      public static BossBar.Builder builder()
      Creates a new boss bar builder
      Returns:
      builder
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTitle

      public BaseComponent[] getTitle()
      Title (name) of the boss bar
    • getColor

      public BossBar.Color getColor()
      Color of the boss bar
    • getStyle

      public BossBar.Style getStyle()
      Style (overlay) of the boss bar
    • getHealth

      public float getHealth()
      Health of the boss bar. Represents a number between 0.1 and 1
    • isVisible

      public boolean isVisible()
      Visible state of the boss bar