Skip to content

Commit f2cba19

Browse files
committed
Trim material names before matching
Also give more details when the match fails.
1 parent 84293a4 commit f2cba19

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/in/twizmwaz/cardinal/util/MaterialPattern.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ public static MaterialPattern getSingleMaterialPattern(@NonNull String in) {
8989
MaterialPattern pattern = new MaterialPattern();
9090
if (in.contains(":")) {
9191
String[] parts = in.split(":");
92-
Material type = Material.matchMaterial(parts[0]);
92+
Material type = Material.matchMaterial(parts[0].trim());
9393
if (type == null) {
94-
throw new IllegalArgumentException();
94+
throw new IllegalArgumentException("\"" + parts[0].trim() + "\"" + " cannot be mapped to a material");
9595
}
9696
pattern.add(type, Numbers.parseInteger(parts[1]));
9797
} else {
98-
Material type = Material.matchMaterial(in);
98+
Material type = Material.matchMaterial(in.trim());
9999
if (type == null) {
100-
throw new IllegalArgumentException();
100+
throw new IllegalArgumentException("\"" + in.trim() + "\"" + " cannot be mapped to a material");
101101
}
102102
pattern.add(type, ANY_DATA_VALUE);
103103
}

0 commit comments

Comments
 (0)