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 = "";
try {
if (i.getType() == Material.MONSTER_EGG) { if (i.getType() == Material.MONSTER_EGG) {
try { try {
name = ((SpawnEgg) i.getData()).getSpawnedType().name(); name = ((SpawnEgg) i.getData()).getSpawnedType().name();
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
name = ((SpawnEggMeta) i.getItemMeta()).getSpawnedType().name(); name = ((SpawnEggMeta) i.getItemMeta()).getSpawnedType().name();
} }
} else { }
} catch (Throwable ignored) {
}
int dur = i.getDurability(); int dur = i.getDurability();
dura = (i.getMaxStackSize() != 1 && dur != 0) ? Integer.toString(dur) : ""; dura = (i.getMaxStackSize() != 1 && dur != 0) ? Integer.toString(dur) : "";
}
return (name + (dura.isEmpty() ? "" : "-" + dura)).toUpperCase(); return (name + (dura.isEmpty() ? "" : "-" + dura)).toUpperCase();
} }