Class BungeeComponentSerializer
java.lang.Object
net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer
- All Implemented Interfaces:
ComponentDecoder<net.md_5.bungee.api.chat.BaseComponent[],,Component> ComponentEncoder<Component,,net.md_5.bungee.api.chat.BaseComponent[]> ComponentSerializer<Component,Component, net.md_5.bungee.api.chat.BaseComponent[]>
public final class BungeeComponentSerializer
extends Object
implements ComponentSerializer<Component,Component,net.md_5.bungee.api.chat.BaseComponent[]>
A component serializer for BungeeCord's
BaseComponent.- Since:
- 4.0.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull Componentdeserialize(@NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull [] input) static BungeeComponentSerializerget()Gets a component serializer.static booleaninject(com.google.gson.Gson existing) Inject Adventure's adapter serializer into an existing Gson instance.static booleanisNative()Gets whether the component serializer has native support.static BungeeComponentSerializerlegacy()Gets a component serializer, with color downsampling.static BungeeComponentSerializerof(GsonComponentSerializer serializer, LegacyComponentSerializer legacySerializer) Create a component serializer with custom serialization properties.@NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull []Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.kyori.adventure.text.serializer.ComponentSerializer
deseializeOrNull, deserializeOr, deserializeOrNull, serializeOr, serializeOrNull
-
Method Details
-
isNative
public static boolean isNative()Gets whether the component serializer has native support.Even if this is
false, the serializer will still work.- Returns:
- if there is native support
- Since:
- 4.0.0
-
get
Gets a component serializer.- Returns:
- a component serializer
- Since:
- 4.0.0
-
legacy
Gets a component serializer, with color downsampling.- Returns:
- a component serializer
- Since:
- 4.0.0
-
of
public static BungeeComponentSerializer of(GsonComponentSerializer serializer, LegacyComponentSerializer legacySerializer) Create a component serializer with custom serialization properties.- Parameters:
serializer- The serializer creating a JSON representation of the componentlegacySerializer- The serializer creating a representation of the component with legacy formatting codes- Returns:
- a new serializer
- Since:
- 4.0.0
-
inject
public static boolean inject(com.google.gson.Gson existing) Inject Adventure's adapter serializer into an existing Gson instance.This is primarily for internal use, but may be useful if interfacing with existing libraries that maintain their own Gson instances.
- Parameters:
existing- gson instance- Returns:
- true if injection was successful
- Since:
- 4.0.0
-
deserialize
@NotNull public @NotNull Component deserialize(@NotNull @NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull [] input) - Specified by:
deserializein interfaceComponentDecoder<net.md_5.bungee.api.chat.BaseComponent[],Component> - Specified by:
deserializein interfaceComponentSerializer<Component,Component, net.md_5.bungee.api.chat.BaseComponent[]>
-
serialize
@NotNull public @NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull [] serialize(@NotNull @NotNull Component component) - Specified by:
serializein interfaceComponentEncoder<Component,net.md_5.bungee.api.chat.BaseComponent[]> - Specified by:
serializein interfaceComponentSerializer<Component,Component, net.md_5.bungee.api.chat.BaseComponent[]>
-