Advertisement
Guest User

getLastColors

a guest
Mar 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. public static String getLastColors(String input){
  2.        
  3.         String result = "";
  4.         int length = input.length();
  5.        
  6.         for (int index = length - 1; index > -1; index--){
  7.            
  8.             char section = input.charAt(index);
  9.            
  10.             if ((section == 'ยง' || section == '&') && (index < length - 1)){
  11.                
  12.                 char c = input.charAt(index + 1);
  13.                 ChatColor color = ChatColor.getByChar(c);
  14.                
  15.                 if (color != null){
  16.                    
  17.                     result = color.toString() + result;
  18.                    
  19.                     if ((color.equals(ChatColor.RESET))){
  20.                         break;
  21.                    
  22.                     }
  23.                
  24.                 }
  25.            
  26.             }
  27.        
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement