1
0
mirror of https://e.coding.net/circlecloud/YumCore.git synced 2024-11-22 01:48:50 +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) { private static String getItemType(ItemStack i) {
String name = i.getType().name(); String name = i.getType().name();
String dura = ""; String dura = "";
if (i.getType() == Material.MONSTER_EGG) { try {
try { if (i.getType() == Material.MONSTER_EGG) {
name = ((SpawnEgg) i.getData()).getSpawnedType().name(); try {
} catch (NullPointerException npe) { name = ((SpawnEgg) i.getData()).getSpawnedType().name();
name = ((SpawnEggMeta) i.getItemMeta()).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) : "";
} }
int dur = i.getDurability();
dura = (i.getMaxStackSize() != 1 && dur != 0) ? Integer.toString(dur) : "";
return (name + (dura.isEmpty() ? "" : "-" + dura)).toUpperCase(); return (name + (dura.isEmpty() ? "" : "-" + dura)).toUpperCase();
} }