Advertisement
Cool_boy21

encode

Apr 28th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. //inserts a formatting character between every character, making it invisible when displayed as lore
  2.     public static String encodeHiddenLore(String lore){
  3.         for(int i = 0; i < lore.length(); i+=2){
  4.             lore = lore.substring(0, i) + ChatColor.COLOR_CHAR + lore.substring(i, lore.length());
  5.         }
  6.         return lore;
  7.     }
  8.    
  9.     //removes the formatting characters
  10.     public static String decodeHiddenLore(String lore){
  11.         while(lore.contains(ChatColor.COLOR_CHAR + "")){
  12.             lore =lore.substring(0, lore.indexOf(ChatColor.COLOR_CHAR)) + lore.substring(lore.indexOf(ChatColor.COLOR_CHAR)+1, lore.length());
  13.         }
  14.         return lore;
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement