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

Solved Death Events

Comments in 'Plugin Development' started by applqpak, Apr 3, 2016.

  1. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Hello, I've been searching for 30 mins and I can't find anything relating to what I want.

    I think I need EntityDeathEvent for this one... So, how would I check if the entity killed is a mob or player?
    DeathRaven359 and Oneeb like this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $event->getEntity() instanceof Player?
  3. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    PHP:
    public function onDamage(EntityDamageEvent $event){
    if(
    $event->isCancelled()) return;
       if(
    $event instanceof EntityDamageByEntityEvent){
          if((
    $event->getEntity()->getHealth() - $event->getDamage()) <= 0){
             
    # Damage caused death 
          
    }
       }
    }
    DeathRaven359 and applqpak like this.
  4. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    Thanks guys.
    DeathRaven359 and Oneeb like this.
  5. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    DeathRaven359 and Primus like this.
  6. applqpak
    Offline

    applqpak Active Member Plugin Developer

    Joined:
    Dec 16, 2015
    Posts:
    284
    Plugins:
    1
    Minecraft User:
    applqpak
    DeathRaven359 likes this.

Share This Page

Advertisement