Return pretty dye color name if translation non-existent, fixes #1195

This commit is contained in:
PikaMug 2020-04-15 02:57:33 -04:00
parent 5aaa0dc49d
commit 6e5ebdba93

View File

@ -169,8 +169,23 @@ public class MiscUtil {
* @return cleaned-up string
*/
public static String getPrettyDyeColorName(DyeColor color) {
// Legacy
return Lang.get("COLOR_" + color.name());
if (!Lang.get("COLOR_" + color.name()).equals("NULL")) {
// Legacy
return Lang.get("COLOR_" + color.name());
} else {
String baseString = color.toString();
String[] substrings = baseString.split("_");
String prettyString = "";
int size = 1;
for (String s : substrings) {
prettyString = prettyString.concat(getCapitalized(s));
if (size < substrings.length) {
prettyString = prettyString.concat(" ");
}
size++;
}
return prettyString;
}
}
/**