1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved onDeath

Discussion in 'Development' started by Notjblus, Jun 23, 2019.

  1. Notjblus

    Notjblus Spider Jockey

    Messages:
    28
    GitHub:
    JblusItsMe
    How could I prevent the drop of a player's item, for example, he gets killed, he does not drop
     
  2. KielKing

    KielKing Zombie

    Messages:
    245
    GitHub:
    kielking
    if you are listening to PlayerDeathEvent, you can set the drops of the even to nothing

    PHP:
    /**
    * @param PlayerDeathEvent $ev
    * @priority HIGHEST
    * @ignoreCancelled TRUE
    */
    public function onPlayerDeath(PlayerDeathEvent $ev): void{
        
    $ev->setDrops([]);
    }
     
  3. Notjblus

    Notjblus Spider Jockey

    Messages:
    28
    GitHub:
    JblusItsMe

    in the $ev->setDrops([]); between the hooks I do not put anything?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.