Interface LegacyComponentSerializer

    • Field Detail

      • SECTION_CHAR

        static final char SECTION_CHAR
        The legacy character used by Minecraft. ('ยง')
        Since:
        4.0.0
        See Also:
        Constant Field Values
      • AMPERSAND_CHAR

        static final char AMPERSAND_CHAR
        The legacy character frequently used by configurations and commands. ('&')
        Since:
        4.0.0
        See Also:
        Constant Field Values
      • HEX_CHAR

        static final char HEX_CHAR
        The legacy character used to prefix hex colors. ('#')
        Since:
        4.0.0
        See Also:
        Constant Field Values
    • Method Detail

      • legacySection

        @NotNull
        static @NotNull LegacyComponentSerializer legacySection()
        Gets a component serializer for legacy-based serialization and deserialization. Note that this serializer works exactly like vanilla Minecraft and does not detect any links. If you want to detect and make URLs clickable, use LegacyComponentSerializer.Builder.extractUrls().

        The returned serializer uses the section character.

        Returns:
        a component serializer for legacy serialization and deserialization
        Since:
        4.0.0
      • legacyAmpersand

        @NotNull
        static @NotNull LegacyComponentSerializer legacyAmpersand()
        Gets a component serializer for legacy-based serialization and deserialization. Note that this serializer works exactly like vanilla Minecraft and does not detect any links. If you want to detect and make URLs clickable, use LegacyComponentSerializer.Builder.extractUrls().

        The returned serializer uses the ampersand character.

        Returns:
        a component serializer for legacy serialization and deserialization
        Since:
        4.0.0
      • legacy

        @NotNull
        static @NotNull LegacyComponentSerializer legacy​(char legacyCharacter)
        Gets a component serializer for legacy-based serialization and deserialization. Note that this serializer works exactly like vanilla Minecraft and does not detect any links. If you want to detect and make URLs clickable, use LegacyComponentSerializer.Builder.extractUrls().
        Parameters:
        legacyCharacter - the legacy character to use
        Returns:
        a component serializer for legacy serialization and deserialization
        Since:
        4.0.0
      • parseChar

        @Nullable
        static @Nullable LegacyFormat parseChar​(char character)
        Converts a legacy character (0123456789abcdefklmnor) to a legacy format, when possible.
        Parameters:
        character - the legacy character
        Returns:
        the legacy format
        Since:
        4.0.0
      • serialize

        @NotNull
        @NotNull java.lang.String serialize​(@NotNull
                                            @NotNull Component component)
        Serializes a component into a legacy String.
        Specified by:
        serialize in interface ComponentSerializer<Component,​TextComponent,​java.lang.String>
        Parameters:
        component - the component
        Returns:
        the string