Holen Sie sich alle Farben in String -Zapfen

public static List<ChatColor> getColors(String string) {

        List<ChatColor> list = new ArrayList<ChatColor>();
        String colorCoded =  string.replace(ChatColor.COLOR_CHAR, '&');

        for(int i = 0 ; i < colorCoded.length() ; i++) {
            char c = colorCoded.charAt(i);
            if(c =='&') {
                char id = colorCoded.charAt(i+1);
                list.add(ChatColor.getByChar(id));
            }
        }
        return list;
}
Nervous Narwhal