@Override public ItemStack clone() { try { ItemStack itemStack = (ItemStack) super.clone(); if (this.meta != null) { itemStack.meta = this.meta.clone(); } if (this.data != null) { itemStack.data = this.data.clone(); } return itemStack; } catch (CloneNotSupportedException e) { throw new Error(e); } }
public ImmutableItemStack(ItemStack stack) throws IllegalArgumentException { super(stack); itemMeta = stack.getItemMeta().clone(); }
/** * Get a copy of this ItemStack's {@link ItemMeta}. * * @return a copy of the current ItemStack's ItemData */ public ItemMeta getItemMeta() { return this.meta == null ? Bukkit.getItemFactory().getItemMeta(getType0()) : this.meta.clone(); }
private boolean setItemMeta0(ItemMeta itemMeta, Material material) { if (itemMeta == null) { this.meta = null; return true; } if (!Bukkit.getItemFactory().isApplicable(itemMeta, material)) { return false; } this.meta = Bukkit.getItemFactory().asMetaFor(itemMeta, material); if (this.meta == itemMeta) { this.meta = itemMeta.clone(); } return true; } }
public ImmutableItemStack(int type) { super(type); itemMeta = ServerProvider.getServer().getItemFactory().getItemMeta(getType()).clone(); }
@Override public ItemStack clone() { try { ItemStack itemStack = (ItemStack) super.clone(); if (this.meta != null) { itemStack.meta = this.meta.clone(); } if (this.data != null) { itemStack.data = this.data.clone(); } return itemStack; } catch (CloneNotSupportedException e) { throw new Error(e); } }
public ItemStack build() { ItemStack buildItem = itemStack.clone(); if (itemMeta != null) { buildItem.setItemMeta(itemMeta.clone()); } return buildItem; }
/** * Get a copy of this ItemStack's {@link ItemMeta}. * * @return a copy of the current ItemStack's ItemData */ public ItemMeta getItemMeta() { return this.meta == null ? Bukkit.getItemFactory().getItemMeta(getType0()) : this.meta.clone(); }
public IconMenuItem clone() { IconMenuItem newItem = new IconMenuItem(); newItem.material = this.material; newItem.data = this.data; newItem.amount = this.amount; newItem.title = this.title; newItem.lore.addAll(this.lore); newItem.glowing = this.glowing; if (this.bukkitMeta != null) { newItem.bukkitMeta = this.bukkitMeta.clone(); } if (this.meta != null) { newItem.meta = this.meta.clone(); } if (this.tag != null) { newItem.tag = this.tag.clone(); } newItem.hasChanged = true; return newItem; } }
private boolean setItemMeta0(ItemMeta itemMeta, Material material) { if (itemMeta == null) { this.meta = null; return true; } if (!Bukkit.getItemFactory().isApplicable(itemMeta, material)) { return false; } this.meta = Bukkit.getItemFactory().asMetaFor(itemMeta, material); if (this.meta == itemMeta) { this.meta = itemMeta.clone(); } return true; } }
BookMeta book = (BookMeta) bookStack.getItemMeta().clone(); book.setAuthor(ChatColor.DARK_PURPLE + "SERVER OWNER"); book.setTitle(ChatColor.DARK_GREEN + "Why you should go to TotalFreedom instead");