mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-24 17:12:03 +01:00
Fix creating and using kits on legacy versions (#2428)
* Attempt to look up legacy items in Material enum * Use name method when serializing ItemStacks * Make name uppercase before looking up in Material enum
This commit is contained in:
parent
aca83bd462
commit
9e73c29b40
@ -64,7 +64,7 @@ public abstract class AbstractItemDb implements IConf, net.ess3.api.IItemDb {
|
||||
|
||||
@Override
|
||||
public String serialize(ItemStack is) {
|
||||
String mat = is.getType().name();
|
||||
String mat = name(is);
|
||||
if (VersionUtil.getServerBukkitVersion().isLowerThanOrEqualTo(VersionUtil.v1_12_2_R01) && is.getData().getData() != 0) {
|
||||
mat = mat + ":" + is.getData().getData();
|
||||
}
|
||||
|
@ -150,6 +150,13 @@ public class LegacyItemDb extends AbstractItemDb {
|
||||
}
|
||||
}
|
||||
|
||||
if (itemid < 1) {
|
||||
Material matFromName = EnumUtil.getMaterial(itemname.toUpperCase());
|
||||
if (matFromName != null) {
|
||||
itemid = matFromName.getId();
|
||||
}
|
||||
}
|
||||
|
||||
if (itemid < 1) {
|
||||
throw new Exception(tl("unknownItemName", itemname));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user