Class MinecraftComponentSerializer

  • All Implemented Interfaces:
    net.kyori.adventure.text.serializer.ComponentDecoder<java.lang.Object,​net.kyori.adventure.text.Component>, net.kyori.adventure.text.serializer.ComponentEncoder<net.kyori.adventure.text.Component,​java.lang.Object>, net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.Component,​java.lang.Object>

    @Experimental
    public final class MinecraftComponentSerializer
    extends java.lang.Object
    implements net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.Component,​java.lang.Object>
    A component serializer for net.minecraft.server.<version>.IChatBaseComponent.

    Due to Bukkit version namespaces, the return type does not reflect the actual type.

    Color downsampling will be performed as necessary for the running server version.

    If not isSupported(), an UnsupportedOperationException will be thrown on any serialize or deserialize operations.

    Since:
    4.0.0
    See Also:
    get()
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull net.kyori.adventure.text.Component deserialize​(@NotNull java.lang.Object input)  
      static @NotNull MinecraftComponentSerializer get()
      Gets the component serializer.
      static boolean isSupported()
      Gets whether this serializer is supported.
      @NotNull java.lang.Object serialize​(@NotNull net.kyori.adventure.text.Component component)  
      • 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
    • Constructor Detail

      • MinecraftComponentSerializer

        public MinecraftComponentSerializer()
    • Method Detail

      • isSupported

        public static boolean isSupported()
        Gets whether this serializer is supported.
        Returns:
        if the serializer is supported.
        Since:
        4.0.0
      • get

        @NotNull
        public static @NotNull MinecraftComponentSerializer get()
        Gets the component serializer.
        Returns:
        a component serializer
        Since:
        4.0.0
      • deserialize

        @NotNull
        public @NotNull net.kyori.adventure.text.Component deserialize​(@NotNull
                                                                       @NotNull java.lang.Object input)
        Specified by:
        deserialize in interface net.kyori.adventure.text.serializer.ComponentDecoder<java.lang.Object,​net.kyori.adventure.text.Component>
        Specified by:
        deserialize in interface net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.Component,​java.lang.Object>
      • serialize

        @NotNull
        public @NotNull java.lang.Object serialize​(@NotNull
                                                   @NotNull net.kyori.adventure.text.Component component)
        Specified by:
        serialize in interface net.kyori.adventure.text.serializer.ComponentEncoder<net.kyori.adventure.text.Component,​java.lang.Object>
        Specified by:
        serialize in interface net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,​net.kyori.adventure.text.Component,​java.lang.Object>