Class Title.Builder

java.lang.Object
com.destroystokyo.paper.Title.Builder
Enclosing class:
Title

public static final class Title.Builder extends Object
A builder for creating titles
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • title

      @NotNull public Title.Builder title(@NotNull net.md_5.bungee.api.chat.BaseComponent title)
      Sets the title to the given text.
      Parameters:
      title - the title text
      Returns:
      this builder instance
      Throws:
      NullPointerException - if the title is null
    • title

      @NotNull public Title.Builder title(@NotNull net.md_5.bungee.api.chat.BaseComponent[] title)
      Sets the title to the given text.
      Parameters:
      title - the title text
      Returns:
      this builder instance
      Throws:
      NullPointerException - if the title is null
    • title

      @NotNull public Title.Builder title(@NotNull String title)
      Sets the title to the given text.

      It is recommended to the BaseComponent methods.

      Parameters:
      title - the title text
      Returns:
      this builder instance
      Throws:
      NullPointerException - if the title is null
    • subtitle

      @NotNull public Title.Builder subtitle(@Nullable net.md_5.bungee.api.chat.BaseComponent subtitle)
      Sets the subtitle to the given text.
      Parameters:
      subtitle - the title text
      Returns:
      this builder instance
    • subtitle

      @NotNull public Title.Builder subtitle(@Nullable net.md_5.bungee.api.chat.BaseComponent[] subtitle)
      Sets the subtitle to the given text.
      Parameters:
      subtitle - the title text
      Returns:
      this builder instance
    • subtitle

      @NotNull public Title.Builder subtitle(@Nullable String subtitle)
      Sets the subtitle to the given text.

      It is recommended to the BaseComponent methods.

      Parameters:
      subtitle - the title text
      Returns:
      this builder instance
    • fadeIn

      @NotNull public Title.Builder fadeIn(int fadeIn)
      Sets the number of ticks for the title to fade in
      Parameters:
      fadeIn - the number of ticks to fade in
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if it is negative
    • stay

      @NotNull public Title.Builder stay(int stay)
      Sets the number of ticks for the title to stay.
      Parameters:
      stay - the number of ticks to stay
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if it is negative
    • fadeOut

      @NotNull public Title.Builder fadeOut(int fadeOut)
      Sets the number of ticks for the title to fade out.
      Parameters:
      fadeOut - the number of ticks to fade out
      Returns:
      this builder instance
      Throws:
      IllegalArgumentException - if it is negative
    • build

      @NotNull public Title build()
      Create a title based on the values in the builder.
      Returns:
      a title from the values in this builder
      Throws:
      IllegalStateException - if title isn't specified