Trying to fix "Item not recognised" message

This commit is contained in:
Acrobot 2012-08-10 18:54:49 +02:00
parent a467e405c2
commit 92aeee4a86

View File

@ -63,14 +63,14 @@ public class MaterialUtil {
return material; return material;
} }
name = name.toUpperCase().replace(" ", "_"); name = name.replace(" ", "").toUpperCase();
short length = Short.MAX_VALUE; short length = Short.MAX_VALUE;
for (Material currentMaterial : Material.values()) { for (Material currentMaterial : Material.values()) {
String matName = currentMaterial.name(); String matName = currentMaterial.name();
if (matName.startsWith(name) && matName.length() < length) { if (matName.replace("_", "").startsWith(name) && matName.length() < length) {
length = (short) matName.length(); length = (short) matName.length();
material = currentMaterial; material = currentMaterial;
} }