Hey! I need a plugin that makes items (that you can set in the config file) dissapear on death. So, the Items I don't want to get dropped: Golden apples Diamond armor Diamond sword Bow Arrows Bottles BUT! I do want Enchanted golden apples Enchanted Diamond armor Enchanted Diamond swords Enchanted Bows To drop on death. Someone already tried something but it does not work. Maybe this can help you a little? I need this ASAP, but don't hurry please! package dissapear; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin implements Listener { @Override public void onEnable() { getLogger().info("\n\n\nNow that i am enabled \n \n ALL UESLESS ITEMS GET REMOVED \n for helping not damage\n\n\n"); } public void removeUselessEntities(){ for(Entity e : Bukkit.getServer().getWorld("").getEntities()){ if(e instanceof Item){ Material t = ((Item) e).getItemStack().getType(); if (t == Material.GOLDEN_APPLE || t == Material.DIAMOND_SWORD || t == Material.DIAMOND_HELMET || t == Material.DIAMOND_CHESTPLATE || t == Material.DIAMOND_LEGGINGS || t == Material.DIAMOND_BOOTS) { e.remove(); } } } } @Override public void onDisable() { getLogger().info("This plugin is now offline!"); } @EventHandler public void onPlayerDropItem(PlayerDropItemEvent event) { for(Entity e : Bukkit.getServer().getWorld("").getEntities()){ if(e instanceof Item){ Material t = ((Item) e).getItemStack().getType(); if (t == Material.GOLDEN_APPLE || t == Material.DIAMOND_SWORD || t == Material.DIAMOND_HELMET || t == Material.DIAMOND_CHESTPLATE || t == Material.DIAMOND_LEGGINGS || t == Material.DIAMOND_BOOTS) { e.remove(); } } } } }
@TerraFiX The code you posted above would work if you actually specified the name of a world in this line: Code:java for (Entity e : Bukkit.getWorld("").getEntities()) { However, there are quite a lot of problems with this code. But seeing your post, I don't think you wrote this code, so I won't point them out.
@AlvinB I wrote in my post ''someone tried something'' but if you can help make this plugin work, me and my friend (creator of the plugin) will be very happy ^^
@TerraFiX Post the plugin in [code=java][/code] tags so we can actually see. Then as @AlvinB said there are many issues so I will then go and post all of them once they are fixed I will post the resolution.