Improve material name
This commit is contained in:
parent
71db0c0c71
commit
1d9acfb031
@ -421,16 +421,27 @@ public class Txt
|
||||
// -------------------------------------------- //
|
||||
|
||||
protected static Pattern PATTERN_ENUM_SPLIT = Pattern.compile("[\\s_]+");
|
||||
public static String getNicedEnumString(String str)
|
||||
public static String getNicedEnumString(String str, String glue)
|
||||
{
|
||||
List<String> parts = new ArrayList<>();
|
||||
for (String part : PATTERN_ENUM_SPLIT.split(str.toLowerCase()))
|
||||
{
|
||||
parts.add(upperCaseFirst(part));
|
||||
}
|
||||
return implode(parts, "");
|
||||
return implode(parts, glue);
|
||||
}
|
||||
|
||||
public static String getNicedEnumString(String str)
|
||||
{
|
||||
return getNicedEnumString(str, "");
|
||||
}
|
||||
|
||||
public static <T extends Enum<T>> String getNicedEnum(T enumObject, String glue)
|
||||
{
|
||||
return getNicedEnumString(enumObject.name(), glue);
|
||||
}
|
||||
|
||||
|
||||
public static <T extends Enum<T>> String getNicedEnum(T enumObject)
|
||||
{
|
||||
return getNicedEnumString(enumObject.name());
|
||||
@ -438,7 +449,7 @@ public class Txt
|
||||
|
||||
public static String getMaterialName(Material material)
|
||||
{
|
||||
return getNicedEnum(material);
|
||||
return getNicedEnum(material, " ");
|
||||
}
|
||||
|
||||
public static String getItemName(ItemStack itemStack)
|
||||
|
Loading…
Reference in New Issue
Block a user