Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void onDeath(PlayerDeathEvent e) {
- if(FileManager.getCfg().getBoolean("config.removerespawnkitondeath") == true) {
- if(e.getDrops().isEmpty()) return;
- for(ItemStack i : e.getDrops()) {
- if(check(i)) e.getDrops().remove(i);
- }
- }
- }
- public boolean check(ItemStack i) {
- List<ItemStack> itemstacki = new ArrayList<ItemStack>();
- itemstacki.add(new ItemStack(Material.IRON_HELMET, 1));
- itemstacki.add(new ItemStack(Material.IRON_CHESTPLATE, 1));
- itemstacki.add(new ItemStack(Material.IRON_LEGGINGS, 1));
- itemstacki.add(new ItemStack(Material.IRON_BOOTS, 1));
- ItemStack bow = new ItemStack(Material.BOW, 1);
- ItemStack beef = new ItemStack(Material.COOKED_BEEF, 1);
- ItemMeta bowmeta = bow.getItemMeta();
- ItemMeta beefmeta = beef.getItemMeta();
- beefmeta.addEnchant(Enchantment.MENDING, 1, true);
- beefmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
- beef.setItemMeta(beefmeta);
- bowmeta.addEnchant(Enchantment.ARROW_INFINITE, 10, true);
- bowmeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
- bow.setItemMeta(bowmeta);
- itemstacki.add(bow);
- itemstacki.add(beef);
- itemstacki.add(new ItemStack(Material.ARROW, 1));
- ItemStack is = i.clone();
- is.setDurability(is.getType().getMaxDurability());
- if(checkItemStack(itemstacki, is) == true) return true;
- return false;
- }
- public boolean checkItemStack(List<ItemStack> list, ItemStack i) {
- for(ItemStack is : list) {
- if(is.isSimilar(i)) return true;
- }
- return false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement