Add values() to KColors
This commit is contained in:
@@ -3,6 +3,13 @@ package net.axay.kspigot.chat;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class KColors {
|
||||
public static final TextDecoration MAGIC = TextDecoration.OBFUSCATED;
|
||||
@@ -731,4 +738,15 @@ public class KColors {
|
||||
* <div style="width:120px;height:120px;background-color:#9ACD32"></div>
|
||||
*/
|
||||
public static final TextColor YELLOWGREEN = TextColor.color(154, 205, 50);
|
||||
|
||||
public static List<TextColor> values() {
|
||||
Field[] fields = KColors.class.getFields();
|
||||
List<TextColor> finalList = new ArrayList<>(); //yes this could be done with a simple Arrays.stream but didn't work because java is stupid (because of the exception)
|
||||
for (Field field : fields) {
|
||||
try {
|
||||
finalList.add((TextColor) field.get(null));
|
||||
} catch (IllegalAccessException ignored) {}
|
||||
}
|
||||
return finalList;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user