Last active
December 23, 2017 20:21
-
-
Save wyatt-herkamp/65b79aeb225db38a534c13067182857f to your computer and use it in GitHub Desktop.
KingTuxUtils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bukkit.ChatColor; | |
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* @author KingTux | |
* Basic Utils for Bukkit and Java | |
*/ | |
public class KingTuxUtils { | |
/** | |
* @param oldList | |
* @return List with Color codes added! | |
* | |
*/ | |
public static List<String> color(List<String> oldList){ | |
List<String> newString = new ArrayList<>(); | |
for(String s : oldList){ | |
newString.add(ChatColor.translateAlternateColorCodes('&', s)); | |
} | |
return newString; | |
} | |
/** | |
* | |
* @param oldString | |
* @return new String with colors! | |
*/ | |
public static String color(String oldString){ | |
String newString = ChatColor.translateAlternateColorCodes('&', oldString); | |
return newString; | |
} | |
/** | |
* | |
* @param oldList | |
* @param oldString | |
* @param newString | |
* @return List with the String replaced out of it! | |
*/ | |
public static List<String> replaceList(List<String> oldList, String oldString, String newString){ | |
List<String> newList = new ArrayList<>(); | |
if(oldList == null){ | |
return newList; | |
} | |
for(String s : oldList){ | |
newList.add(s.replace(oldString, newString)); | |
} | |
return newList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment