i have this code but whenever the arrow launches it only goes one way... please help Code: @EventHandler public void onUse(PlayerInteractEvent e) { ItemStack used = e.getItem(); Player p = e.getPlayer(); ItemMeta usedm = used.getItemMeta(); String name = usedm.getDisplayName(); if (name.equalsIgnoreCase(ChatColor.MAGIC + ":::" + ChatColor.RESET + "" + ChatColor.GRAY + "Grappling hook" + ChatColor.RESET + "" + ChatColor.MAGIC + ":::")) { if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { Arrow a = p.getWorld().spawn( e.getPlayer().getLocation() .add(new Vector(0.0D, 1.0D, 0.0D)), Arrow.class); a.setVelocity(a.getLocation().getDirection()); } } }
try p.launchProjectile(Arrow.class) And your code will throw many errors, because: Not all items have ItemMeta Not all ItemMetas have displaynames
ProjectileHitEvent But you need to add the arrows UUID or something to a List to see if it is really this arrow you want