Lightning hitting player/entity event?

Discussion in 'Plugin Development' started by AbeJ, Oct 1, 2011.

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

    AbeJ

    Is there an event triggered when lightning strikes a player or entity? I need to get that information. There doesn't seem to be an easy way to do this. Does anyone know how?

    Edit: Never mind, I found out how. Untested, but it should work.

    Code:
    List entities = e.getLightning().getNearbyEntities(2, 2, 2);
    Player struckPlayer = (Player)entities.get(0);
     
  2. Offline

    Okapi

    A LightningStrikeEvent gets casted when lightning strikes.
     
  3. Offline

    AbeJ

    I understand that, but how do I get the entity that it struck (if there is one)?

    Never mind, I figured it out.
     
Thread Status:
Not open for further replies.

Share This Page