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();
private final Title interpolatedTitle = Title.builder()
.type(TitleType.TITLE)
.message(Component.text()
.content("This title expands!")
.color(NamedTextColor.GREEN)
.decorate(TextDecoration.BOLD)
.build())
.scale(0.1f)
.interpolationScale(1.0f)
.interpolationRate(0.01f)
.displayTime(Duration.ofMillis(5000L))
.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))
.interpolationScale(Float)
if the provided interpolation scale is greater than the scale, the title will expand. However, if the scale is greater than the interpolation scale, the title will shrink.
.interpolationScale(1.0f)
.interpolationRate(Float)
is the rate that the title will expand or shrink every tick (50ms) between the scale and the interpolation scale.
.interpolationRate(0.01f)
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