Interface TitleManager


public interface TitleManager
Manages the timing and display of titles for players.

A TitleManager controls the timing parameters (fade in, stay, and fade out ticks) for title messages displayed to players. It provides methods to get and set these tick values, as well as a builder pattern to conveniently construct and send title messages.

The built-in TitleManager.Builder class allows for fluent customization of title and subtitle messages, including the configuration of timing and the dispatch of the title to players.

See Also:
  • Player.sendTitle(String, String, int, int, int)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    A builder class for configuring and sending title messages to players.
  • Method Summary

    Modifier and Type
    Method
    Description
    builder(String message)
    Creates a new TitleManager.Builder for constructing a title message using a single combined message.
    builder(String title, String subtitle)
    Creates a new TitleManager.Builder for constructing a title message with the specified title and subtitle.
    int
    Gets the number of ticks for the title fade-in animation.
    int
    Gets the number of ticks for the title fade-out animation.
    int
    Gets the number of ticks that the title remains on screen.
    void
    setFadeInTicks(int fadeIn)
    Sets the number of ticks for the title fade-in animation.
    void
    setFadeOutTicks(int fadeOut)
    Sets the number of ticks for the title fade-out animation.
    void
    setStayTicks(int stay)
    Sets the number of ticks that the title remains on screen.
    default void
    setTicks(int fadeIn, int stay, int fadeOut)
    Sets the fade in, stay, and fade out ticks for the title simultaneously.
  • Method Details

    • getFadeInTicks

      int getFadeInTicks()
      Gets the number of ticks for the title fade-in animation.
      Returns:
      the fade-in ticks
    • getStayTicks

      int getStayTicks()
      Gets the number of ticks that the title remains on screen.
      Returns:
      the stay ticks
    • getFadeOutTicks

      int getFadeOutTicks()
      Gets the number of ticks for the title fade-out animation.
      Returns:
      the fade-out ticks
    • setFadeInTicks

      void setFadeInTicks(int fadeIn)
      Sets the number of ticks for the title fade-in animation.
      Parameters:
      fadeIn - the fade-in ticks (must be ≥ 0)
    • setStayTicks

      void setStayTicks(int stay)
      Sets the number of ticks that the title remains on screen.
      Parameters:
      stay - the stay ticks (must be > 0)
    • setFadeOutTicks

      void setFadeOutTicks(int fadeOut)
      Sets the number of ticks for the title fade-out animation.
      Parameters:
      fadeOut - the fade-out ticks (must be ≥ 0)
    • setTicks

      default void setTicks(int fadeIn, int stay, int fadeOut)
      Sets the fade in, stay, and fade out ticks for the title simultaneously.

      Each parameter is validated: fade-in and fade-out must be non-negative, and stay must be positive. Invalid values are ignored.

      Parameters:
      fadeIn - the fade-in ticks
      stay - the stay ticks
      fadeOut - the fade-out ticks
    • builder

      default TitleManager.Builder builder(String title, String subtitle)
      Creates a new TitleManager.Builder for constructing a title message with the specified title and subtitle.

      The builder is pre-populated with the current tick settings from this manager.

      Parameters:
      title - the main title text
      subtitle - the subtitle text
      Returns:
      a new TitleManager.Builder instance for creating and sending the title
    • builder

      TitleManager.Builder builder(String message)
      Creates a new TitleManager.Builder for constructing a title message using a single combined message.

      The interpretation of a single message is implementation-dependent.

      Parameters:
      message - the combined title message
      Returns:
      a new TitleManager.Builder instance