Danger

The Adventure docs are currently a work in progress and supplement the Javadocs. Some areas may have limited coverage or may not be entirely up to date. Feel free to join our Discord if you have any questions.

Plain#

The plain text serializer converts chat components to their plain-text representation and back. It is thus the simplest text serializer in Adventure. This serializer is useful for supporting legacy clients, logging, clearing formatting from a component that originates from external source, and provides a small, self-contained example of a text serializer.

The plain text serializer, by its nature, does not support any advanced features, including color, hover and click events, URL linking, or insertions. If advanced features are desired, consider using MiniMessage.

Declaring the dependency:

 <dependency>
    <groupId>net.kyori</groupId>
    <artifactId>adventure-text-serializer-plain</artifactId>
    <version>4.11.0</version>
 </dependency>
 repositories {
    mavenCentral()
 }

 dependencies {
    implementation "net.kyori:adventure-text-serializer-plain:4.11.0"
 }
 repositories {
    mavenCentral()
 }

 dependencies {
    implementation("net.kyori:adventure-text-serializer-plain:4.11.0")
 }

Need development/snapshot builds? Using Snapshot Builds

Usage#

The plain serializer is accessed using the PlainTextComponentSerializer. You can use PlainTextComponentSerializer.plainText() for a default instance that silently ignores keybind and translatable components, or construct your own PlainTextComponentSerializer that maps the components to some plain-text representation.

The deserialization of plain text is equivalent to Component.text(string). No preprocessing is done on the input. The deserialization is implemented in order to provide API consistency.