Title Module
Overview
The title module backports all vanilla title
& subtitle
features found in 1.8+ to 1.7 Lunar Client players.
- Ability to display title-screens for players on 1.7 Lunar Client.
- Display titles for 1.7 Lunar Client players.
- Display subtitles for 1.7 Lunar Client players.
This module is only useful for servers that support the 1.7 versions of Minecraft.
Integration
Title
Builder
private final Title helloTitle = Title.builder()
.type(TitleType.TITLE)
.message(Component.text()
.content("Hello, player!")
.color(NamedTextColor.GREEN)
.decorate(TextDecoration.BOLD)
.build())
.scale(1.0f)
.displayTime(Duration.ofMillis(1500L))
.fadeInTime(Duration.ofMillis(250))
.fadeOutTime(Duration.ofMillis(300))
.build();
Title
Options
.type(TitleType)
is the type of title you want to display. See the TitleType types section for more.
.type(TitleType.TITLE)
.message(Component)
is the message you want to display. See the chat components (opens in a new tab) page for more.
.message(Component.text()
.content("Hello, player!")
.color(NamedTextColor.GREEN)
.decorate(TextDecoration.BOLD)
.build())
.scale(Float)
is scale of the message
you're displaying.
.scale(1.0f)
.displayTime(java.time.Duration)
is the duration you want to keep the message
on screen. See the java.time.Duration Javadocs (opens in a new tab) for more.
.displayTime(Duration.ofMillis(1500L))
.fadeInTime(java.time.Duration)
is the length of time that the message
takes to fade in. See the java.time.Duration Javadocs (opens in a new tab) for more.
.fadeInTime(Duration.ofMillis(250))
.fadeOutTime(java.time.Duration)
is the length of time that the message
takes to fade out. See the java.time.Duration Javadocs (opens in a new tab) for more.
.fadeOutTime(Duration.ofMillis(300))
Displaying a title for a player
public void displayTitleExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(apolloPlayer -> this.titleModule.displayTitle(apolloPlayer, this.helloTitle));
}
Resetting all titles for a player
public void resetTitlesExample(Player viewer) {
Optional<ApolloPlayer> apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId());
apolloPlayerOpt.ifPresent(this.titleModule::resetTitles);
}
TitleType
Types
TITLE
SUBTITLE