diff --git a/src/main/java/net/axay/kspigot/chat/KColors.java b/src/main/java/net/axay/kspigot/chat/KColors.java index 6112961f..2710ea03 100644 --- a/src/main/java/net/axay/kspigot/chat/KColors.java +++ b/src/main/java/net/axay/kspigot/chat/KColors.java @@ -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 { *
*/ public static final TextColor YELLOWGREEN = TextColor.color(154, 205, 50); + + public static List values() { + Field[] fields = KColors.class.getFields(); + List 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; + } }