Record Class Destination

java.lang.Object
java.lang.Record
net.flectone.pulse.model.value.Destination
Record Components:
type - the delivery target
subtext - the secondary line, used by titles and toasts
bossBar - the boss bar settings, used by Destination.Type.BOSS_BAR
times - the fade and stay timings, used by titles and the action bar
toast - the toast settings, used by Destination.Type.TOAST
textScreen - the floating text settings, used by Destination.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.
  • Field Details

    • DEFAULT_TYPE

      public static final Destination.Type DEFAULT_TYPE
      The delivery target used when the config leaves them out.
    • DEFAULT_SUBTEXT

      public static final String DEFAULT_SUBTEXT
      The secondary line used when the config leaves them out.
      See Also:
    • DEFAULT_BOSS_BAR

      public static final BossBar DEFAULT_BOSS_BAR
      The boss bar settings used when the config leaves them out.
    • DEFAULT_TIMES

      public static final Times DEFAULT_TIMES
      The title timings used when the config leaves them out.
    • DEFAULT_TOAST

      public static final Toast DEFAULT_TOAST
      The toast settings used when the config leaves them out.
    • DEFAULT_TEXT_SCREEN

      public static final TextScreen DEFAULT_TEXT_SCREEN
      The text screen settings used when the config leaves them out.
    • EMPTY_ACTION_BAR

      public static final Destination EMPTY_ACTION_BAR
      The shared all-default destination for the action bar, so equal destinations share one instance.
    • EMPTY_BOSS_BAR

      public static final Destination EMPTY_BOSS_BAR
      The shared all-default destination for a boss bar, so equal destinations share one instance.
    • EMPTY_BRAND

      public static final Destination EMPTY_BRAND
      The shared all-default destination for the server brand, so equal destinations share one instance.
    • EMPTY_CHAT

      public static final Destination EMPTY_CHAT
      The shared all-default destination for chat, so equal destinations share one instance.
    • EMPTY_TITLE

      public static final Destination EMPTY_TITLE
      The shared all-default destination for a title, so equal destinations share one instance.
    • EMPTY_SUBTITLE

      public static final Destination EMPTY_SUBTITLE
      The shared all-default destination for a subtitle, so equal destinations share one instance.
    • EMPTY_TAB_HEADER

      public static final Destination EMPTY_TAB_HEADER
      The shared all-default destination for the tab list header, so equal destinations share one instance.
    • EMPTY_TEXT_SCREEN

      public static final Destination EMPTY_TEXT_SCREEN
      The shared all-default destination for a floating text screen, so equal destinations share one instance.
    • EMPTY_TOAST

      public static final Destination 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

      public Destination(Destination.Type type)
      Creates a destination that needs no extra settings.
      Parameters:
      type - the delivery target
    • Destination

      public Destination(Destination.Type type, BossBar bossBar)
      Creates a boss bar destination.
      Parameters:
      type - the delivery target
      bossBar - the boss bar settings
    • Destination

      public Destination(Destination.Type type, Times times)
      Creates a destination timed by fade in, stay and fade out.
      Parameters:
      type - the delivery target
      times - the timings
    • Destination

      public Destination(Destination.Type type, Times times, String subtext)
      Creates a title-like destination with a secondary line.
      Parameters:
      type - the delivery target
      times - the timings
      subtext - the secondary line
    • Destination

      public Destination(Destination.Type type, Toast toast, String subtext)
      Creates a toast destination with a secondary line.
      Parameters:
      type - the delivery target
      toast - the toast settings
      subtext - the secondary line
    • Destination

      public Destination(Destination.Type type, TextScreen textScreen)
      Creates a floating text screen destination.
      Parameters:
      type - the delivery target
      textScreen - the text screen settings
  • Method Details

    • fromJson

      public static Destination fromJson(Map<String,Object> map)
      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

      public Map<String,Object> toJson()
      Writes this destination back to its config representation, emitting only the keys its type uses.
      Returns:
      the config values
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public Destination.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • subtext

      public String subtext()
      Returns the value of the subtext record component.
      Returns:
      the value of the subtext record component
    • bossBar

      public BossBar bossBar()
      Returns the value of the bossBar record component.
      Returns:
      the value of the bossBar record component
    • times

      public Times times()
      Returns the value of the times record component.
      Returns:
      the value of the times record component
    • toast

      public Toast toast()
      Returns the value of the toast record component.
      Returns:
      the value of the toast record component
    • textScreen

      public TextScreen textScreen()
      Returns the value of the textScreen record component.
      Returns:
      the value of the textScreen record component