Get player who threw snowball to block

Discussion in 'Plugin Development' started by rcth, Aug 5, 2013.

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

    rcth

    Hello,

    I want to make a plugin, which interacts when a player throw a snowball at a specific block (like lapis). When a snowball hit that specific block, the plugin should get the player who threw it and then interact with it.

    Is this possible and if so, any hints, so I can get started?

    Thanks.
     
  2. Offline

    AmShaegar

    To get the "shooter" of the snowball is no problem but the block the snoball hits is. I tried that once but I failed :-/
     
  3. Offline

    ThunderWaffeMC

    Use "ProjectileLaunchEvent" and get the 'Entity' (player in this case) who is involved. Check if the projectile shot was a snowball.
    Then use "ProjectileHitEvent" and get the block/entity that was hit.

    Edit: as AmShaegar says, I did take a look at getting the block that was involved and it doesn't seem possible. It only looks like you can get the entity that was involved.
     
  4. Offline

    thecrystalflame

    not an easy task, it is possible but not something you could write up in a few minutes. You would need to calculate the snowballs trajectory and find the first block it hits, then check wether or not it is a lapis block etc
     
  5. Offline

    AmShaegar

    Sadly, the ProjectileHitEvent does not have a getHitBlock() method.
     
  6. Offline

    rcth

    Thank you for all these answers. I will try something.

    I know it's possible, because I know someone did it.
     
  7. Offline

    Samthelord1

    If you were to use get target block you'd have to use some calculating and stuff :/
     
Thread Status:
Not open for further replies.

Share This Page