Danger

The Adventure docs are currently a work in progress. Some areas may have limited coverage or may not be entirely up to date. Feel free to join our discord at https://discord.gg/MMfhJ8F if you have any questions.

Titles

Constructing a Title

Titles are composed of:
  • A component used for the main title

  • A component used for the subtitle

  • Optionally, a Title.Times object can be used to determine the fade-in, stay on screen and fade-out durations

Examples:

public void showMyTitle(final @NonNull Audience target) {
  final Component mainTitle = Component.text("This is the main title", NamedTextColor.WHITE);
  final Component subtitle = Component.text("This is the subtitle", NamedTextColor.GRAY);

  // Creates a simple title with the default values for fade-in, stay on screen and fade-out durations
  final Title title = Title.title(mainTitle, subtitle);

  // Send the title to your audience
  target.showTitle(title);
}

public void showMyTitleWithDurations(final @NonNull Audience target) {
  final Title.Times times = Title.Times.of(Duration.ofMillis(500), Duration.ofMillis(3000), Duration.ofMillis(1000));
  // Using the times object this title will use 500ms to fade in, stay on screen for 3000ms and then fade out for 1000ms
  final Title title = Title.title(Component.text("Hello!"), Component.empty(), times);

  // Send the title, you can also use Audience#clearTitle() to remove the title at any time
  target.showTitle(title);
}