hello! im trying to make plugin that will let you shoot item (with custom name so its wont be every item..) and make the item explode with effect after X ticks... this is the code that i have at the moment : Code:java @EventHandler public void onShoot(EntityShootBowEvent e) { if (((e.getEntity() instanceof Player)) && (e.getBow().hasItemMeta()) && (e.getBow().getItemMeta().getDisplayName().equals(ChatColor.RESET + "Spray Painter"))){ e.setCancelled(true); Player player = (Player)e.getEntity(); Location loc = player.getLocation(); Location eyeloc = player.getEyeLocation(); Entity pro = e.getProjectile(); Vector v = pro.getVelocity(); World world = player.getWorld(); Entity item = world.dropItemNaturally(eyeloc, new ItemStack(pop)); item.setVelocity(v.multiply(0.2)); player.getWorld().playSound(loc, Sound.STEP_WOOL, 10.0F, 0.8F); this.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { public void run() { } }, 40L);} }} now, for the questions! 1. how do i make the item play effect after X ticks 2. how do i make the item despawn after X ticks 3. how can i disable the item pickup event? (only for item named pop...) i tried with player pick item event but it didnt work... :/ i have set all the "pop" and Spray Painter items alredy thx ! bump? i didnt found any rule that say about bumping time... how much time i need per bump? XD EDIT by Moderator: merged posts, please use the edit button instead of double posting.
nrs23 that necro Niv200, nrs23 here you go: Code:java @EventHandler public void entityShootBow(EntityShootBowEvent e){ if(e.getEntity() instanceof Player){ Player p = (Player)e.getEntity(); if(p.getItemInHand() != null){ if(p.getItemInHand().getItemMeta() != null){ if(p.getItemInHand().getItemMeta().getDisplayName() != null){ if(p.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase("whatever")){ final Item i = p.getWorld().dropItem(p.getLocation().add(0,2,0), p.getItemInHand());//spawn it a bit higher than the arrow i.setPickupDelay(9999);//disable pickup i.setVelocity(e.getProjectile().getVelocity()); e.setProjectile(i); new BukkitRunnable() { int c = 30; //or how many seconds you'd like to wait public void run() { if(c != 0){ c--; }else{ //do whatever you want to do after x seconds has passed. i.getWorld().playSound(i.getLocation(), Sound.STEP_WOOL, 1, 1); i.remove(); // despawns it this.cancel(); } } }.runTaskTimer(this, 9, 9); } } } } } }