Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. @EventHandler
  2. public void onDeath(PlayerDeathEvent e) {
  3. if(FileManager.getCfg().getBoolean("config.removerespawnkitondeath") == true) {
  4. if(e.getDrops().isEmpty()) return;
  5. for(ItemStack i : e.getDrops()) {
  6. if(check(i)) e.getDrops().remove(i);
  7. }
  8. }
  9. }
  10.  
  11. public boolean check(ItemStack i) {
  12. List<ItemStack> itemstacki = new ArrayList<ItemStack>();
  13. itemstacki.add(new ItemStack(Material.IRON_HELMET, 1));
  14. itemstacki.add(new ItemStack(Material.IRON_CHESTPLATE, 1));
  15. itemstacki.add(new ItemStack(Material.IRON_LEGGINGS, 1));
  16. itemstacki.add(new ItemStack(Material.IRON_BOOTS, 1));
  17. ItemStack bow = new ItemStack(Material.BOW, 1);
  18. ItemStack beef = new ItemStack(Material.COOKED_BEEF, 1);
  19. ItemMeta bowmeta = bow.getItemMeta();
  20. ItemMeta beefmeta = beef.getItemMeta();
  21. beefmeta.addEnchant(Enchantment.MENDING, 1, true);
  22. beefmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
  23. beef.setItemMeta(beefmeta);
  24. bowmeta.addEnchant(Enchantment.ARROW_INFINITE, 10, true);
  25. bowmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
  26. bow.setItemMeta(bowmeta);
  27. itemstacki.add(bow);
  28. itemstacki.add(beef);
  29. itemstacki.add(new ItemStack(Material.ARROW, 1));
  30. ItemStack is = i.clone();
  31. is.setDurability(is.getType().getMaxDurability());
  32. if(checkItemStack(itemstacki, is) == true) return true;
  33. return false;
  34. }
  35.  
  36. public boolean checkItemStack(List<ItemStack> list, ItemStack i) {
  37. for(ItemStack is : list) {
  38. if(is.isSimilar(i)) return true;
  39. }
  40. return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement