Listen for what got hit on created ProjectileLaunchEvent

Discussion in 'Plugin Development' started by MajorSkillage, Dec 3, 2015.

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

    MajorSkillage

    Basically, I made a class that represents a weapon (which also contains an ItemStack value). PlayerInteractEvent if the item in the player's hand is a weapon then create new ProjectileLaunchEvent with an egg as the entity. I need to find out what got hit in the end and another problem is I was thinking about storing the instance of the event to listen for in a listener class and comparing events to find which event however it would take quite a while to process if I were to make the ProjectileLaunchListener method synchronized, any ideas?
     
  2. Offline

    Scimiguy

    EntityDamageByEntityEvent

    Name or otherwise identify your entity, recognise it in that event, and you're done
     
  3. Offline

    Xerox262

    ProjectileHitEvent

    Wouldn't work if he was making a grenade or something because it might not hit an entity.
     
  4. Offline

    Scimiguy

    @Xerox262
    If it doesn't hit an entity, how will ProjectileHitEvent do anything?
    EntityDamageEvent, or EntityDamageByEntityEvents would catch far more abstract cases

    I guess you could indirectly find the block that it hit, can't see much more use beyond that in this case
     
  5. Offline

    MajorSkillage

    It is to call another event, GunFireEvent so it may or may not even hit a zombie, nice try though.
     
  6. Offline

    Scimiguy

  7. Offline

    MajorSkillage

    Wouldn't ProjectileLaunchEvent be better? We would want it to show that the bullet/egg is actually shooting ._.
     
  8. Offline

    Xerox262

    How do you expect to find what the bullet hit when the projectile is just being launched?
     
  9. Offline

    MajorSkillage

    Yay! Now you know why I made this read :p
     
  10. Offline

    Xerox262

    Ok then... Why do you want to know what is getting hit when it is launched? Why don't you just do the launch things in a launch listener, store the projectile's uuid then take care of the hit things in a hit listener if the uuid is stored.
     
  11. Offline

    MajorSkillage

    Great idea! Not too great with these events as they are new to me. I needed to know why so I could manage the damage done towards the zombies in my plugin. Thanks will get back to you on how it goes.
     
Thread Status:
Not open for further replies.

Share This Page