Snowball event

Discussion in 'Plugin Development' started by Fhbgsdhkfbl, Apr 12, 2014.

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

    Fhbgsdhkfbl

    Hey bukkit forums, I was wondering ,
    is it possible, that there is an event for when a snowball is thrown and when it hits ANYTHING, it will pop out fireworks?


    Regards, Fhbgsdhkfbl
     
  2. Offline

    Fhbgsdhkfbl

    AdamQpzm
    Can you help me out with it? I don't know how to start it or anything
     
  3. Offline

    TheHandfish

    Here's an example of "on snowball hit event" method. I haven't tested this as I'm on an iPad, so I'll have to do so a little later. Try it and tell me if there are any errors.

    Code:javascript
    1.  
    2. public static void onHit(ProjectileHitEvent, event)
    3. {
    4. Entity pro = event.getProjectile();
    5. if(pro instanceof Snowball)
    6. {
    7. pro.getServer().broadcastMessage("Snowball hit!") // You can remove this if you'd like. If the message does not show when a snowball breaks, there must be something wrong with this code.
    8. // Do whatever you want to do when the snowball hits a block.
    9. }
    10. }
    11.  
     
Thread Status:
Not open for further replies.

Share This Page