Quickshot

Discussion in 'Plugin Development' started by BladdonB, May 25, 2015.

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

    BladdonB

    I am making a KitPvp plugin and I want to make a ranger class. How do I make it shoot a bunch of arrows, or like you dont need to charge up your bow, and what about just shooting faster ? Quickshot is what I think its called. Thank You!
     
  2. Offline

    I Al Istannen

    @BladdonB Check in the playerInteract event if the player has a bow in his hand and arrows in his Inventory. Then remove one arrow, launch an arrow (player.launchProjectile I think it was called) and maybe add a coolown so that the player can't shoot too fast.
     
  3. Offline

    BladdonB

    Im new to coding and I still don't know everything to coding and when I make this plugin it helps me learn new things, do you think you can show me an example?
     
  4. Offline

    CrystallFTW

    @BladdonB
    Code:
        @EventHandler
        public void onBowClick(PlayerInteractEvent e){
            Player p = e.getPlayer();
           
            if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
                if(p.getItemInHand().getType() == Material.BOW){
                    Arrow ar = p.launchProjectile(Arrow.class);
                    ar.setVelocity(p.getLocation().getDirection().multiply(2));
                }
           
            }
           
        }
     
  5. Offline

    BladdonB

    Thank you! I will look more into it!
     
  6. Offline

    Zombie_Striker

    @BladdonB
    Mark as solved if solved.

    If you're new to Java, then please learn Java before you continue.

    If you know Java and don't know Bukkit, then look here:
    http://docs.codelanx.com/Bukkit/1.7.10/
    And find the event/class you want and look at all of it's methods.
     
  7. Offline

    nverdier

Thread Status:
Not open for further replies.

Share This Page