Record Class BossBar

java.lang.Object
java.lang.Record
net.flectone.pulse.model.value.BossBar
Record Components:
duration - how long the bar stays on screen, in ticks
health - the filled fraction of the bar, from 0.0 to 1.0
overlay - the segment style drawn over the bar
color - the bar color
flags - extra client effects such as fog or boss music

public record BossBar(long duration, float health, net.kyori.adventure.bossbar.BossBar.Overlay overlay, net.kyori.adventure.bossbar.BossBar.Color color, EnumSet<net.kyori.adventure.bossbar.BossBar.Flag> flags) extends Record
A boss bar shown above the hotbar for a limited time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BossBar(long duration, float health, net.kyori.adventure.bossbar.BossBar.Overlay overlay, net.kyori.adventure.bossbar.BossBar.Color color)
    Creates a boss bar with no extra flags.
    BossBar(long duration, float health, net.kyori.adventure.bossbar.BossBar.Overlay overlay, net.kyori.adventure.bossbar.BossBar.Color color, EnumSet<net.kyori.adventure.bossbar.BossBar.Flag> flags)
    Creates an instance of a BossBar record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.kyori.adventure.bossbar.BossBar.Color
    Returns the value of the color record component.
    long
    Returns the value of the duration record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    EnumSet<net.kyori.adventure.bossbar.BossBar.Flag>
    Returns the value of the flags record component.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the health record component.
    net.kyori.adventure.bossbar.BossBar.Overlay
    Returns the value of the overlay record component.
    final String
    Returns a string representation of this record class.
    withFlag(net.kyori.adventure.bossbar.BossBar.Flag flag)
    Returns a copy of this bar with an extra flag enabled.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BossBar

      public BossBar(long duration, float health, net.kyori.adventure.bossbar.BossBar.Overlay overlay, net.kyori.adventure.bossbar.BossBar.Color color)
      Creates a boss bar with no extra flags.
      Parameters:
      duration - how long the bar stays on screen, in ticks
      health - the filled fraction of the bar, from 0.0 to 1.0
      overlay - the segment style drawn over the bar
      color - the bar color
    • BossBar

      public BossBar(long duration, float health, net.kyori.adventure.bossbar.BossBar.Overlay overlay, net.kyori.adventure.bossbar.BossBar.Color color, EnumSet<net.kyori.adventure.bossbar.BossBar.Flag> flags)
      Creates an instance of a BossBar record class.
      Parameters:
      duration - the value for the duration record component
      health - the value for the health record component
      overlay - the value for the overlay record component
      color - the value for the color record component
      flags - the value for the flags record component
  • Method Details

    • withFlag

      public BossBar withFlag(net.kyori.adventure.bossbar.BossBar.Flag flag)
      Returns a copy of this bar with an extra flag enabled.
      Parameters:
      flag - the flag to add
      Returns:
      a new boss bar carrying the flag
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • duration

      public long duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • health

      public float health()
      Returns the value of the health record component.
      Returns:
      the value of the health record component
    • overlay

      public net.kyori.adventure.bossbar.BossBar.Overlay overlay()
      Returns the value of the overlay record component.
      Returns:
      the value of the overlay record component
    • color

      public net.kyori.adventure.bossbar.BossBar.Color color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • flags

      public EnumSet<net.kyori.adventure.bossbar.BossBar.Flag> flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component