Class PlainComponentSerializer

java.lang.Object
net.kyori.adventure.text.serializer.plain.PlainComponentSerializer
All Implemented Interfaces:
net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.TextComponent,​String>

public class PlainComponentSerializer
extends Object
implements net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.TextComponent,​String>
A plain component serializer.

Plain does not support more complex features such as, but not limited to, colours, decorations, ClickEvent, and HoverEvent.

Since:
4.0.0
  • Constructor Details

    • PlainComponentSerializer

      public PlainComponentSerializer()
      Constructs.
      Since:
      4.0.0
    • PlainComponentSerializer

      public PlainComponentSerializer​(@Nullable Function<net.kyori.adventure.text.KeybindComponent,​String> keybind, @Nullable Function<net.kyori.adventure.text.TranslatableComponent,​String> translatable)
      Constructs.
      Parameters:
      keybind - the keybind renderer
      translatable - the translatable renderer
      Since:
      4.0.0
  • Method Details

    • plain

      public static @NonNull PlainComponentSerializer plain()
      A component serializer for plain-based serialization and deserialization.
      Returns:
      serializer instance
      Since:
      4.0.0
    • deserialize

      public @NonNull net.kyori.adventure.text.TextComponent deserialize​(@NonNull String input)
      Specified by:
      deserialize in interface net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.TextComponent,​String>
    • serialize

      public @NonNull String serialize​(@NonNull net.kyori.adventure.text.Component component)
      Specified by:
      serialize in interface net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.TextComponent,​String>
    • serialize

      public void serialize​(@NonNull StringBuilder sb, @NonNull net.kyori.adventure.text.Component component)
      Serializes.
      Parameters:
      sb - the string builder
      component - the component
      Since:
      4.0.0