Herrorroo!!! So I am making a plugin that includes explosive arrows, how can I make only the arrows from my itemstack explode? I think it would have to do with the getCustomName() method? Code (Text): @EventHandler public void arrowEvent(ProjectileHitEvent event) { if(event.getEntity() instanceof Arrow) { Arrow arrow = (Arrow)event.getEntity(); Entity shooter = (Entity) arrow.getShooter(); if(shooter instanceof Player && arrow.hasMetadata("arrowmeta")) { ParticleEffect.SMOKE_LARGE.display(0, 2, 0, 100, 1000, arrow.getLocation(), 60); arrow.getLocation().getWorld().createExplosion(arrow.getLocation(), (float) 4.0); }else return; } Code (Text): ItemStack bowarrow = new ItemStack(Material.ARROW, 3); ItemMeta arrowmeta = bowarrow.getItemMeta(); ArrayList<String> arrow = new ArrayList<String>(); arrowmeta.setDisplayName(ChatColor.BOLD.toString() + ChatColor.RED + "TNT arrows"); arrow.add(ChatColor.RED + "Do some damage"); arrowmeta.setLore(hub); bowarrow.setItemMeta(arrowmeta); Thanks!
Use the ProjectileLaunchEvent and make sure that the shooter has that item, then add the entity to an ArrayList. Use the ProjectileHitEvent and check if the entity is the one that you stored in the ArrayList.
If a player shoots an arrow, check if they have used your fancy arrow and apply a metadata to the launched arrow. In the ProjectileHitEvent check whether the arrow has this metadata.
I don't think adding the entity to a array list is a good idea. Hash sets are way easier, and cause a lot less stress. Also yes, you are checking for a string arrowmeta not a object.