Advertisement
Garris0n

EZItemStack

Oct 28th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. import org.bukkit.Material;
  2. import org.bukkit.enchantments.Enchantment;
  3. import org.bukkit.inventory.ItemStack;
  4. import org.bukkit.inventory.meta.ItemMeta;
  5.  
  6. import java.util.List;
  7.  
  8. public class EZItemStack{
  9.  
  10. ItemStack item;
  11.  
  12. public EZItemStack(ItemStack item){
  13.  
  14. this.item = item.clone();
  15.  
  16. }
  17.  
  18. public EZItemStack(Material material){
  19.  
  20. this.item = new ItemStack(material);
  21.  
  22. }
  23.  
  24. public EZItemStack(Material material, int amount){
  25.  
  26. this.item = new ItemStack(material, amount);
  27.  
  28. }
  29.  
  30. public EZItemStack(Material material, int amount, short damage){
  31.  
  32. this.item = new ItemStack(material, amount, damage);
  33.  
  34. }
  35.  
  36. public EZItemStack name(String name){
  37.  
  38. ItemMeta meta = item.getItemMeta();
  39. meta.setDisplayName(name);
  40. item.setItemMeta(meta);
  41.  
  42. return this;
  43.  
  44. }
  45.  
  46. public EZItemStack lore(List<String> lore){
  47.  
  48. ItemMeta meta = item.getItemMeta();
  49. meta.setLore(lore);
  50. item.setItemMeta(meta);
  51.  
  52. return this;
  53.  
  54. }
  55.  
  56. public EZItemStack enchant(Enchantment enchantment, int level){
  57.  
  58. item.addUnsafeEnchantment(enchantment, level);
  59.  
  60. return this;
  61.  
  62. }
  63.  
  64. public ItemStack toItemStack(){
  65.  
  66. return this.item.clone();
  67.  
  68. }
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement