Search in sources :

Example 16 with ItemMeta

use of org.bukkit.inventory.meta.ItemMeta in project SpaciousLib by anhcraft.

the class SItems method setLores.

/**
     * Set lores for an item
     *
     * @param texts the lores
     */
public void setLores(List<String> texts) {
    ItemMeta a = this.item.getItemMeta();
    List<String> lores = new ArrayList<>();
    for (String b : texts) {
        lores.add(b.replace("&", "§"));
    }
    a.setLore(lores);
    this.item.setItemMeta(a);
}
Also used : ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 17 with ItemMeta

use of org.bukkit.inventory.meta.ItemMeta in project SpaciousLib by anhcraft.

the class SItems method flag.

/**
     * Set flags for an item
     *
     * @param flag the flag
     */
public void flag(ItemFlag flag) {
    ItemMeta a = this.item.getItemMeta();
    a.addItemFlags(flag);
    this.item.setItemMeta(a);
}
Also used : ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 18 with ItemMeta

use of org.bukkit.inventory.meta.ItemMeta in project SpaciousLib by anhcraft.

the class SItems method removeEnchant.

/**
     * Remove an echantment of an item
     *
     * @param enchant the enchant name
     */
public void removeEnchant(Enchantment enchant) {
    ItemMeta a = this.item.getItemMeta();
    a.removeEnchant(enchant);
    this.item.setItemMeta(a);
}
Also used : ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 19 with ItemMeta

use of org.bukkit.inventory.meta.ItemMeta in project SpaciousLib by anhcraft.

the class SItems method addLore.

/**
     * Add lore for an item
     *
     * @param text the lore
     */
public void addLore(String text) {
    ItemMeta a = this.item.getItemMeta();
    List<String> lores;
    if (a.hasLore()) {
        lores = a.getLore();
    } else {
        lores = new ArrayList<>();
    }
    lores.add(text.replace("&", "§"));
    a.setLore(lores);
    this.item.setItemMeta(a);
}
Also used : ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 20 with ItemMeta

use of org.bukkit.inventory.meta.ItemMeta in project SpaciousLib by anhcraft.

the class SItems method setLore.

/**
     * Set lore for an item
     *
     * @param texts the lores
     */
public void setLore(String texts) {
    ItemMeta a = this.item.getItemMeta();
    List<String> lores = new ArrayList<>();
    lores.add(texts.replace("&", "§"));
    a.setLore(lores);
    this.item.setItemMeta(a);
}
Also used : ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Aggregations

ItemMeta (org.bukkit.inventory.meta.ItemMeta)47 ItemStack (org.bukkit.inventory.ItemStack)17 ArrayList (java.util.ArrayList)5 Enchantment (org.bukkit.enchantments.Enchantment)5 net.aufdemrand.denizencore.objects.dList (net.aufdemrand.denizencore.objects.dList)4 BookMeta (org.bukkit.inventory.meta.BookMeta)3 FireworkEffectMeta (org.bukkit.inventory.meta.FireworkEffectMeta)3 SkullMeta (org.bukkit.inventory.meta.SkullMeta)3 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 StringTag (net.aufdemrand.denizen.nms.util.jnbt.StringTag)2 Element (net.aufdemrand.denizencore.objects.Element)2 FireworkEffect (org.bukkit.FireworkEffect)2 Material (org.bukkit.Material)2 Banner (org.bukkit.block.Banner)2 BannerMeta (org.bukkit.inventory.meta.BannerMeta)2 BlockStateMeta (org.bukkit.inventory.meta.BlockStateMeta)2 EnchantmentStorageMeta (org.bukkit.inventory.meta.EnchantmentStorageMeta)2 LeatherArmorMeta (org.bukkit.inventory.meta.LeatherArmorMeta)2 RewardType (au.com.mineauz.minigames.minigame.reward.RewardType)1