Package co.crystaldev.alpinecore.util
Class Components
java.lang.Object
co.crystaldev.alpinecore.util.Components
Utility for interacting with Adventure
Component
objects.- Since:
- 0.1.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull net.kyori.adventure.text.Component
Add events to the given component.static @NotNull net.kyori.adventure.text.Component
events
(@NotNull net.kyori.adventure.text.Component component, @NotNull net.kyori.adventure.text.Component both) Add events to the given component.static @NotNull net.kyori.adventure.text.Component
events
(@NotNull net.kyori.adventure.text.Component component, @NotNull net.kyori.adventure.text.Component hover, @NotNull String command) Add events to the given component.static @NotNull net.kyori.adventure.text.Component
Joins a variable number of components together with no joiner.static @NotNull net.kyori.adventure.text.Component
join
(@NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with no joiner.static @NotNull net.kyori.adventure.text.Component
joinCommas
(@NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with a single comma as a joiner.static @NotNull net.kyori.adventure.text.Component
joinCommas
(@NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with a single comma as a joiner.static @NotNull net.kyori.adventure.text.Component
joinNewLines
(@NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with a single new line as a joiner.static @NotNull net.kyori.adventure.text.Component
joinNewLines
(@NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with a single new line as a joiner.static @NotNull net.kyori.adventure.text.Component
joinSpaces
(@NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with a single space as a joiner.static @NotNull net.kyori.adventure.text.Component
joinSpaces
(@NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with a single space as a joiner.static int
length
(@Nullable net.kyori.adventure.text.Component component) Get the length of the given component.static @NotNull List<net.kyori.adventure.text.format.StyleBuilderApplicable>
processStyle
(@NotNull String style) static @NotNull net.kyori.adventure.text.Component
reset()
Constructs a component that can be used to reset all existing styling.static @NotNull net.kyori.adventure.text.Component
Apply the given style to the given component.static @NotNull net.kyori.adventure.text.Component
stylize
(@Nullable String style, @NotNull net.kyori.adventure.text.Component component, boolean force) Apply the given style to the given component.
-
Constructor Details
-
Components
public Components()
-
-
Method Details
-
reset
@NotNull public static @NotNull net.kyori.adventure.text.Component reset()Constructs a component that can be used to reset all existing styling.- Returns:
- The reset component
-
length
public static int length(@Nullable @Nullable net.kyori.adventure.text.Component component) Get the length of the given component.- Parameters:
component
- The component.- Returns:
- The length.
-
join
@NotNull public static @NotNull net.kyori.adventure.text.Component join(@NotNull @NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with no joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
join
@NotNull public static @NotNull net.kyori.adventure.text.Component join(@NotNull @NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with no joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
joinSpaces
@NotNull public static @NotNull net.kyori.adventure.text.Component joinSpaces(@NotNull @NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with a single space as a joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
joinSpaces
@NotNull public static @NotNull net.kyori.adventure.text.Component joinSpaces(@NotNull @NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with a single space as a joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
joinCommas
@NotNull public static @NotNull net.kyori.adventure.text.Component joinCommas(@NotNull @NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with a single comma as a joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
joinCommas
@NotNull public static @NotNull net.kyori.adventure.text.Component joinCommas(@NotNull @NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with a single comma as a joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
joinNewLines
@NotNull public static @NotNull net.kyori.adventure.text.Component joinNewLines(@NotNull @NotNull net.kyori.adventure.text.Component... components) Joins a variable number of components together with a single new line as a joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
joinNewLines
@NotNull public static @NotNull net.kyori.adventure.text.Component joinNewLines(@NotNull @NotNull Iterable<net.kyori.adventure.text.Component> components) Joins a variable number of components together with a single new line as a joiner.- Parameters:
components
- The components to join- Returns:
- The joined component
-
events
@NotNull public static @NotNull net.kyori.adventure.text.Component events(@NotNull @NotNull net.kyori.adventure.text.Component component, @NotNull @NotNull net.kyori.adventure.text.Component hover, @NotNull @NotNull String command) Add events to the given component.- Parameters:
component
- The component to add hover and click events to.hover
- The text to display while hovering.command
- The command to execute when the component is clicked.- Returns:
- The component.
-
events
@NotNull public static @NotNull net.kyori.adventure.text.Component events(@NotNull @NotNull net.kyori.adventure.text.Component component, @NotNull @NotNull net.kyori.adventure.text.Component both) Add events to the given component.- Parameters:
component
- The component to add hover and click events to.both
- The text to display while hovering and command to execute when clicked.- Returns:
- The component.
-
events
@NotNull public static @NotNull net.kyori.adventure.text.Component events(@NotNull @NotNull net.kyori.adventure.text.Component component, @NotNull @NotNull String both) Add events to the given component.- Parameters:
component
- The component to add hover and click events to.both
- The text to display while hovering and command to execute when clicked.- Returns:
- The component.
-
stylize
@NotNull public static @NotNull net.kyori.adventure.text.Component stylize(@Nullable @Nullable String style, @NotNull @NotNull net.kyori.adventure.text.Component component, boolean force) Apply the given style to the given component.- Parameters:
style
- The style.component
- The component.- Returns:
- The stylized component.
-
stylize
@NotNull public static @NotNull net.kyori.adventure.text.Component stylize(@Nullable @Nullable String style, @NotNull @NotNull net.kyori.adventure.text.Component component) Apply the given style to the given component.- Parameters:
style
- The style.component
- The component.- Returns:
- The stylized component.
-
processStyle
-