Skip to content

Commit

Permalink
fix(Utils)
Browse files Browse the repository at this point in the history
Moved colorsStringListToColorList and colorsStringListToColorList from Utils to MinecraftUtils
  • Loading branch information
GeorgeV220 committed Apr 10, 2022
1 parent ea7ecff commit 6ef3d45
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
24 changes: 24 additions & 0 deletions src/main/java/com/georgev22/api/minecraft/MinecraftUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,30 @@ public static String stripColor(final String msg) {
return newColl;
}

/**
* Converts a String List that contains color codes to Color List
*
* @param list the String List that contains the color codes
* @return the new Color List with the colors of the input Color String List
*/
public static @NotNull List<Color> colorsStringListToColorList(@NotNull List<String> list) {
return colorsStringListToColorList(list.toArray(new String[0]));
}

/**
* Converts a String Array that contains color codes to Color List
*
* @param array the String Array that contains the color codes
* @return the new Color List with the colors of the input Color String Array
*/
public static @NotNull List<Color> colorsStringListToColorList(String @NotNull ... array) {
List<Color> colorList = Lists.newArrayList();
for (String str : array) {
colorList.add(Color.from(str));
}
return colorList;
}

public static @NotNull List<String> stripColor(final List<String> coll) {
Validate.notNull(coll, "The string collection can't be null!");
Validate.noNullElements(coll, "The string collection can't have null elements!");
Expand Down
25 changes: 0 additions & 25 deletions src/main/java/com/georgev22/api/utilities/Utils.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.georgev22.api.utilities;

import com.georgev22.api.maps.HashObjectMap;
import com.georgev22.api.minecraft.colors.Color;
import com.georgev22.api.maps.ObjectMap;
import com.georgev22.api.maps.TreeObjectMap;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -550,30 +549,6 @@ public static <T> T deserialize(@NotNull String string, @NotNull Type type) {
return map;
}

/**
* Converts a String List that contains color codes to Color List
*
* @param list the String List that contains the color codes
* @return the new Color List with the colors of the input Color String List
*/
public static @NotNull List<Color> colorsStringListToColorList(@NotNull List<String> list) {
return colorsStringListToColorList(list.toArray(new String[0]));
}

/**
* Converts a String Array that contains color codes to Color List
*
* @param array the String Array that contains the color codes
* @return the new Color List with the colors of the input Color String Array
*/
public static @NotNull List<Color> colorsStringListToColorList(String @NotNull ... array) {
List<Color> colorList = Lists.newArrayList();
for (String str : array) {
colorList.add(Color.from(str));
}
return colorList;
}

/**
* Generates a specific amount of random HEX colors
*
Expand Down

0 comments on commit 6ef3d45

Please sign in to comment.