1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-24 02:08:48 +00:00

fix: 1.13+ Material Error

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-04-10 00:56:39 +08:00
parent c7867ed835
commit d438c9a5f1

View File

@ -104,16 +104,18 @@ public class L10N {
private static String getItemType(ItemStack i) {
String name = i.getType().name();
String dura = "";
try {
if (i.getType() == Material.MONSTER_EGG) {
try {
name = ((SpawnEgg) i.getData()).getSpawnedType().name();
} catch (NullPointerException npe) {
name = ((SpawnEggMeta) i.getItemMeta()).getSpawnedType().name();
}
} else {
}
} catch (Throwable ignored) {
}
int dur = i.getDurability();
dura = (i.getMaxStackSize() != 1 && dur != 0) ? Integer.toString(dur) : "";
}
return (name + (dura.isEmpty() ? "" : "-" + dura)).toUpperCase();
}