Interface Text

All Known Implementing Classes:
Text.Literal, Text.Translated

public sealed interface Text permits Text.Literal, Text.Translated
Text rendered only when the viewer's locale is known: a fixed component or a key and arguments. Used for names, titles, labels and lore stored before delivery. The set of permitted subtypes may grow in a 7.x minor release. Code outside the framework must not switch over it exhaustively without a default branch.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Fixed text.
    static final record 
    A deferred message with an unmodifiable argument copy.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static Text
    literal(net.kyori.adventure.text.ComponentLike component)
    Returns a fixed component, identical for all locales.
    static Text
    of(MessageKey key, Arg... args)
    Returns a deferred message; argument names must be unique.
    static Text
    of(MessageKey key, List<? extends Arg> args)
    Returns a deferred message; argument names must be unique.
    static Text
    plain(String plain)
    Shorthand for literal(Component.text(plain)).
  • Method Details

    • literal

      static Text literal(net.kyori.adventure.text.ComponentLike component)
      Returns a fixed component, identical for all locales.
    • plain

      static Text plain(String plain)
      Shorthand for literal(Component.text(plain)).
    • of

      static Text of(MessageKey key, Arg... args)
      Returns a deferred message; argument names must be unique. The array is copied.
    • of

      static Text of(MessageKey key, List<? extends Arg> args)
      Returns a deferred message; argument names must be unique. The list is copied.