1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-21 06:42:29 +01:00

Correct way to recognize material

This commit is contained in:
Zrips 2020-07-07 13:49:40 +03:00
parent 0a21c1308c
commit e630aee35c

View File

@ -1364,11 +1364,13 @@ public enum CMIMaterial {
return CMIMaterial.NONE;
Integer data = null;
Integer ids = null;
id = id.replaceAll("_| |minecraft:", "").toLowerCase();
if (id.contains(":")) {
try {
Integer ids = Integer.parseInt(id.split(":")[0]);
ids = Integer.parseInt(id.split(":")[0]);
data = Integer.parseInt(id.split(":")[1]);
if (ids <= 0)
return CMIMaterial.NONE;
@ -1392,15 +1394,10 @@ public enum CMIMaterial {
}
} catch (Exception ex) {
}
String metaTag = id.split(":")[1];
CMIMaterial mat = ItemManager.byName.get(id + ":" + metaTag);
if (mat != null) {
return mat;
}
}
CMIMaterial mat = ItemManager.byName.get(id);
if (mat != null) {
return mat;
}