Search in sources :

Example 1 with CraftCustomItemTagContainer

use of org.bukkit.craftbukkit.v1_13_R2.inventory.tags.CraftCustomItemTagContainer in project MechanicsMain by WeaponMechanics.

the class NBT_1_13_R2 method getBukkitCompound.

private CustomItemTagContainer getBukkitCompound(ItemMeta meta, String plugin) {
    if (plugin == null) {
        meta.getCustomTagContainer();
    }
    NamespacedKey key = new NamespacedKey(MechanicsCore.getPlugin(), plugin);
    CustomItemTagContainer nbt = meta.getCustomTagContainer().getCustomTag(key, ItemTagType.TAG_CONTAINER);
    if (nbt == null) {
        nbt = new CraftCustomItemTagContainer(new CraftCustomTagTypeRegistry());
        meta.getCustomTagContainer().setCustomTag(key, ItemTagType.TAG_CONTAINER, nbt);
    }
    return nbt;
}
Also used : CraftCustomItemTagContainer(org.bukkit.craftbukkit.v1_13_R2.inventory.tags.CraftCustomItemTagContainer) NamespacedKey(org.bukkit.NamespacedKey) CraftCustomTagTypeRegistry(org.bukkit.craftbukkit.v1_13_R2.inventory.CraftCustomTagTypeRegistry) CraftCustomItemTagContainer(org.bukkit.craftbukkit.v1_13_R2.inventory.tags.CraftCustomItemTagContainer) CustomItemTagContainer(org.bukkit.inventory.meta.tags.CustomItemTagContainer)

Aggregations

NamespacedKey (org.bukkit.NamespacedKey)1 CraftCustomTagTypeRegistry (org.bukkit.craftbukkit.v1_13_R2.inventory.CraftCustomTagTypeRegistry)1 CraftCustomItemTagContainer (org.bukkit.craftbukkit.v1_13_R2.inventory.tags.CraftCustomItemTagContainer)1 CustomItemTagContainer (org.bukkit.inventory.meta.tags.CustomItemTagContainer)1