Tripleshot Bow when LeftClick

Discussion in 'Plugin Development' started by swagbobcow, Apr 22, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    swagbobcow

    So this code below shoots an arrow if you left click the Power 1 Bow. How do I make the bow shoot 3 arrows at the same time. It'll be like the hypixel bowspleef tripleshot.

    Code:
    ItemStack archerBow = new ItemStack(Material.BOW);
    
    @EventHandler
      public void tripleshot(PlayerInteractEvent event){
              Player p = event.getPlayer();
              Action action = event.getAction();
              if(archerBow.getEnchantmentLevel(Enchantment.ARROW_DAMAGE) == 1){
              if(p.getItemInHand().equals(archerBow) && (action.equals(Action.LEFT_CLICK_AIR) || action.equals(Action.LEFT_CLICK_BLOCK))){
                  p.launchProjectile(Arrow.class).setCritical(true); // do tripleshot??
              }
     
  2. Offline

    mine2012craft

    @swagbobcow if you are wanting to shoot 1 arrow per tick for 3 ticks, then you need to create a bukkit runnable. Inside that runnable you put your arrow launching code. Be sure to create a check if the runnable has run 3 times, then cancel the runnable.
     
  3. Offline

    swagbobcow

    No, i want to shoot 3 arrows at the same time.
     
  4. Offline

    N00BHUN73R

    @swagbobcow
    Why not just paste
    Code:
    p.launchProjectile(Arrow.class).setCritical(true);
    3 times then?????????
     
  5. Offline

    Zombie_Striker

    @N00BHUN73R
    Or, don't violate D.R.Y and use a for loop. :p
     
    Horsey and N00BHUN73R like this.
  6. Offline

    swagbobcow

    but that will only shoot 3 arrows in the same direction at different times.

    I just want 3 arrows to be shot at the same time. One arrow should go slightly off to the left of the direction of where the player is viewing. One arrow will go directly straight. The last arrow would go slightly to the right of where the player is looking.
     
Thread Status:
Not open for further replies.

Share This Page