Interface BossBar

  • All Superinterfaces:
    net.kyori.examination.Examinable

    @NonExtendable
    public interface BossBar
    extends net.kyori.examination.Examinable
    Represents an in-game bossbar which can be shown to the client.

    A bossbar consists of:

    name
    the title of the bossbar
    progress
    a number in the range [0,1] representing how much of the bossbar should be filled
    color
    the BossBar.Color of the bossbar; platforms may downsample this for versions below Java Edition 1.9
    overlay
    BossBar.Overlays decide if the bossbar is continuous or split into segments
    flags(optional)
    BossBar.Flags are extra actions that can be triggered whenever the bossbar is displayed
    Since:
    4.0.0
    • Field Detail

      • MIN_PROGRESS

        static final float MIN_PROGRESS
        The minimum value the progress can be.
        Since:
        4.2.0
        See Also:
        Constant Field Values
      • MAX_PROGRESS

        static final float MAX_PROGRESS
        The maximum value the progress can be.
        Since:
        4.2.0
        See Also:
        Constant Field Values
      • MIN_PERCENT

        @ScheduledForRemoval(inVersion="5.0.0")
        @Deprecated
        static final float MIN_PERCENT
        Deprecated.
        for removal since 4.2.0, use MIN_PROGRESS
        The minimum value the progress can be.
        Since:
        4.0.0
        See Also:
        Constant Field Values
      • MAX_PERCENT

        @ScheduledForRemoval(inVersion="5.0.0")
        @Deprecated
        static final float MAX_PERCENT
        Deprecated.
        for removal since 4.2.0, use MAX_PROGRESS
        The maximum value the progress can be.
        Since:
        4.0.0
        See Also:
        Constant Field Values
    • Method Detail

      • bossBar

        @NotNull
        static @NotNull BossBar bossBar​(@NotNull
                                        @NotNull ComponentLike name,
                                        float progress,
                                        @NotNull
                                        @NotNull BossBar.Color color,
                                        @NotNull
                                        @NotNull BossBar.Overlay overlay)
        Creates a new bossbar.
        Parameters:
        name - the name
        progress - the progress, between 0 and 1
        color - the color
        overlay - the overlay
        Returns:
        a bossbar
        Throws:
        java.lang.IllegalArgumentException - if progress is less than 0 or greater than 1
        Since:
        4.3.0
      • bossBar

        @NotNull
        static @NotNull BossBar bossBar​(@NotNull
                                        @NotNull Component name,
                                        float progress,
                                        @NotNull
                                        @NotNull BossBar.Color color,
                                        @NotNull
                                        @NotNull BossBar.Overlay overlay)
        Creates a new bossbar.
        Parameters:
        name - the name
        progress - the progress, between 0 and 1
        color - the color
        overlay - the overlay
        Returns:
        a bossbar
        Throws:
        java.lang.IllegalArgumentException - if progress is less than 0 or greater than 1
        Since:
        4.0.0
      • bossBar

        @NotNull
        static @NotNull BossBar bossBar​(@NotNull
                                        @NotNull ComponentLike name,
                                        float progress,
                                        @NotNull
                                        @NotNull BossBar.Color color,
                                        @NotNull
                                        @NotNull BossBar.Overlay overlay,
                                        @NotNull
                                        @NotNull java.util.Set<BossBar.Flag> flags)
        Creates a new bossbar.
        Parameters:
        name - the name
        progress - the progress, between 0 and 1
        color - the color
        overlay - the overlay
        flags - the flags
        Returns:
        a bossbar
        Throws:
        java.lang.IllegalArgumentException - if progress is less than 0 or greater than 1
        Since:
        4.3.0
      • bossBar

        @NotNull
        static @NotNull BossBar bossBar​(@NotNull
                                        @NotNull Component name,
                                        float progress,
                                        @NotNull
                                        @NotNull BossBar.Color color,
                                        @NotNull
                                        @NotNull BossBar.Overlay overlay,
                                        @NotNull
                                        @NotNull java.util.Set<BossBar.Flag> flags)
        Creates a new bossbar.
        Parameters:
        name - the name
        progress - the progress, between 0 and 1
        color - the color
        overlay - the overlay
        flags - the flags
        Returns:
        a bossbar
        Throws:
        java.lang.IllegalArgumentException - if progress is less than 0 or greater than 1
        Since:
        4.0.0
      • name

        @NotNull
        @NotNull Component name()
        Gets the name.
        Returns:
        the name
        Since:
        4.0.0
      • name

        @Contract("_ -> this")
        @NotNull
        default @NotNull BossBar name​(@NotNull
                                      @NotNull ComponentLike name)
        Sets the name.
        Parameters:
        name - the name
        Returns:
        the bossbar
        Since:
        4.3.0
      • name

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar name​(@NotNull
                              @NotNull Component name)
        Sets the name.
        Parameters:
        name - the name
        Returns:
        the bossbar
        Since:
        4.0.0
      • progress

        float progress()
        Gets the progress.

        The progress is a value between 0 and 1.

        Returns:
        the progress
        Since:
        4.0.0
      • progress

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar progress​(float progress)
        Sets the progress.

        The progress is a value between 0 and 1.

        Parameters:
        progress - the progress
        Returns:
        the bossbar
        Throws:
        java.lang.IllegalArgumentException - if progress is less than 0 or greater than 1
        Since:
        4.0.0
      • percent

        @ScheduledForRemoval(inVersion="5.0.0")
        @Deprecated
        default float percent()
        Deprecated.
        for removal since 4.2.0, use progress()
        Gets the progress.

        The progress is a value between 0 and 1.

        Returns:
        the progress
        Since:
        4.0.0
      • percent

        @ScheduledForRemoval(inVersion="5.0.0")
        @Contract("_ -> this")
        @Deprecated
        @NotNull
        default @NotNull BossBar percent​(float progress)
        Deprecated.
        for removal since 4.2.0, use progress(float)
        Sets the progress.

        The progress is a value between 0 and 1.

        Parameters:
        progress - the progress
        Returns:
        the bossbar
        Throws:
        java.lang.IllegalArgumentException - if progress is less than 0 or greater than 1
        Since:
        4.0.0
      • color

        @NotNull
        @NotNull BossBar.Color color()
        Gets the color.
        Returns:
        the color
        Since:
        4.0.0
      • color

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar color​(@NotNull
                               @NotNull BossBar.Color color)
        Sets the color.
        Parameters:
        color - the color
        Returns:
        the bossbar
        Since:
        4.0.0
      • overlay

        @NotNull
        @NotNull BossBar.Overlay overlay()
        Gets the overlay.
        Returns:
        the overlay
        Since:
        4.0.0
      • overlay

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar overlay​(@NotNull
                                 @NotNull BossBar.Overlay overlay)
        Sets the overlay.
        Parameters:
        overlay - the overlay
        Returns:
        the bossbar
        Since:
        4.0.0
      • flags

        @NotNull
        @UnmodifiableView @NotNull java.util.Set<BossBar.Flag> flags()
        Gets the flags.
        Returns:
        the flags
        Since:
        4.0.0
      • flags

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar flags​(@NotNull
                               @NotNull java.util.Set<BossBar.Flag> flags)
        Sets the flags.
        Parameters:
        flags - the flags
        Returns:
        the bossbar
        Since:
        4.0.0
      • hasFlag

        boolean hasFlag​(@NotNull
                        @NotNull BossBar.Flag flag)
        Checks if this bossbar has a flag.
        Parameters:
        flag - the flag
        Returns:
        true if this bossbar has the flag, false otherwise
        Since:
        4.0.0
      • addFlag

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar addFlag​(@NotNull
                                 @NotNull BossBar.Flag flag)
        Adds a flag to this bossbar.
        Parameters:
        flag - the flag
        Returns:
        the bossbar
        Since:
        4.0.0
      • removeFlag

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar removeFlag​(@NotNull
                                    @NotNull BossBar.Flag flag)
        Removes a flag from this bossbar.
        Parameters:
        flag - the flag
        Returns:
        the bossbar
        Since:
        4.0.0
      • addFlags

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar addFlags​(@NotNull
                                  @NotNull BossBar.Flag @NotNull ... flags)
        Adds flags to this bossbar.
        Parameters:
        flags - the flags
        Returns:
        the bossbar
        Since:
        4.0.0
      • removeFlags

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar removeFlags​(@NotNull
                                     @NotNull BossBar.Flag @NotNull ... flags)
        Removes flags from this bossbar.
        Parameters:
        flags - the flags
        Returns:
        the bossbar
        Since:
        4.0.0
      • addFlags

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar addFlags​(@NotNull
                                  @NotNull java.lang.Iterable<BossBar.Flag> flags)
        Adds flags to this bossbar.
        Parameters:
        flags - the flags
        Returns:
        the bossbar
        Since:
        4.0.0
      • removeFlags

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar removeFlags​(@NotNull
                                     @NotNull java.lang.Iterable<BossBar.Flag> flags)
        Removes flags from this bossbar.
        Parameters:
        flags - the flags
        Returns:
        the bossbar
        Since:
        4.0.0
      • addListener

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar addListener​(@NotNull
                                     @NotNull BossBar.Listener listener)
        Adds a listener.
        Parameters:
        listener - a listener
        Returns:
        the bossbar
        Since:
        4.0.0
      • removeListener

        @Contract("_ -> this")
        @NotNull
        @NotNull BossBar removeListener​(@NotNull
                                        @NotNull BossBar.Listener listener)
        Removes a listener.
        Parameters:
        listener - a listener
        Returns:
        the bossbar
        Since:
        4.0.0