Lobbing potions on playerinteract?

Discussion in 'Plugin Development' started by abmenzel, Mar 27, 2013.

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

    abmenzel

    Hello!

    I am trying to make a player lob healing potions when right clicking with a stick, how would I do this? I've made it shoot witherskull,s but I have no idea how I would make it lob potions? If it's possible, please tell me a way :)

    Code:
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event){
        Action action = event.getAction();
        Player player = event.getPlayer();
        String eventworld = player.getLocation().getWorld().getName();
        if (getConfig().getBoolean("enable")) {
            if (getConfig().getStringList("enabledworlds").contains(eventworld)) {
                if(!(action.equals(Action.RIGHT_CLICK_BLOCK) || action.equals(Action.RIGHT_CLICK_AIR))){
                    return;
                }else{
                    if(player.getInventory().getItemInHand() == null){
                        return;
                    }
                            if(player.getInventory().getItemInHand().getType() == Material.STICK){
                                Fireball fireball = event.getPlayer().launchProjectile(WitherSkull.class);
                                fireball.setVelocity(player.getLocation().getDirection().normalize().multiply(1));
     
  2. Offline

    Nitnelave

    Hemmm ... lob? What do you mean?
     
  3. Offline

    abmenzel

    I got it don't worry about it :)
     
Thread Status:
Not open for further replies.

Share This Page