mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add custom model data support for kits (#5433)
This commit is contained in:
parent
7eed853294
commit
2b993d58cf
@ -206,6 +206,13 @@ public class MetaItemStack {
|
|||||||
final ItemMeta meta = stack.getItemMeta();
|
final ItemMeta meta = stack.getItemMeta();
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
stack.setItemMeta(meta);
|
stack.setItemMeta(meta);
|
||||||
|
} else if ((split[0].equalsIgnoreCase("custom-model-data") || split[0].equalsIgnoreCase("cmd")) && hasMetaPermission(sender, "custom-model-data", false, true, ess)) {
|
||||||
|
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_14_R01)) {
|
||||||
|
final int value = split.length <= 1 ? 0 : Integer.parseInt(split[1]);
|
||||||
|
final ItemMeta meta = stack.getItemMeta();
|
||||||
|
meta.setCustomModelData(value);
|
||||||
|
stack.setItemMeta(meta);
|
||||||
|
}
|
||||||
} else if (split[0].equalsIgnoreCase("unbreakable") && hasMetaPermission(sender, "unbreakable", false, true, ess)) {
|
} else if (split[0].equalsIgnoreCase("unbreakable") && hasMetaPermission(sender, "unbreakable", false, true, ess)) {
|
||||||
final boolean value = split.length <= 1 || Boolean.parseBoolean(split[1]);
|
final boolean value = split.length <= 1 || Boolean.parseBoolean(split[1]);
|
||||||
setUnbreakable(ess, stack, value);
|
setUnbreakable(ess, stack, value);
|
||||||
|
@ -214,6 +214,12 @@ public abstract class AbstractItemDb implements IConf, net.ess3.api.IItemDb {
|
|||||||
sb.append("lore:").append(serializeLines(meta.getLore())).append(" ");
|
sb.append("lore:").append(serializeLines(meta.getLore())).append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VersionUtil.getServerBukkitVersion().isHigherThanOrEqualTo(VersionUtil.v1_14_R01)) {
|
||||||
|
if (meta.hasCustomModelData()) {
|
||||||
|
sb.append("custom-model-data:").append(meta.getCustomModelData()).append(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (meta.hasEnchants()) {
|
if (meta.hasEnchants()) {
|
||||||
for (final Enchantment e : meta.getEnchants().keySet()) {
|
for (final Enchantment e : meta.getEnchants().keySet()) {
|
||||||
sb.append(e.getName().toLowerCase()).append(":").append(meta.getEnchantLevel(e)).append(" ");
|
sb.append(e.getName().toLowerCase()).append(":").append(meta.getEnchantLevel(e)).append(" ");
|
||||||
|
Loading…
Reference in New Issue
Block a user