📅  最后修改于: 2022-03-11 14:52:12.692000             🧑  作者: Mango
public static List getColors(String string) {
List list = new ArrayList();
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;
}