Add check to fix NONE team color causing an NPE (#1602)

This commit is contained in:
rtm516 2020-11-28 15:10:19 +00:00 committed by GitHub
parent 0215c383b0
commit eb687e6638
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -234,6 +234,10 @@ public class MessageTranslator {
* @return The chat color character * @return The chat color character
*/ */
public static String toChatColor(TeamColor teamColor) { public static String toChatColor(TeamColor teamColor) {
if (teamColor.equals(TeamColor.NONE)) {
return "";
}
NamedTextColor textColor = NamedTextColor.NAMES.value(teamColor.name().toLowerCase()); NamedTextColor textColor = NamedTextColor.NAMES.value(teamColor.name().toLowerCase());
if (textColor != null) { if (textColor != null) {
return getColor(textColor); return getColor(textColor);