Guest User

Untitled

a guest
Jun 22nd, 2020
12
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package freyja_pack;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.Material;
  8. import org.bukkit.enchantments.Enchantment;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.EventHandler;
  11. import org.bukkit.event.Listener;
  12. import org.bukkit.event.player.PlayerItemHeldEvent;
  13. import org.bukkit.inventory.ItemFlag;
  14. import org.bukkit.inventory.ItemStack;
  15. import org.bukkit.inventory.meta.ItemMeta;
  16. import org.bukkit.potion.PotionEffect;
  17. import org.bukkit.potion.PotionEffectType;
  18.  
  19. public class custom_item{
  20.  
  21. public ArrayList<Player> spp = new ArrayList<Player>();
  22.  
  23. public void test(String str) {
  24. Bukkit.broadcastMessage(str);
  25. }
  26.  
  27. public ItemStack make(Material mat, String name, List<String> lore, List<Enchantment> enchant, List<Integer> lvl) {
  28. //makes the itemstack and itemmeta
  29. ItemStack i = new ItemStack(mat);
  30. ItemMeta im = i.getItemMeta();
  31.  
  32. //set item name
  33. im.setDisplayName(name);
  34.  
  35. //set item lore
  36. im.setLore(lore);
  37.  
  38. //set item enchants
  39. if(enchant != null) {
  40. for(Integer a = 0; a < enchant.size(); a++) {
  41. im.addEnchant(enchant.get(a), lvl.get(a), true);
  42. }
  43. }
  44.  
  45. //im.addItemFlags(ItemFlag);
  46.  
  47. //gives the ItemStack the ItemMeta
  48. i.setItemMeta(im);
  49.  
  50. return i;
  51. }
  52.  
  53. }
RAW Paste Data