mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-30 04:37:42 +01:00
Allow underscores in icons.
This commit is contained in:
parent
5f783684f4
commit
45f9c2248f
@ -54,7 +54,7 @@ public class CommandValidator {
|
||||
@SuppressWarnings("deprecation")
|
||||
public static ItemStack matchItemStack(String input) throws CommandException {
|
||||
|
||||
input = input.replace(" ", ""); // Cut the spaces
|
||||
input = input.replace(" ", ""); // Remove the spaces
|
||||
|
||||
int dataValue = 0;
|
||||
if (input.contains(":")) {
|
||||
|
@ -43,17 +43,20 @@ public class ItemUtils {
|
||||
|
||||
// A map with formatter materials (lowercase and without dashes) for fast access.
|
||||
private static Map<String, Material> materialMap = new HashMap<String, Material>();
|
||||
private static Pattern stripSymbolsPattern = Pattern.compile("_- ");
|
||||
private static Pattern stripSymbolsPattern = Pattern.compile("[_ \\-]+");
|
||||
|
||||
static {
|
||||
for (Material mat : Material.values()) {
|
||||
materialMap.put(mat.toString().toLowerCase().replace("_", ""), mat);
|
||||
materialMap.put(stripSpacingChars(mat.toString()).toLowerCase(), mat);
|
||||
}
|
||||
}
|
||||
|
||||
public static String stripSpacingChars(String input) {
|
||||
return stripSymbolsPattern.matcher(input).replaceAll("");
|
||||
}
|
||||
|
||||
public static Material matchMaterial(String input) {
|
||||
return materialMap.get(stripSymbolsPattern.matcher(input.toLowerCase()).replaceAll(""));
|
||||
return materialMap.get(stripSpacingChars(input).toLowerCase());
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
Loading…
Reference in New Issue
Block a user