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

Death No Drops

Comments in 'Plugin Development' started by GamesLoad, Jun 16, 2015.

  1. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    How can I not be dropping objects when he dies
    this is my code
    PHP:
    <?php

    namespace sky-pocket;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerDeathEvent;

    class 
    Main extends PluginBase implements Listener 
    {
     public function 
    onEnable()
     {
       
    $this->getServer()->getPluginManager()->registerEvents($this$this);
       
    $this->getLogger()->info("DeathNoDrops has been enabled");
     }  
     public function 
    onDeath(PlayerDeathEvent $event)
     {
       if(
    $event->getEntity() instanceof Player){
           
    $event->getDrops()->clear();  
         }
       
       
     }
    }
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This is PocketMine, not Bukkit...

    PHP:
    $event->setDrops([]);
    Creeperface and SpiderPig like this.
  3. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    after I did setdrops how do I delete them?
  4. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    You set drop to drop noting...
    $event->setDrops(array());
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    [] is the short syntax for array(), which means an empty array.
  6. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    :D

Share This Page

Advertisement