EntityDamageByEntityEvent Delima

Discussion in 'Plugin Development' started by JPG2000, Sep 25, 2013.

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

    JPG2000

    Pre Note: All of my code works. Everything fires, except one bug, that I will explain below.

    Now, if you have ever seen "Pop" on a hub server, thats what the issue is. Basicly, I have a stick that shoots a snowball, and when it hits someone it turns them invisible.

    It all works fine. Now, I use the EntityDamageByEntity event, to detect if the player was hit, and I check the damager instanceof snowball bla bla bla. When I hit someone in Creative however, it does not work. Creative players don't take damage.

    So, I need away to detect if the projectile in the ProjectileHitEvent(Or any other event that will work) hits a player. Or, if theres any other way to detect a projectile hit someone.

    Thanks! (If I didn't explain this well enough, tell me )

    Mr Burkes Why would I need to post my code? All I need is a way to detect if a player got hit by a projectile, without the EntityDamagedByEntityEvent

    Mr Burkes Your post made no sense. I explained why its not working.

    And the projectile won't make a diffirence at all.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 4, 2016
  2. Offline

    james137137

  3. Offline

    The_Doctor_123

    JPG2000
    I'd suggest trying to avoid having players creative at all costs rather than doing the other things you'd have to do..
     
  4. Offline

    JPG2000

  5. Offline

    Scyntrus

  6. Offline

    mattrick

    Sorry for asking but why are your players in creative? If its just to fly, you can just use player.allowFlight(true) in player join event :)
     
  7. Offline

    JPG2000

  8. Offline

    mattrick

    Why would you want to allow admins to be popped though? Any way you should be able to use ProjectileHitEvent.
     
  9. Offline

    JPG2000

    mattrick16 For your first post, I know how to do that. I know Bukkit.

    And like I said fourty times, is there away to detect if the projectile hit a entity int he projectile hit event?
     
  10. I'm pretty sure this is client sided. As it bounces the arrow away, And from what I see. No way to stop it bouncing, So pratically. since the hit is in creative it doesn't send the packet which then doesn't toggle the event.
     
  11. Offline

    JPG2000

    RealmsofValendor What?

    I said nothing about bouncing arrows. I tried to make this very very very clear:

    Is there away to detect if a projectile hit a entity, in the ProjectileHitEvent?
     
  12. Only possible way would be do a loop of all entities every tick, Check if its a certain projectile. then check if the projectile is close to a player. Most likely wouldn't want to do this.

    Btw, I was referring to bouncing cause its half of the whole hitting & not damaging the player in creative.
     
  13. Offline

    mattrick

    Sorry didn't read OP as well as I should. Looked in the javadoc seems as though there is no method for getting target. So you'll have to use getEntity() and then get the location of the snowball and see if there is a player there. You can probably see there is problems with that. Maybe get location within one block. Not quite sure what else there is :/
     
Thread Status:
Not open for further replies.

Share This Page