Better validate static ChatColor methods

This commit is contained in:
Parker Hawke 2019-05-03 15:51:10 -04:00
parent 4e74934cd0
commit c28920643d

View file

@ -214,6 +214,8 @@ public enum ChatColor {
*/
@NotNull
public static String translateAlternateColorCodes(char altColorChar, @NotNull String textToTranslate) {
Validate.notNull(textToTranslate, "Cannot translate null text");
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i+1]) > -1) {
@ -232,6 +234,8 @@ public enum ChatColor {
*/
@NotNull
public static String getLastColors(@NotNull String input) {
Validate.notNull(input, "Cannot get last colors from null text");
String result = "";
int length = input.length();