Interface LegacyComponentSerializer
- All Superinterfaces:
net.kyori.adventure.util.Buildable<LegacyComponentSerializer,LegacyComponentSerializer.Builder>,net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.TextComponent,String>
public interface LegacyComponentSerializer extends net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.TextComponent,String>, net.kyori.adventure.util.Buildable<LegacyComponentSerializer,LegacyComponentSerializer.Builder>
A legacy component serializer.
Legacy does not support more complex features such as, but not limited
to, ClickEvent and HoverEvent.
- Since:
- 4.0.0
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceLegacyComponentSerializer.BuilderA builder forLegacyComponentSerializer. -
Field Summary
Fields Modifier and Type Field Description static charAMPERSAND_CHARThe legacy character frequently used by configurations and commands.static charHEX_CHARThe legacy character used to prefix hex colors.static charSECTION_CHARThe legacy character used by Minecraft. -
Method Summary
Modifier and Type Method Description static @NonNull LegacyComponentSerializer.Builderbuilder()Creates a newLegacyComponentSerializer.Builder.@NonNull net.kyori.adventure.text.TextComponentdeserialize(@NonNull String input)Deserialize a component from a legacyString.static @NonNull LegacyComponentSerializerlegacy(char legacyCharacter)Gets a component serializer for legacy-based serialization and deserialization.static @NonNull LegacyComponentSerializerlegacyAmpersand()Gets a component serializer for legacy-based serialization and deserialization.static @NonNull LegacyComponentSerializerlegacySection()Gets a component serializer for legacy-based serialization and deserialization.static @Nullable LegacyFormatparseChar(char character)Converts a legacy character (0123456789abcdefklmnor) to a legacy format, when possible.@NonNull Stringserialize(@NonNull net.kyori.adventure.text.Component component)Serializes a component into a legacyString.Methods inherited from interface net.kyori.adventure.util.Buildable
toBuilder
-
Field Details
-
SECTION_CHAR
static final char SECTION_CHARThe legacy character used by Minecraft. ('ยง')- Since:
- 4.0.0
- See Also:
- Constant Field Values
-
AMPERSAND_CHAR
static final char AMPERSAND_CHARThe legacy character frequently used by configurations and commands. ('&')- Since:
- 4.0.0
- See Also:
- Constant Field Values
-
HEX_CHAR
static final char HEX_CHARThe legacy character used to prefix hex colors. ('#')- Since:
- 4.0.0
- See Also:
- Constant Field Values
-
-
Method Details
-
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, useLegacyComponentSerializer.Builder.extractUrls().The returned serializer uses the
sectioncharacter.- Returns:
- a component serializer for legacy serialization and deserialization
- Since:
- 4.0.0
-
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, useLegacyComponentSerializer.Builder.extractUrls().The returned serializer uses the
ampersandcharacter.- Returns:
- a component serializer for legacy serialization and deserialization
- Since:
- 4.0.0
-
legacy
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, useLegacyComponentSerializer.Builder.extractUrls().- Parameters:
legacyCharacter- the legacy character to use- Returns:
- a component serializer for legacy serialization and deserialization
- Since:
- 4.0.0
-
parseChar
Converts a legacy character (0123456789abcdefklmnor) to a legacy format, when possible.- Parameters:
character- the legacy character- Returns:
- the legacy format
- Since:
- 4.0.0
-
builder
Creates a newLegacyComponentSerializer.Builder.- Returns:
- the builder
- Since:
- 4.0.0
-
deserialize
Deserialize a component from a legacyString.- Specified by:
deserializein interfacenet.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.TextComponent,String>- Parameters:
input- the input- Returns:
- the component
-
serialize
Serializes a component into a legacyString.- Specified by:
serializein interfacenet.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.TextComponent,String>- Parameters:
component- the component- Returns:
- the string
-