Record Class Destination
java.lang.Object
java.lang.Record
net.flectone.pulse.model.value.Destination
- Record Components:
type- the delivery targetsubtext- the secondary line, used by titles and toastsbossBar- the boss bar settings, used byDestination.Type.BOSS_BARtimes- the fade and stay timings, used by titles and the action bartoast- the toast settings, used byDestination.Type.TOASTtextScreen- the floating text settings, used byDestination.Type.TEXT_SCREEN
public record Destination(Destination.Type type, String subtext, BossBar bossBar, Times times, Toast toast, TextScreen textScreen)
extends Record
Where a message is delivered on the client, such as chat, a title, a boss bar or a toast.
Only the fields that belong to the chosen
Destination.Type are populated; the rest stay null.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe client surface a message is written to. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BossBarThe boss bar settings used when the config leaves them out.static final StringThe secondary line used when the config leaves them out.static final TextScreenThe text screen settings used when the config leaves them out.static final TimesThe title timings used when the config leaves them out.static final ToastThe toast settings used when the config leaves them out.static final Destination.TypeThe delivery target used when the config leaves them out.static final DestinationThe shared all-default destination for the action bar, so equal destinations share one instance.static final DestinationThe shared all-default destination for a boss bar, so equal destinations share one instance.static final DestinationThe shared all-default destination for the server brand, so equal destinations share one instance.static final DestinationThe shared all-default destination for chat, so equal destinations share one instance.static final DestinationThe shared all-default destination for a subtitle, so equal destinations share one instance.static final DestinationThe shared all-default destination for the tab list footer, so equal destinations share one instance.static final DestinationThe shared all-default destination for the tab list header, so equal destinations share one instance.static final DestinationThe shared all-default destination for a floating text screen, so equal destinations share one instance.static final DestinationThe shared all-default destination for a title, so equal destinations share one instance.static final DestinationThe shared all-default destination for a toast, so equal destinations share one instance. -
Constructor Summary
ConstructorsConstructorDescriptionDestination(Destination.Type type) Creates a destination that needs no extra settings.Destination(Destination.Type type, String subtext, BossBar bossBar, Times times, Toast toast, TextScreen textScreen) Fills in the defaults that the chosen type needs, leaving unrelated fields null.Destination(Destination.Type type, BossBar bossBar) Creates a boss bar destination.Destination(Destination.Type type, TextScreen textScreen) Creates a floating text screen destination.Destination(Destination.Type type, Times times) Creates a destination timed by fade in, stay and fade out.Destination(Destination.Type type, Times times, String subtext) Creates a title-like destination with a secondary line.Destination(Destination.Type type, Toast toast, String subtext) Creates a toast destination with a secondary line. -
Method Summary
Modifier and TypeMethodDescriptionbossBar()Returns the value of thebossBarrecord component.final booleanIndicates whether some other object is "equal to" this one.static DestinationReads a destination from its config representation.final inthashCode()Returns a hash code value for this object.subtext()Returns the value of thesubtextrecord component.Returns the value of thetextScreenrecord component.times()Returns the value of thetimesrecord component.toast()Returns the value of thetoastrecord component.toJson()Writes this destination back to its config representation, emitting only the keys its type uses.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Field Details
-
DEFAULT_TYPE
The delivery target used when the config leaves them out. -
DEFAULT_SUBTEXT
The secondary line used when the config leaves them out.- See Also:
-
DEFAULT_BOSS_BAR
The boss bar settings used when the config leaves them out. -
DEFAULT_TIMES
The title timings used when the config leaves them out. -
DEFAULT_TOAST
The toast settings used when the config leaves them out. -
DEFAULT_TEXT_SCREEN
The text screen settings used when the config leaves them out. -
EMPTY_ACTION_BAR
The shared all-default destination for the action bar, so equal destinations share one instance. -
EMPTY_BOSS_BAR
The shared all-default destination for a boss bar, so equal destinations share one instance. -
EMPTY_BRAND
The shared all-default destination for the server brand, so equal destinations share one instance. -
EMPTY_CHAT
The shared all-default destination for chat, so equal destinations share one instance. -
EMPTY_TITLE
The shared all-default destination for a title, so equal destinations share one instance. -
EMPTY_SUBTITLE
The shared all-default destination for a subtitle, so equal destinations share one instance. -
EMPTY_TAB_HEADER
The shared all-default destination for the tab list header, so equal destinations share one instance. -
EMPTY_TAB_FOOTER
The shared all-default destination for the tab list footer, so equal destinations share one instance. -
EMPTY_TEXT_SCREEN
The shared all-default destination for a floating text screen, so equal destinations share one instance. -
EMPTY_TOAST
The shared all-default destination for a toast, so equal destinations share one instance.
-
-
Constructor Details
-
Destination
public Destination(Destination.Type type, String subtext, BossBar bossBar, Times times, Toast toast, TextScreen textScreen) Fills in the defaults that the chosen type needs, leaving unrelated fields null. -
Destination
Creates a destination that needs no extra settings.- Parameters:
type- the delivery target
-
Destination
Creates a boss bar destination.- Parameters:
type- the delivery targetbossBar- the boss bar settings
-
Destination
Creates a destination timed by fade in, stay and fade out.- Parameters:
type- the delivery targettimes- the timings
-
Destination
Creates a title-like destination with a secondary line.- Parameters:
type- the delivery targettimes- the timingssubtext- the secondary line
-
Destination
Creates a toast destination with a secondary line.- Parameters:
type- the delivery targettoast- the toast settingssubtext- the secondary line
-
Destination
Creates a floating text screen destination.- Parameters:
type- the delivery targettextScreen- the text screen settings
-
-
Method Details
-
fromJson
Reads a destination from its config representation. Values matching the defaults collapse to the shared EMPTY_* constants so equal destinations share one instance.- Parameters:
map- the raw config values- Returns:
- the parsed destination
-
toJson
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
-
subtext
-
bossBar
-
times
-
toast
-
textScreen
Returns the value of thetextScreenrecord component.- Returns:
- the value of the
textScreenrecord component
-