Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

get all colors in string spigot

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;
}
Comment

PREVIOUS NEXT
Code Example
Java :: TestNG Data Provider example 
Java :: how to fetch email and get there body content in spring boot 
Java :: focus button java swing 
Java :: xml definition file for spring 
Java :: java 8 list of objects get only first occurance 
Java :: your application is missing a valid safety identifier 
Java :: array slicing 
Java :: how to get value from property file in spring xml file 
Java :: java gui lookandfeel flatlaf background color 
Java :: sorting boolean array with prime index 
Java :: Java Overloading by changing the number of parameters 
Java :: java windowbuilder launch on second monitor 
Java :: spigot give item 
Java :: what is minecraft default render distance 
Java :: witch dependency is needed for "ArraysUtils" for the Import? 
Java :: generate paranthesis 
Java :: torres de hanoi java 
Java :: Android equivalent of getElementById 
Java :: Second Activity not opening problem 
Java :: bukkit detect block that nowbal hit 
Java :: java ternärer operator 
Java :: Java double Keyword 
Java :: how to do 4th root java 
Java :: why is button hover not working in java netbeans 
Java :: java class creation inside method 
Java :: final variables in java 
Java :: Build path specifies execution environment JavaSE-1.8. There are no JREs installed in the workspace that are strictly compatible with this environment. 
Java :: java.lang.stringindexoutofboundsexception: string index out of range: 10 
Java :: Java find duplicate items 
Java :: java calling a method 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =