The Adventure docs are currently a work in progress. Some areas may have limited coverage or may not be entirely up to date. Feel free to join our discord at https://discord.gg/MMfhJ8F if you have any questions.
Migrating from text 3.x¶
Adventure is an evolution of the text 3.x API. If you’ve worked with
the text API before, the switch to Adventure should be relatively quick.
For the most part, you’ll just need to depend on the Adventure API
and the relevant Platforms you support and replace references
to classes in
next.kyori.adventure.text, though see
below for major breaking changes.
A word of caution¶
However, before you continue, it is strongly recommended you read about Audiences. Unlike text, Adventure defines a standard interface for sending content (including chat messages) to viewers. In addition, Adventure defines interfaces for other gameplay mechanics that can be arbitrarily sent to players.
Breaking changes from text 3.x¶
Factory methods renamed¶
In text 3.x, components could be constructed using the
In Adventure, we’ve changed to using
Component.<type>(/*...*/) style methods to allow
for easier static imports.
Style.of(/*...*/) is changed to
Builders are now created by calling the aforementioned factory methods with no parameters.
Note that the equivalent of
.append() with a String argument¶
Component builders in 3.x had a shorthand for appending a new text component:
In Adventure you have to write it in full,
builder.append(Component.text("wow")) in this case.
In text 3.x, you would deserialize a component that used a color code prefix that
differed from the section symbol normally used by using
In Adventure, the API to use is
To make a linking serializer you have to use the builder.
TextColor renamed to
In order to accomodate the new RGB colors introduced in 1.16, all the named text colors
were moved to the
NamedTextColor class. References to the old
should be updated to refer to
If you have a need to interoperate with clients using the old text 3.x API, you
can use the
adventure-text-serializer-legacy-text3 artifact, which includes a
LegacyText3ComponentSerializer that can convert from Adventure to text 3.x
components and back. Note that RGB colors will be downsampled.