Class ComponentSerializers

java.lang.Object
com.cotani.text.ComponentSerializers

@NullMarked public final class ComponentSerializers extends Object
Centralizes the standard Adventure component serializers as reusable, immutable singletons.

Adventure serializers are thread-safe and can be shared across the application. This class provides a single point of access for the most common serializers, avoiding repeated lookups and scattered imports.

For custom serializer configurations (strict MiniMessage, custom tag resolvers, legacy RGB support, etc.), create dedicated instances and expose them through application-specific constants.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.kyori.adventure.text.serializer.gson.GsonComponentSerializer
    The standard Gson component serializer for modern Minecraft JSON chat components.
    static final net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
    The legacy serializer using the ampersand symbol (&).
    static final net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
    The legacy serializer using the section symbol (§).
    static final net.kyori.adventure.text.minimessage.MiniMessage
    The default MiniMessage serializer with the standard tag set.
    static final net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer
    The plain text serializer.
  • Method Summary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • GSON

      public static final net.kyori.adventure.text.serializer.gson.GsonComponentSerializer GSON
      The standard Gson component serializer for modern Minecraft JSON chat components.

      Prefer this serializer for persistence, configuration files, and databases where RGB colors and modern hover events are acceptable.

    • PLAIN

      public static final net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer PLAIN
      The plain text serializer. Useful for logging, clearing formatting, or extracting raw text.
    • LEGACY_SECTION

      public static final net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer LEGACY_SECTION
      The legacy serializer using the section symbol (§). Useful for legacy compatibility or displaying formatted text in old clients.
    • LEGACY_AMPERSAND

      public static final net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer LEGACY_AMPERSAND
      The legacy serializer using the ampersand symbol (&). Commonly used in configuration files and command outputs.
    • MINIMESSAGE

      public static final net.kyori.adventure.text.minimessage.MiniMessage MINIMESSAGE
      The default MiniMessage serializer with the standard tag set.