Interface VersionedComponent
public interface VersionedComponent
A multi-version wrapper that supports Kyori Adventure Components and the MiniMessage format.
This wrapper facilitates sending this wrapped component despite server version differences. (See
On older servers, it likely sends via BaseComponents, while on newer servers it can use the native adventure api.
This wrapper attempts to use the native adventure api on newer servers, but falls back to using an internal shaded copy of adventure if the server does not support it natively.
This wrapper facilitates sending this wrapped component despite server version differences. (See
sendTo(CommandSender))On older servers, it likely sends via BaseComponents, while on newer servers it can use the native adventure api.
This wrapper attempts to use the native adventure api on newer servers, but falls back to using an internal shaded copy of adventure if the server does not support it natively.
-
Method Summary
Modifier and TypeMethodDescription@NotNull VersionedComponentappend(@NotNull VersionedComponent other) Appends another VersionedComponent to this one, returning a new instance.
The original instances are not modified.@NotNull com.kamikazejam.kamicommon.nms.text.kyori.adventure.text.ComponentFetches (or Creates) an instance of the internal adventureComponent
Advanced users may use this in order to interact with advanced Adventure component APIs that are shaded.@NotNull InventorycreateInventory(@NotNull InventoryHolder owner, int size) Create a new menu with the current message as the title, other arguments are passed as normal.@NotNull InventorycreateInventory(@NotNull InventoryHolder owner, @NotNull InventoryType type) Create a new menu with the current message as the title, other arguments are passed as normal.default @NotNull StringDeprecated.default voidsendTo(@NotNull Collection<CommandSender> senders) Sends the current message component to multiple senders.voidsendTo(@NotNull CommandSender sender) Sends the current message component to a sender.default voidsendTo(@NotNull CommandSender... senders) Sends the current message component to multiple senders.@NotNull StringSerializes the current message component to a string formatted using legacy ampersand (&) color codes.@NotNull StringSerializes the current message component to a string formatted using legacy section (§) color codes.@NotNull StringSerializes the current message component to a MiniMessage string.@NotNull StringSerializes the current message component to a plain text string using the PlainTextComponentSerializer on the current platform.
-
Method Details
-
sendTo
Sends the current message component to a sender. -
serializeMiniMessage
Serializes the current message component to a MiniMessage string. -
serializePlainText
Serializes the current message component to a plain text string using the PlainTextComponentSerializer on the current platform. -
serializeLegacyAmpersand
Serializes the current message component to a string formatted using legacy ampersand (&) color codes. -
serializeLegacySection
Serializes the current message component to a string formatted using legacy section (§) color codes. -
plainText
Deprecated.Replace withserializePlainText().Serializes the current message component to a plain text string using the PlainTextComponentSerializer on the current platform. -
createInventory
Create a new menu with the current message as the title, other arguments are passed as normal.- Parameters:
owner- The inventory holder for this inventory. (inherited from Bukkit.createInventory)size- The size of the inventory. (inherited from Bukkit.createInventory)
-
createInventory
@NotNull @NotNull Inventory createInventory(@NotNull @NotNull InventoryHolder owner, @NotNull @NotNull InventoryType type) Create a new menu with the current message as the title, other arguments are passed as normal.- Parameters:
owner- The inventory holder for this inventory. (inherited from Bukkit.createInventory)type- The type of the inventory. (inherited from Bukkit.createInventory)
-
asInternalComponent
@NotNull @NotNull com.kamikazejam.kamicommon.nms.text.kyori.adventure.text.Component asInternalComponent()Fetches (or Creates) an instance of the internal adventureComponent
Advanced users may use this in order to interact with advanced Adventure component APIs that are shaded. -
append
Appends another VersionedComponent to this one, returning a new instance.
The original instances are not modified. -
sendTo
Sends the current message component to multiple senders. -
sendTo
Sends the current message component to multiple senders.
-
serializePlainText().