Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

check if player is dead

Comments in 'Plugin Development' started by Creeperface, Aug 17, 2015.

  1. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    hi how when player is dead but he didnt click on respawn button so how can check it?
  2. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    656
    Plugins:
    1
    Minecraft User:
    jojoe77777
    I'm not sure, but it might be possible to check for EntityDeathEvent, if instanceof Player, check if they have fired PlayerRespawnEvent, without PlayerJoinEvent? Something like that.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    what how can i check if PlayerRespawnEvent was fired?
  4. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    656
    Plugins:
    1
    Minecraft User:
    jojoe77777
    I'm not an expert on this, but (I'm guessing) listen for EntityDeathEvent, and add the player to an array. When PlayerRespawnEvent happens, check if the player is in the array and do something... Actually now that I think about it I'm not sure it will work.
  5. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    hm it is way too but some easier? pocketmine must have saved this too
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Why should you do so? PlayerDeathEvent and PlayerRespawnEvent are completely different events.
  7. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    So can i check it?
  8. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Have you tried:
    PHP:
    if ($player->isAlive()) {
      
    $player->sendMessage("You sure are...");
    } else {
      
    $player->sendMessage("RIP!");
    }
    Where $player is a pocketmine\Player object.
    XShockinFireX and Legoboy0215 like this.

Share This Page

Advertisement