I can do the Water Bucket exception, the sound effects, and the smoke. Code:java import org.bukkit.Effect;import org.bukkit.Material;import org.bukkit.Sound; @EventHandlerpublic void onItemSpawn(ItemSpawnEvent e) {ItemStack item = e.getEntity().getItemStack(); if(!item.getType().equals(Material.WATER_BUCKET)) {e.getEntity().remove();e.getEntity().getWorld().playEffect(e.getLocation(), Effect.SMOKE, 0);e.getEntity().getWorld().playSound(e.getLocation(), Sound.CLICK, 10F, 10F);}} Choose a sound and an effect, I thought the smoke and the click sound made sense. I believe the 10F's are the volume and pitch. I tried this code out and didn't get any errors. I hope it works for you too. EDIT: I didn't see your edit until I refreshed change this: e.getEntity().getWorld().playSound(e.getLocation(), Sound.CLICK, 10F, 10F); To: e.getEntity().getWorld().playSound(e.getLocation(), Sound.CHICKEN_EGG_POP, 10F, 10F); You want it so you can watch Water Buckets disappear and other entitites disappear if you attempt to drop them? Is this what you want? The code sees if the item is a water bucket, if it is it'll play the cool effects you want. If not, it'll just vanish without any effects. Code:java @EventHandlerpublic void onItemSpawn(ItemSpawnEvent e) {ItemStack item = e.getEntity().getItemStack();if(item.getType().equals(Material.WATER_BUCKET)) {e.getEntity().remove();e.getEntity().getWorld().playEffect(e.getLocation(), Effect.SMOKE, 0);e.getEntity().getWorld().playSound(e.getLocation(), Sound.CHICKEN_EGG_POP, 10F, 10F);}else {e.getEntity().remove();}} EDIT by Moderator: merged posts, please use the edit button instead of double posting.
I think he wants a 5 second delay on the water bucket, but as far as that code goes, I would've done the smoke effects if waterbucket and used the same .remove() code (just less code to write).
elementalgodz11 Code:java Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable(){public void run(){//code}}, 100); ^^ put that under the Code:java if(item.getType().equals(Material.WATER_BUCKET)) {
elementalgodz11 Is this what you want? This even allows you to add more items other than the water bucket by putting them inside the {} separated by a comma. Note: You need to pass an instance of your main class for this work. If you don't know how to do that then just put this in your main class and change "plugin" to "this". Code:java Material[] allowed = {Material.WATER_BUCKET}; @EventHandler public void onItemSpawn(ItemSpawnEvent event) { final Entity e = event.getEntity(); ItemStack i = event.getEntity().getItemStack(); for(Material materials : allowed) { if(materials == i.getType()) { new BukkitRunnable() { @Override public void run() { e.remove(); e.getWorld().playEffect(e.getLocation(), Effect.SMOKE, 0); e.getWorld().playSound(e.getLocation(), Sound.CHICKEN_EGG_POP, 10F, 10F); } }.runTaskLater(plugin, 100L); return; } } e.remove(); e.getWorld().playEffect(e.getLocation(), Effect.SMOKE, 0); e.getWorld().playSound(e.getLocation(), Sound.CHICKEN_EGG_POP, 10F, 10F); } elementalgodz11 I told you in my post. This is where you pass an instance of your main class. If you don't know how to do that then just put the code in your main class and change plugin to this. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
elementalgodz11 Does the smoke appear? Are you registering your events in the main class? In your onEnable() you need to put Code:java getServer().getPluginManager().registerEvents(this, this);
elementalgodz11 Please post the entire class elementalgodz11 Do you only want water buckets removed or something? Cause you're removing any it that is dropped... elementalgodz11 elementalgodz11 The class doesn't extend JavaPlugin, or you need a plugin variable. I think the latter is the best idea for this situation elementalgodz11 Is that the only class that extends JavaPlugin? Does it implement Listener also? Is it registered? elementalgodz11 Is it the only class that extends JavaPlugin? Is it registered? Are there any other classes? elementalgodz11 There should only be one class that extends JavaPlugin, it should be the class that registers all your events. Use this to have a plugin variable: https://gist.github.com/AgentTroll/6382979 elementalgodz11 Use "plugin", if you used the constructor example is linked elementalgodz11 Lol. Put 10-12 inside the run() elementalgodz11 elementalgodz11 Did you use the link I posted, edited the code? Please just show the entire class, it would make it much easier EDIT by Moderator: merged posts, please use the edit button instead of double posting.