2017-09-07 22:36:54 +02:00
|
|
|
/*
|
2018-01-15 12:25:45 +01:00
|
|
|
* Copyright (c) 2018 univento.eu - All rights reserved
|
2017-09-07 22:36:54 +02:00
|
|
|
* You are not allowed to use, distribute or modify this code
|
|
|
|
*/
|
|
|
|
|
2016-07-09 13:14:19 +02:00
|
|
|
package eu.univento.core.api.items;
|
|
|
|
|
2017-09-07 22:36:54 +02:00
|
|
|
import com.mojang.authlib.GameProfile;
|
2018-01-15 12:25:45 +01:00
|
|
|
import com.mojang.authlib.properties.Property;
|
2017-09-07 22:36:54 +02:00
|
|
|
import eu.univento.commons.player.language.MessageConstant;
|
|
|
|
import eu.univento.commons.player.user.UserInformation;
|
|
|
|
import eu.univento.core.api.items.attribute.Attribute;
|
|
|
|
import eu.univento.core.api.items.attribute.AttributeModifier;
|
|
|
|
import eu.univento.core.api.items.attribute.ItemAttributes;
|
|
|
|
import eu.univento.core.api.items.attribute.ItemSlot;
|
|
|
|
import eu.univento.core.api.player.CustomPlayer;
|
|
|
|
import eu.univento.core.api.utils.GameProfileBuilder;
|
2016-07-09 13:14:19 +02:00
|
|
|
import org.bukkit.Color;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.enchantments.Enchantment;
|
|
|
|
import org.bukkit.inventory.ItemFlag;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.bukkit.inventory.meta.ItemMeta;
|
|
|
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
|
|
|
import org.bukkit.inventory.meta.SkullMeta;
|
|
|
|
import org.bukkit.material.MaterialData;
|
|
|
|
|
2017-09-07 22:36:54 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.lang.reflect.Field;
|
2016-07-09 13:14:19 +02:00
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* NOTICE: This utility was developer as part of AeolusLib. While you can use it for your own projects, You are NOT allowed to delete or move this header comment.
|
|
|
|
*
|
|
|
|
* Utility:
|
|
|
|
* Chainable {@link ItemStack}s
|
|
|
|
*
|
|
|
|
* Example Usage(s):
|
|
|
|
* {@code ItemStack itemStack = new ItemBuilder(Material.SKULL_ITEM).amount(1).durability(3).skullOwner("MCAeolus").name(ChatColor.RED+"MCAeolus's Skull").make())}
|
|
|
|
* {@code ItemStack itemStack = new ItemBuilder().type(Material.BEDROCK).lores(new String[]{"Lore1",ChatColor.RED+"Lore2"}).enchantment(Enchantment.DAMAGE_ALL, 99).make()}
|
|
|
|
*
|
|
|
|
* @author MCAeolus, joethei
|
|
|
|
* @version 1.1
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class ItemBuilder {
|
|
|
|
|
2017-09-07 22:36:54 +02:00
|
|
|
private CustomPlayer player;
|
|
|
|
private ItemStack item;
|
|
|
|
private ItemMeta meta;
|
2016-07-09 13:14:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Init item chainable via given Material parameter.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param itemType the {@link Material} to initiate the instance with.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder(final Material itemType) {
|
2016-07-09 13:14:19 +02:00
|
|
|
item = new ItemStack(itemType);
|
2017-09-07 22:36:54 +02:00
|
|
|
meta = item.getItemMeta();
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-07 22:36:54 +02:00
|
|
|
* Init item chainable via given Material parameter.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
2017-09-07 22:36:54 +02:00
|
|
|
* @param itemType the {@link Material} to initiate the instance with.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder(final CustomPlayer player, final Material itemType) {
|
|
|
|
this.player = player;
|
|
|
|
item = new ItemStack(itemType);
|
|
|
|
meta = item.getItemMeta();
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the Material type of the {@link ItemStack}
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param material the new {@link Material} to set for the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder type(final Material material) {
|
|
|
|
item.setType(material);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the {@link ItemStack}s size.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param itemAmt the new Integer count of the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder amount(final Integer itemAmt) {
|
|
|
|
item.setAmount(itemAmt);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the {@link ItemStack}s display name.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param name the new String for the ItemStack's display name to be set to.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder name(final String name) {
|
|
|
|
meta.setDisplayName(name);
|
|
|
|
item.setItemMeta(meta);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemBuilder name(final MessageConstant messageConstant) {
|
|
|
|
if(player == null) return this;
|
|
|
|
meta.setDisplayName(player.getDatabasePlayer().getLanguage().getMessage(messageConstant));
|
|
|
|
item.setItemMeta(meta);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a line of lore to the {@link ItemStack}
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param lore String you want to add to the ItemStack's lore.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder lore(final String lore) {
|
|
|
|
List<String> lores = meta.getLore();
|
2016-07-09 13:14:19 +02:00
|
|
|
if(lores == null){lores = new ArrayList<>();}
|
|
|
|
lores.add(lore);
|
2017-09-07 22:36:54 +02:00
|
|
|
meta.setLore(lores);
|
|
|
|
item.setItemMeta(meta);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the {@link ItemStack}s lore and replaces it with the defined String array.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param lores String array you want to set the ItemStack's lore to.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder lores(final String[] lores) {
|
|
|
|
List<String> loresList = meta.getLore();
|
|
|
|
if(loresList == null) loresList = new ArrayList<>();
|
2016-07-09 13:14:19 +02:00
|
|
|
else{loresList.clear();}
|
|
|
|
Collections.addAll(loresList, lores);
|
2017-09-07 22:36:54 +02:00
|
|
|
meta.setLore(loresList);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2016-07-28 20:17:25 +02:00
|
|
|
public ItemBuilder durability(short durability) {
|
2017-09-07 22:36:54 +02:00
|
|
|
item.setDurability(durability);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes the data value of the {@link ItemStack}
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param data the new int data value (parsed as byte) to set the ItemStack's durability to.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
|
|
|
@SuppressWarnings("deprecation")
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder data(final int data) {
|
|
|
|
item.setData(new MaterialData(build().getType(), (byte)data));
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds and UnsafeEnchantment to the {@link ItemStack} with a defined level int value.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param enchantment the {@link Enchantment} to add to the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param level the int amount that the Enchantment's level will be set to.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder enchantment(final Enchantment enchantment, final int level) {
|
|
|
|
item.addUnsafeEnchantment(enchantment, level);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-08-03 00:15:45 +02:00
|
|
|
* Adds and UnsafeEnchantment to the {@link} with a level int value of 1.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param enchantment the {@link Enchantment} to add to the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder enchantment(final Enchantment enchantment) {
|
|
|
|
item.addUnsafeEnchantment(enchantment, 1);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears all {@link Enchantment}s from the current {@link ItemStack} then adds the defined array of Enchantments to the ItemStack.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param enchantments the Enchantment array to replace any current enchantments applied on the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param level the int level value for all Enchantments to be set to.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder enchantments(final Enchantment[] enchantments, final int level) {
|
|
|
|
item.getEnchantments().clear();
|
2016-07-09 13:14:19 +02:00
|
|
|
for(Enchantment enchantment : enchantments){
|
2017-09-07 22:36:54 +02:00
|
|
|
item.addUnsafeEnchantment(enchantment, level);
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears all {@link Enchantment}s from the current {@link ItemStack} then adds the defined array of Enchantments to the ItemStack with a level int value of 1.
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param enchantments the Enchantment array to replace any current enchantments applied on the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder enchantments(final Enchantment[] enchantments) {
|
|
|
|
item.getEnchantments().clear();
|
2016-07-09 13:14:19 +02:00
|
|
|
for(Enchantment enchantment : enchantments){
|
2017-09-07 22:36:54 +02:00
|
|
|
item.addUnsafeEnchantment(enchantment, 1);
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the defined {@link Enchantment} from the {@link ItemStack}
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param enchantment the Enchantment to remove from the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder clearEnchantment(final Enchantment enchantment) {
|
|
|
|
Map<Enchantment, Integer> itemEnchantments = item.getEnchantments();
|
2016-07-09 13:14:19 +02:00
|
|
|
itemEnchantments.keySet().stream().filter(enchantmentC -> enchantment == enchantmentC).forEach(itemEnchantments::remove);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears all {@link Enchantment}s from the {@link ItemStack}
|
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder clearEnchantments() {
|
|
|
|
item.getEnchantments().clear();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemBuilder attribute(Attribute attribute, String name, ItemSlot slot, int operation, double amount) {
|
|
|
|
ItemAttributes attributes = new ItemAttributes();
|
|
|
|
attributes.addModifier(new AttributeModifier(attribute, name, slot, operation, amount, UUID.randomUUID()));
|
|
|
|
this.item = attributes.apply(this.item);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2016-09-19 17:21:39 +02:00
|
|
|
public ItemBuilder glow() {
|
2017-09-07 22:36:54 +02:00
|
|
|
meta.addEnchant(Enchantment.ARROW_DAMAGE, 10, false);
|
2016-09-19 17:21:39 +02:00
|
|
|
return this;
|
|
|
|
}
|
2017-06-04 13:42:10 +02:00
|
|
|
|
2016-07-09 13:14:19 +02:00
|
|
|
/**
|
|
|
|
* Clears the defined {@link String} of lore from the {@link ItemStack}
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param lore the String to be removed from the ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder clearLore(final String lore) {
|
|
|
|
if(meta.getLore().contains(lore)){
|
|
|
|
meta.getLore().remove(lore);
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
2017-09-07 22:36:54 +02:00
|
|
|
item.setItemMeta(meta);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears all lore {@link String}s from the {@link ItemStack}
|
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder clearLores() {
|
|
|
|
meta.getLore().clear();
|
|
|
|
item.setItemMeta(meta);
|
2016-07-09 13:14:19 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the {@link Color} of any LEATHER_ARMOR {@link Material} types of the {@link ItemStack}
|
|
|
|
*
|
2016-11-24 19:52:24 +01:00
|
|
|
* @param color the Color to set the LEATHER_ARMOR ItemStack to.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder color(final Color color) {
|
|
|
|
if(item.getType() == Material.LEATHER_HELMET
|
|
|
|
|| item.getType() == Material.LEATHER_CHESTPLATE
|
|
|
|
|| item.getType() == Material.LEATHER_LEGGINGS
|
|
|
|
|| item.getType() == Material.LEATHER_BOOTS ){
|
|
|
|
LeatherArmorMeta meta = (LeatherArmorMeta) this.meta;
|
2016-07-09 13:14:19 +02:00
|
|
|
meta.setColor(color);
|
2017-09-07 22:36:54 +02:00
|
|
|
item.setItemMeta(meta);
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the {@link Color} of any LEATHER_ARMOR {@link Material} types of the {@link ItemStack}
|
|
|
|
*
|
|
|
|
* @return the current instance for chainable application.
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder clearColor() {
|
|
|
|
if(item.getType() == Material.LEATHER_HELMET
|
|
|
|
|| item.getType() == Material.LEATHER_CHESTPLATE
|
|
|
|
|| item.getType() == Material.LEATHER_LEGGINGS
|
|
|
|
|| item.getType() == Material.LEATHER_BOOTS ){
|
|
|
|
LeatherArmorMeta meta = (LeatherArmorMeta) this.meta;
|
2016-07-09 13:14:19 +02:00
|
|
|
meta.setColor(null);
|
2017-09-07 22:36:54 +02:00
|
|
|
item.setItemMeta(meta);
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the skullOwner {@link SkullMeta} of the current SKULL_ITEM {@link Material} type {@link ItemStack}
|
|
|
|
*
|
2017-09-07 22:36:54 +02:00
|
|
|
* @param uuid the {@link String} value to set the SkullOwner meta to for the SKULL_ITEM Material type ItemStack.
|
2016-07-09 13:14:19 +02:00
|
|
|
*
|
|
|
|
* @return the current instance for chainable application
|
|
|
|
* @since 1.0
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder skullOwner(final UUID uuid) {
|
|
|
|
if(item.getType() == Material.SKULL_ITEM && item.getDurability() == (byte) 3){
|
|
|
|
SkullMeta skullMeta = (SkullMeta) meta;
|
|
|
|
|
|
|
|
try {
|
|
|
|
GameProfile profile = GameProfileBuilder.fetch(uuid);
|
|
|
|
Field field = skullMeta.getClass().getDeclaredField("profile");
|
|
|
|
field.setAccessible(true);
|
|
|
|
field.set(skullMeta, profile);
|
|
|
|
|
|
|
|
item.setItemMeta(meta);
|
|
|
|
} catch (IOException | NoSuchFieldException | IllegalAccessException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemBuilder skullOwner(final String name) {
|
|
|
|
UserInformation.get(name).whenComplete((userInformation, throwable) -> skullOwner(userInformation.getUuid()));
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2018-01-15 12:25:45 +01:00
|
|
|
public ItemBuilder skullUrl(String url) {
|
|
|
|
|
|
|
|
SkullMeta headMeta = (SkullMeta) meta();
|
|
|
|
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
|
|
|
|
byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
|
|
|
|
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
|
|
|
|
Field profileField;
|
|
|
|
try {
|
|
|
|
profileField = headMeta.getClass().getDeclaredField("profile");
|
|
|
|
profileField.setAccessible(true);
|
|
|
|
profileField.set(headMeta, profile);
|
|
|
|
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
|
|
|
|
e1.printStackTrace();
|
|
|
|
}
|
|
|
|
item.setItemMeta(headMeta);
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2016-07-09 13:14:19 +02:00
|
|
|
/**
|
|
|
|
* Returns the {@link ItemMeta} of the {@link ItemStack}
|
|
|
|
*
|
|
|
|
* @return the ItemMeta of the ItemStack.
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
private ItemMeta meta() {
|
|
|
|
return meta;
|
2016-07-09 13:14:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the {@link ItemStack} of the {@link ItemBuilder} instance.
|
|
|
|
*
|
|
|
|
* @return the ItemStack of the ItemBuilder instance.
|
|
|
|
*/
|
2017-09-07 22:36:54 +02:00
|
|
|
public ItemStack build() {
|
2016-07-09 13:14:19 +02:00
|
|
|
item.getItemMeta().addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|