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 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

      public static BungeeComponentSerializer get()
      Gets a component serializer.
      Returns:
      a component serializer
      Since:
      4.0.0
    • legacy

      public static BungeeComponentSerializer 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 component
      legacySerializer - 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 interface ComponentSerializer<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 interface ComponentSerializer<Component,Component,net.md_5.bungee.api.chat.BaseComponent[]>