Doubling an arrow

Discussion in 'Plugin Development' started by Reflxction, Jul 13, 2018 at 12:20 PM.

  1. Offline


    Hello. I'm currently making an abilities plugin and I have across making a double arrow ability, pretty much self explanatory that when you shoot an arrow it gets doubled. Now, I'm just confused on how would I go with that. I thought of something like spawning a new arrow with the same velocity but I didn't know how would I copy the exact arrow (direction, shooter, etc.) Any ideas? (no, not asking for spoonfeeding, just steps/suggestions on how would I get a clone)
  2. Offline


    Maybe this part of my code could help you.
       public void fireball(PlayerInteractEvent event) {
         Player player = event.getPlayer();
         Action eventAction = event.getAction();
        if (eventAction == Action.RIGHT_CLICK_AIR || eventAction == Action.RIGHT_CLICK_BLOCK ){
        if (player.getItemInHand().getType().equals(Material.BOW) && player.getItemInHand() != null){
    I guess you can change the Fireball.class and write Arrow.class all the other part from "Setvelocity" is used to take the direction of the player and the part "multiply(2)" is the velocity of the arrow, I don't know how to set the same velocity than the first arrow.

    Pd. Sorry if my english is bad.
  3. Online

    timtower Ninja on the waves Moderator

    @jersogamer Your code order is wrong, check for null, then for the type.

Share This Page