Event for Item Thrown?

Discussion in 'Plugin Development' started by zachoooo, Oct 24, 2012.

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

    zachoooo

    I looked at the JDs and couldnt find a playthrowitemevent. It looks like theres only an event for egg throws. How do I get when a player throws something like a snowball?
     
  2. Offline

    wowlover6877

    I have perfect solution!
    PHP:
        @EventHandler
        
    public void onPlayerInteract(PlayerInteractEvent e) {
            if (
    e.getPlayer().getItemInHand().getTypeId() != 383) {
                return;
            }
            if ((
    e.getAction() != Action.RIGHT_CLICK_AIR) && (e.getAction() != Action.RIGHT_CLICK_BLOCK)) {
                return;
            }
     
            
    //do what you want here
     
     
     
        
    }
    Replace "383" with whatever item id you want it to get.
     
    zachoooo likes this.
  3. Offline

    Vandrake

    Maybe...
    Code:
    public void snow(ProjectileLaunchEvent e)
        {
            if(e.getEntity() instanceof Snowball)
            {
             
            }
        }
    Idk.. I'm just a noob x.x @zachoooo
     
Thread Status:
Not open for further replies.

Share This Page