Class BungeeComponentSerializer
java.lang.Object
net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer
- All Implemented Interfaces:
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 Component
deserialize
(@NotNull net.md_5.bungee.api.chat.BaseComponent @NotNull [] input) static BungeeComponentSerializer
get()
Gets a component serializer.static boolean
inject
(com.google.gson.Gson existing) Inject Adventure's adapter serializer into an existing Gson instance.static boolean
isNative()
Gets whether the component serializer has native support.static BungeeComponentSerializer
legacy()
Gets a component serializer, with color downsampling.static BungeeComponentSerializer
of
(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, wait
Methods 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:
deserialize
in 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:
serialize
in interfaceComponentSerializer<Component,
Component, net.md_5.bungee.api.chat.BaseComponent[]>
-