Class AdventureSerializer
java.lang.Object
com.github.retrooper.packetevents.util.adventure.AdventureSerializer
- All Implemented Interfaces:
NbtDecoder<net.kyori.adventure.text.Component>
,NbtEncoder<net.kyori.adventure.text.Component>
@NullMarked
public final class AdventureSerializer
extends Object
implements NbtEncoder<net.kyori.adventure.text.Component>, NbtDecoder<net.kyori.adventure.text.Component>
-
Method Summary
Modifier and TypeMethodDescriptionasJson
(net.kyori.adventure.text.Component component) @Nullable com.google.gson.JsonElement
asJsonTree
(@Nullable net.kyori.adventure.text.Component component) asLegacy
(net.kyori.adventure.text.Component component) asNbtTag
(net.kyori.adventure.text.Component component) Deprecated.asNbtTag
(net.kyori.adventure.text.Component component, PacketWrapper<?> wrapper) static String
asVanilla
(net.kyori.adventure.text.Component component) Deprecated.net.kyori.adventure.text.Component
decode
(NBT nbt, PacketWrapper<?> wrapper) encode
(PacketWrapper<?> wrapper, net.kyori.adventure.text.Component value) net.kyori.adventure.text.Component
@Nullable net.kyori.adventure.text.Component
fromJsonTree
(@Nullable com.google.gson.JsonElement json) net.kyori.adventure.text.Component
fromLegacy
(String legacy) static net.kyori.adventure.text.Component
fromLegacyFormat
(String legacyMessage) Deprecated.usefromLegacy(String)
insteadstatic net.kyori.adventure.text.Component
Deprecated.usefromNbtTag(NBT, PacketWrapper)
insteadnet.kyori.adventure.text.Component
fromNbtTag
(NBT tag) Deprecated.net.kyori.adventure.text.Component
fromNbtTag
(NBT tag, PacketWrapper<?> wrapper) static net.kyori.adventure.text.serializer.gson.GsonComponentSerializer
Deprecated.usegson()
insteadstatic net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
Deprecated.uselegacy()
insteadstatic net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
Deprecated.uselegacy()
insteadstatic AdventureNBTSerializer
Deprecated.usenbt()
insteadnet.kyori.adventure.text.serializer.gson.GsonComponentSerializer
gson()
net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
legacy()
nbt()
static net.kyori.adventure.text.Component
parseComponent
(String json) Deprecated.usefromJson(String)
insteadstatic net.kyori.adventure.text.Component
parseJsonTree
(com.google.gson.JsonElement json) Deprecated.usefromJsonTree(JsonElement)
insteadstatic AdventureSerializer
Please useserializer(ClientVersion)
instead of this if possiblestatic AdventureSerializer
serializer
(ClientVersion version) static AdventureSerializer
serializer
(PacketWrapper<?> wrapper) static String
toJson
(net.kyori.adventure.text.Component component) Deprecated.useasJson(Component)
insteadstatic com.google.gson.JsonElement
toJsonTree
(net.kyori.adventure.text.Component component) Deprecated.useasJsonTree(Component)
insteadstatic String
toLegacyFormat
(net.kyori.adventure.text.Component component) Deprecated.useasLegacy(Component)
insteadstatic NBT
toNbt
(net.kyori.adventure.text.Component component) Deprecated.useasNbtTag(Component, PacketWrapper)
instead
-
Method Details
-
serializer
-
serializer
-
serializer
Please useserializer(ClientVersion)
instead of this if possible -
getGsonSerializer
@Deprecated public static net.kyori.adventure.text.serializer.gson.GsonComponentSerializer getGsonSerializer()Deprecated.usegson()
instead -
getLegacyGsonSerializer
@Deprecated public static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer getLegacyGsonSerializer()Deprecated.uselegacy()
instead -
getLegacySerializer
@Deprecated public static net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer getLegacySerializer()Deprecated.uselegacy()
instead -
getNBTSerializer
Deprecated.usenbt()
instead -
asVanilla
Deprecated.useasLegacy(Component)
instead -
fromLegacyFormat
Deprecated.usefromLegacy(String)
instead -
toLegacyFormat
Deprecated.useasLegacy(Component)
instead -
parseComponent
Deprecated.usefromJson(String)
instead -
parseJsonTree
@Deprecated public static net.kyori.adventure.text.Component parseJsonTree(com.google.gson.JsonElement json) Deprecated.usefromJsonTree(JsonElement)
instead -
toJson
Deprecated.useasJson(Component)
instead -
toJsonTree
@Deprecated public static com.google.gson.JsonElement toJsonTree(net.kyori.adventure.text.Component component) Deprecated.useasJsonTree(Component)
instead -
fromNbt
Deprecated.usefromNbtTag(NBT, PacketWrapper)
instead -
toNbt
Deprecated.useasNbtTag(Component, PacketWrapper)
instead -
fromLegacy
-
asLegacy
-
fromJson
-
asJson
-
fromJsonTree
@Contract("!null -> !null") @Nullable public @Nullable net.kyori.adventure.text.Component fromJsonTree(@Nullable @Nullable com.google.gson.JsonElement json) -
asJsonTree
@Contract("!null -> !null") @Nullable public @Nullable com.google.gson.JsonElement asJsonTree(@Nullable @Nullable net.kyori.adventure.text.Component component) -
fromNbtTag
Deprecated. -
fromNbtTag
-
asNbtTag
Deprecated. -
asNbtTag
-
gson
public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gson() -
legacy
public net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacy() -
nbt
-
decode
- Specified by:
decode
in interfaceNbtDecoder<net.kyori.adventure.text.Component>
-
encode
- Specified by:
encode
in interfaceNbtEncoder<net.kyori.adventure.text.Component>
-
asLegacy(Component)
instead