Solved Detect the entity an arrow hit whilst pvp is disabled.

Discussion in 'Plugin Development' started by MrMag518, Oct 26, 2013.

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

    MrMag518

    I have tried to figure out how to detect which entity an arrow shot by a player hits, it works when pvp is enabled, because the EntityDamageByEntity event is being fired. However, when pvp is disabled, that event is never fired.

    The ProjectileHitEvent seem to be useless. It's fired when the arrow hits something or someone, but you can't really obtain what without using tricky methods.

    So I was wondering whether anyone knows a way to detect this?
     
  2. Offline

    Aengo

    When you say PvP being disabled, do you mean as a gamerule or something else?
     
  3. Offline

    MrMag518

    As in disabling it in the server properties.
     
  4. Offline

    Aengo

    Mmh, you'll have to make your own event then I believe.
     
  5. Offline

    lzravanger

    You can probably use the direction and velocity of the arrow to determine who it will hit. It will definitely be tricky though.
     
  6. Offline

    PatoTheBest

    I don't know if you enable pvp and on worldguard /region flag __global__ pvp deny will work.
     
    MrMag518 likes this.
  7. Offline

    MrMag518

    I just did that right before you replied :p It works perfect =)
     
Thread Status:
Not open for further replies.

Share This Page