public final class Title extends Object
Title.Builder
by calling
builder()
.
All properties of a title are optional - if they are not set it will use the current default values from the client.
Modifier and Type | Class and Description |
---|---|
static class |
Title.Builder
Represents a builder class to create immutable
Title
configurations. |
Modifier and Type | Field and Description |
---|---|
static Title |
CLEAR |
static Title |
EMPTY |
static Title |
RESET |
Modifier and Type | Method and Description |
---|---|
static Title.Builder |
builder()
Creates a new
Title configuration builder that will reset the
currently displayed Title on the client before displaying the new
configured one. |
static Title |
clear()
|
boolean |
equals(Object o) |
Optional<Text> |
getActionBar()
Returns the action bar text of this title configuration.
|
Optional<Integer> |
getFadeIn()
Returns the specified time to fade in the title on the client.
|
Optional<Integer> |
getFadeOut()
Returns the specified time to fade out the title on the client.
|
Optional<Integer> |
getStay()
Returns the specified time how long the title should stay on the client.
|
Optional<Text> |
getSubtitle()
Returns the subtitle of this title configuration.
|
Optional<Text> |
getTitle()
Returns the title of this title configuration.
|
int |
hashCode() |
boolean |
isClear()
Returns whether this configuration is clearing the current title from the
screen.
|
boolean |
isReset()
Returns whether this configuration is clearing the current title from the
screen and resetting the current configuration to the default values.
|
static Title |
of()
Returns a
Title that will simply do nothing when it is sent to
the client. |
static Title |
of(Text title)
Returns a
Title that will display the given main title on the
player's screen. |
static Title |
of(Text title,
Text subtitle)
Returns a
Title that will display the given main and subtitle on
the player's screen. |
static Title |
reset()
Returns a
Title that will reset the current title back to default
values on the client. |
Title.Builder |
toBuilder()
Creates a new
Title.Builder using the configuration of this instance. |
String |
toString() |
static Title.Builder |
update()
Creates a new empty
Title configuration builder. |
public static final Title EMPTY
public static final Title CLEAR
public static final Title RESET
public Optional<Text> getTitle()
Text
of the title, if it was configuredpublic Optional<Text> getSubtitle()
Text
of the subtitle, if it was configuredpublic Optional<Text> getActionBar()
Text
of the action bar, if it was configuredpublic Optional<Integer> getFadeIn()
getStay()
.
The default value for Vanilla is 20 (1 second).
public Optional<Integer> getStay()
getFadeOut()
.
The default value for Vanilla is 60 (3 second).
public Optional<Integer> getFadeOut()
The default value for Vanilla is 20 (1 second).
public boolean isClear()
public boolean isReset()
This is recommended when you want to make sure to display a single title.
public Title.Builder toBuilder()
Title.Builder
using the configuration of this instance.public static Title of()
Title
that will simply do nothing when it is sent to
the client.public static Title of(Text title)
Title
that will display the given main title on the
player's screen.title
- The title to displaypublic static Title of(Text title, Text subtitle)
Title
that will display the given main and subtitle on
the player's screen.title
- The title to displaysubtitle
- The subtitle to displaypublic static Title clear()
public static Title reset()
Title
that will reset the current title back to default
values on the client.public static Title.Builder builder()
Title
configuration builder that will reset the
currently displayed Title on the client before displaying the new
configured one.Title.Builder
update()
public static Title.Builder update()
Title
configuration builder. Unlike
builder()
this won't reset the current Title on the client before
displaying the current one. This has less use cases but should be used if
just the previously sent Title should be updated.Title.Builder
builder()