Skip to content

Commit

Permalink
chore: remove parse method for List type
Browse files Browse the repository at this point in the history
  • Loading branch information
aivruu committed Jan 30, 2024
1 parent 8391327 commit 2f9feb0
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions plugin/src/main/java/com/aivruu/homes/utils/ComponentUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

/**
* Utility class to parse {@link String} to {@link Component} usable by Paper API.
* Utility class to parse {@link String}
* to {@link Component} objects by the Paper API.
*
* @since 0.0.1
*/
public class ComponentUtils {
/**
* Used to perform deserialization from {@link String} to {@link Component} objects using their format system.
* Used to perform deserialization from string
* to component using MiniMessage deserialization.
*
* @since 0.0.1
*/
Expand All @@ -25,27 +24,12 @@ public class ComponentUtils {
* Converts the object given to {@link Component} using {@link MiniMessage} format system.
*
* @param text needed to perform deserialization to {@link Component}.
* @param resolvers {@link TagResolver} array used for replacement for the current {@link Component}.
* @param resolvers {@link TagResolver} array used for
* tags replacement in the current component.
* @return A {@link Component}.
* @since 0.0.1
*/
public static @NotNull Component parse(final @NotNull String text, final TagResolver @NotNull... resolvers) {
return MINI_MESSAGE.deserialize(text, resolvers);
}

/**
* Converts all the elements in the {@link List} to {@link Component}.
*
* @param text list needed to perform deserialization to {@link Component}.
* @param resolvers {@link TagResolver} array used for replacement in a {@link Component}.
* @return A {@link List} of {@link Component}.
* @since 0.0.1
*/
public static @NotNull List<@NotNull Component> parse(final @NotNull List<@NotNull String> text, final TagResolver @NotNull... resolvers) {
final List<Component> parsedComponentsList = new ArrayList<>();
for (final var iterated : text) {
parsedComponentsList.add(MINI_MESSAGE.deserialize(iterated, resolvers));
}
return parsedComponentsList;
}
}

0 comments on commit 2f9feb0

Please sign in to comment.