Interface ComponentSerializer
public interface ComponentSerializer
Converts between components and the text forms the platform and protocol use.
-
Method Summary
Modifier and TypeMethodDescription@NonNull net.kyori.adventure.text.ComponentParses a component from the JSON form the protocol uses.@NonNull net.kyori.adventure.text.ComponentfromLegacy(@NonNull String string) Parses a component from text with legacy section-sign color codes.@NonNull net.kyori.adventure.text.ComponentParses a component from plain text.@NonNull net.kyori.adventure.text.ComponentfromStandard(@NonNull String string) Parses a component from MiniMessage text.@NonNull StringtoJson(@NonNull PlayerPreLoginEvent playerPreLoginEventWithKickReason) Serializes a refusal message into the JSON the login disconnect packet expects.@NonNull StringtoJson(@NonNull net.kyori.adventure.text.Component component) Serializes a component to the JSON form the protocol uses.@NonNull ObjecttoJsonTree(@NonNull net.kyori.adventure.text.Component component) Serializes a component to a JSON tree, for callers that go on to edit it.@NonNull StringtoLegacy(@NonNull net.kyori.adventure.text.Component component) Serializes a component to text with legacy section-sign color codes.@NonNull StringtoPlain(@NonNull net.kyori.adventure.text.Component component) Serializes a component to plain text with all formatting stripped.@NonNull StringtoStandard(@NonNull net.kyori.adventure.text.Component component) Serializes a component to MiniMessage text.
-
Method Details
-
toStandard
Serializes a component to MiniMessage text.- Parameters:
component- the component- Returns:
- the serialized text
-
toPlain
Serializes a component to plain text with all formatting stripped.- Parameters:
component- the component- Returns:
- the serialized text
-
toLegacy
Serializes a component to text with legacy section-sign color codes.- Parameters:
component- the component- Returns:
- the serialized text
-
toJson
Serializes a component to the JSON form the protocol uses.- Parameters:
component- the component- Returns:
- the serialized text
-
toJsonTree
Serializes a component to a JSON tree, for callers that go on to edit it.- Parameters:
component- the component- Returns:
- the JSON tree
-
toJson
Serializes a refusal message into the JSON the login disconnect packet expects.- Parameters:
playerPreLoginEventWithKickReason- the refused login- Returns:
- the JSON text
-
fromStandard
Parses a component from MiniMessage text.- Parameters:
string- the text- Returns:
- the component
-
fromPlain
Parses a component from plain text.- Parameters:
string- the text- Returns:
- the component
-
fromLegacy
Parses a component from text with legacy section-sign color codes.- Parameters:
string- the text- Returns:
- the component
-
fromJson
Parses a component from the JSON form the protocol uses.- Parameters:
string- the text- Returns:
- the component
-