Advertisement
Guest User

GalaxyArmor.class

a guest
May 30th, 2016
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package scraftcore.galaxyset;
  2.  
  3. import org.bukkit.Material;
  4.  
  5. import org.bukkit.event.EventHandler;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.player.PlayerInteractEvent;
  8. import org.bukkit.inventory.ItemStack;
  9. import org.bukkit.inventory.meta.ItemMeta;
  10.  
  11. public class GalaxyArmor implements Listener{
  12.  
  13.  
  14. @SuppressWarnings("deprecation")
  15. @EventHandler
  16. public void onArmor(PlayerInteractEvent e){
  17. ItemStack g1 = new ItemStack(Material.LEATHER_HELMET, 1);
  18. ItemStack g2 = new ItemStack(Material.LEATHER_CHESTPLATE, 1);
  19. ItemStack g3 = new ItemStack(Material.LEATHER_LEGGINGS, 1);
  20. ItemStack g4 = new ItemStack(Material.LEATHER_BOOTS, 1);
  21. ItemMeta m1 = g1.getItemMeta();
  22. ItemMeta m2 = g2.getItemMeta();
  23. ItemMeta m3 = g3.getItemMeta();
  24. ItemMeta m4 = g4.getItemMeta();
  25. m1.setDisplayName("§5§lGalaxy Set");
  26. m2.setDisplayName("§5§lGalaxy Set");
  27. m3.setDisplayName("§5§lGalaxy Set");
  28. m4.setDisplayName("§5§lGalaxy Set");
  29. g1.setItemMeta(m1);
  30. g2.setItemMeta(m2);
  31. g3.setItemMeta(m3);
  32. g4.setItemMeta(m4);
  33. if(e.getPlayer().getInventory().getHelmet() == g1 || e.getPlayer().getInventory().getHelmet() == g2 ||
  34. e.getPlayer().getInventory().getHelmet() == g3 ||
  35. e.getPlayer().getInventory().getHelmet() == g4){
  36. if(g1.getDurability() < Material.getMaterial(298).getMaxDurability()){
  37. g1.setDurability(Material.getMaterial(298).getMaxDurability());
  38. }else if(g2.getDurability() < Material.getMaterial(299).getMaxDurability()){
  39. g2.setDurability(Material.getMaterial(299).getMaxDurability());
  40. }else if(g3.getDurability() < Material.getMaterial(300).getMaxDurability()){
  41. g3.setDurability(Material.getMaterial(300).getMaxDurability());
  42. }else if(g4.getDurability() < Material.getMaterial(301).getMaxDurability()){
  43. g1.setDurability(Material.getMaterial(301).getMaxDurability());
  44. }
  45.  
  46.  
  47. }
  48.  
  49. }
  50.  
  51. }
Advertisement
RAW Paste Data Copied
Advertisement