Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. @Override
  2. public void run() {
  3. for (Player p : Bukkit.getOnlinePlayers()) {
  4.  
  5. ItemStack h = p.getInventory().getHelmet();
  6. ItemStack c = p.getInventory().getChestplate();
  7. ItemStack l = p.getInventory().getLeggings();
  8. ItemStack b = p.getInventory().getBoots();
  9.  
  10. ItemStack mh = new ItemStack(Material.GOLD_HELMET);
  11. ItemMeta mhm = mh.getItemMeta();
  12. mhm.setDisplayName(ChatColor.GOLD + "Mining Helmet");
  13. ArrayList<String> lo = new ArrayList<String>();
  14. lo.add(ChatColor.GRAY + "Provides night vision.");
  15. mhm.setLore(lo);
  16. mh.setItemMeta(mhm);
  17.  
  18.  
  19. if (h != null && h.equals(mh)){
  20. p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 40, 0), true);
  21. p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 120, 0), true);
  22. }
  23.  
  24.  
  25. if ((h != null && h.getType() == Material.IRON_HELMET) &&
  26. (c != null && c.getType() == Material.IRON_CHESTPLATE) &&
  27. (l != null && l.getType() == Material.IRON_LEGGINGS) &&
  28. (b != null && b.getType() == Material.IRON_BOOTS)) {
  29.  
  30. p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 0), true);
  31.  
  32. }
  33. }
  34.  
  35. }
  36.  
  37. }, 0L, 20L);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement