Interface ComponentSerializer


public interface ComponentSerializer
Converts between components and the text forms the platform and protocol use.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull net.kyori.adventure.text.Component
    fromJson(String string)
    Parses a component from the JSON form the protocol uses.
    @NonNull net.kyori.adventure.text.Component
    fromLegacy(@NonNull String string)
    Parses a component from text with legacy section-sign color codes.
    @NonNull net.kyori.adventure.text.Component
    fromPlain(@NonNull String string)
    Parses a component from plain text.
    @NonNull net.kyori.adventure.text.Component
    fromStandard(@NonNull String string)
    Parses a component from MiniMessage text.
    @NonNull String
    toJson(@NonNull PlayerPreLoginEvent playerPreLoginEventWithKickReason)
    Serializes a refusal message into the JSON the login disconnect packet expects.
    @NonNull String
    toJson(@NonNull net.kyori.adventure.text.Component component)
    Serializes a component to the JSON form the protocol uses.
    @NonNull Object
    toJsonTree(@NonNull net.kyori.adventure.text.Component component)
    Serializes a component to a JSON tree, for callers that go on to edit it.
    @NonNull String
    toLegacy(@NonNull net.kyori.adventure.text.Component component)
    Serializes a component to text with legacy section-sign color codes.
    @NonNull String
    toPlain(@NonNull net.kyori.adventure.text.Component component)
    Serializes a component to plain text with all formatting stripped.
    @NonNull String
    toStandard(@NonNull net.kyori.adventure.text.Component component)
    Serializes a component to MiniMessage text.
  • Method Details

    • toStandard

      @NonNull String toStandard(@NonNull net.kyori.adventure.text.Component component)
      Serializes a component to MiniMessage text.
      Parameters:
      component - the component
      Returns:
      the serialized text
    • toPlain

      @NonNull String toPlain(@NonNull net.kyori.adventure.text.Component component)
      Serializes a component to plain text with all formatting stripped.
      Parameters:
      component - the component
      Returns:
      the serialized text
    • toLegacy

      @NonNull String toLegacy(@NonNull net.kyori.adventure.text.Component component)
      Serializes a component to text with legacy section-sign color codes.
      Parameters:
      component - the component
      Returns:
      the serialized text
    • toJson

      @NonNull String toJson(@NonNull net.kyori.adventure.text.Component component)
      Serializes a component to the JSON form the protocol uses.
      Parameters:
      component - the component
      Returns:
      the serialized text
    • toJsonTree

      @NonNull Object toJsonTree(@NonNull net.kyori.adventure.text.Component component)
      Serializes a component to a JSON tree, for callers that go on to edit it.
      Parameters:
      component - the component
      Returns:
      the JSON tree
    • toJson

      @NonNull String toJson(@NonNull PlayerPreLoginEvent playerPreLoginEventWithKickReason)
      Serializes a refusal message into the JSON the login disconnect packet expects.
      Parameters:
      playerPreLoginEventWithKickReason - the refused login
      Returns:
      the JSON text
    • fromStandard

      @NonNull net.kyori.adventure.text.Component fromStandard(@NonNull String string)
      Parses a component from MiniMessage text.
      Parameters:
      string - the text
      Returns:
      the component
    • fromPlain

      @NonNull net.kyori.adventure.text.Component fromPlain(@NonNull String string)
      Parses a component from plain text.
      Parameters:
      string - the text
      Returns:
      the component
    • fromLegacy

      @NonNull net.kyori.adventure.text.Component fromLegacy(@NonNull String string)
      Parses a component from text with legacy section-sign color codes.
      Parameters:
      string - the text
      Returns:
      the component
    • fromJson

      @NonNull net.kyori.adventure.text.Component fromJson(String string)
      Parses a component from the JSON form the protocol uses.
      Parameters:
      string - the text
      Returns:
      the component