Solved Seeing why a player died

Discussion in 'Plugin Development' started by WolfMage1, Mar 23, 2017.

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

    WolfMage1

    If I have 2 players. A and B.

    Player A attacks the Creeper next to him
    as a result of Player A attacking the Creeper, the Creeper explodes killing B.
    How would I check if the way B died had something to do with A?

    Same goes for a skeleton or any other hostile Mob.
     
  2. Offline

    mehboss

    1. Store the damaged mob and the damager into a hashmap.
    2. Check on a death event if the cause was from a creeper.
    3. If so, check if the creeper has been damaged by a player 4-8 seconds prior to that + if the hashmap isn't null and/or if it contains a creeper instance.. (if 4-8 seconds has passed, set the hashmap to null)
    4. If this returns true, set the death message.
     
  3. Offline

    WolfMage1

    Yeah figured that like 10 minutes after the post, sorry for not updating you on that.

    EDIT: You should add a space before your "is scared" in your description :p
     
  4. Offline

    mehboss

    Haha :p
     
Thread Status:
Not open for further replies.

Share This Page