Merge pull request #233 from speedxx/development

fix npe in /myinfo
This commit is contained in:
super 2020-07-18 19:58:09 -04:00 committed by GitHub
commit fc31babff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -591,14 +591,17 @@ public class FUtil
public static String colorize(String string) public static String colorize(String string)
{ {
Matcher matcher = Pattern.compile("&#[a-f0-9A-F]{6}").matcher(string); if (string != null)
while (matcher.find())
{ {
String code = matcher.group().replace("&", ""); Matcher matcher = Pattern.compile("&#[a-f0-9A-F]{6}").matcher(string);
string = string.replace("&" + code, net.md_5.bungee.api.ChatColor.of(code) + ""); while (matcher.find())
} {
String code = matcher.group().replace("&", "");
string = string.replace("&" + code, net.md_5.bungee.api.ChatColor.of(code) + "");
}
string = ChatColor.translateAlternateColorCodes('&', string); string = ChatColor.translateAlternateColorCodes('&', string);
}
return string; return string;
} }