SHARE
TWEET

Untitled

a guest May 24th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.igquiz.utils;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.enchantments.Enchantment;
  5. import org.bukkit.inventory.ItemFlag;
  6. import org.bukkit.inventory.ItemStack;
  7. import org.bukkit.inventory.meta.ItemMeta;
  8. import org.bukkit.inventory.meta.SkullMeta;
  9.  
  10. import java.util.List;
  11.  
  12. public class Item {
  13.  
  14.     private ItemStack itemStack;
  15.     private ItemMeta itemMeta;
  16.  
  17.     public Item(ItemStack itemStack) {
  18.         this.itemStack = itemStack.clone();
  19.     }
  20.  
  21.     public Item(Material m, int quantidade, short data) {
  22.         itemStack = new ItemStack(m, quantidade, data);
  23.         itemMeta = itemStack.getItemMeta();
  24.  
  25.     }
  26.  
  27.     public Item setNome(String nome) {
  28.         itemMeta.setDisplayName(nome.replace("&", "ยง"));
  29.         itemStack.setItemMeta(itemMeta);
  30.         return this;
  31.     }
  32.  
  33.     public Item setLore(List<String> lore) {
  34.         itemMeta.setLore(lore);
  35.         itemStack.setItemMeta(itemMeta);
  36.         return this;
  37.     }
  38.  
  39.     public Item setEnchant(Enchantment enchant, int forca) {
  40.         itemMeta.addEnchant(enchant, forca, false);
  41.         itemStack.setItemMeta(itemMeta);
  42.         return this;
  43.     }
  44.  
  45.     public Item esconderEnchant() {
  46.         itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
  47.         itemStack.setItemMeta(itemMeta);
  48.         return this;
  49.     }
  50.  
  51.     public Item setSkull(String owner) {
  52.         ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
  53.         SkullMeta meta = (SkullMeta) skull.getItemMeta();
  54.         meta.setOwner(owner);
  55.         skull.setItemMeta(meta);
  56.         return this;
  57.     }
  58.  
  59.     public ItemStack getItemstack() {
  60.  
  61.         return itemStack;
  62.     }
  63.  
  64.     public ItemStack getItem() {
  65.  
  66.         return this.itemStack;
  67.     }
  68. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top