getEntity() публичный Метод

public getEntity ( ) : Living
Результат pocketmine\entity\Living
Пример #1
0
 public function onPlayerDeath2(EntityDeathEvent $event)
 {
     $entity = $event->getEntity();
     $cause = $entity->getLastDamageCause();
     $killer = $cause->getDamager();
     if ($killer instanceof Player and $entity instanceof Player) {
         $killer->sendMessage(str_replace(array("{player}"), array($entity->getName()), $this->plugin->system["messages"]["whenKill"]));
         $entity->sendMessage(str_replace(array("{killer}"), array($killer->getName()), $this->plugin->system["messages"]["whenDeath"]));
         $this->plugin->prepareStat($entity->getName());
         $this->plugin->prepareStat($killer->getName());
         $username = mb_strtolower($entity->getName());
         $entity->plugin->stats[$username]["death"] = $this->plugin->stats[$username]["death"] + 1;
         $username = mb_strtolower($killer->getName());
         $entity->plugin->stats[$username]["kill"] = $this->plugin->stats[$username]["kill"] + 1;
         $entity->plugin->stats[$username]["money"] = $this->plugin->stats[$username]["money"] + $this->plugin->system["moneyAdd"];
         $levelUp = $this->plugin->processGiveExp($username);
         $killer->sendMessage(str_replace("{exp}", $this->plugin->system["expAdd"], $this->plugin->system["messages"]["gotExp"]));
         if ($levelUp != 0) {
             $killer->sendMessage(str_replace("{level}", $this->plugin->stats[$username]["level"], $this->plugin->system["messages"]["levelUp"]));
         }
     }
 }
Пример #2
0
 public function MobDeath(EntityDeathEvent $event)
 {
     //var_dump("death");
     $entity = $event->getEntity();
     if ($entity instanceof Zombie) {
         $eid = $entity->getID();
         if (isset($this->zombie[$eid])) {
             unset($this->zombie[$eid]);
         }
     }
     if ($entity instanceof Creeper) {
         $eid = $entity->getID();
         if (isset($this->Creeper[$eid])) {
             unset($this->Creeper[$eid]);
         }
     }
 }
Пример #3
0
 public function onDeath(EntityDeathEvent $e)
 {
     $player = $e->getPlayer();
     $effect = Effect::Blindness;
     $duration = 1;
     $amplifier = 1;
     if ($e->getEntity() instanceof Player && $gamephase == 1 && isInArena($e->getEntity())) {
         $this->respawn = true;
         $player->setCancelled();
         $player->setGamemode(3);
         $player->addEffect($effect);
         $player->setDuration($duration);
         $player->setAmplifier($amplifier);
         $player->setVisibility(true);
     }
 }
Пример #4
0
 /**
  * @priority MONITOR
  */
 public function onDeath(EntityDeathEvent $e)
 {
     //echo __METHOD__.",".__LINE__."\n";//##DEBUG
     $this->deadDealer($e->getEntity());
 }
Пример #5
0
 public function AllDeath(EntityDeathEvent $event)
 {
     $entity = $event->getEntity();
     //if ($entity instanceof Zombie) {
     $eid = $entity->getID();
     if (isset($this->animals[$eid])) {
         $ani =& $this->animals[$eid];
         if (in_array($ani['type'], $this->daytype)) {
             $this->animal_A = $this->animal_A - 1;
             //var_dump($this->animal_A);
             unset($this->animals[$eid]);
         } else {
             $this->mob_A = $this->mob_A - 1;
             unset($this->animals[$eid]);
         }
         $ok = mt_rand(0, 100);
         if ($ok < 30) {
             //掉骨头
             $drop = array(new Item(352));
         } elseif ($ok >= 30 and $ok < 50) {
             //掉羽毛
             $drop = array(new Item(288));
         } elseif ($ok >= 50 and $ok < 60) {
             //掉胡萝卜
             $drop = array(new Item(391));
         } elseif ($ok >= 60 and $ok < 70) {
             //掉土豆
             $drop = array(new Item(392));
         } elseif ($ok >= 70 and $ok < 75) {
             //掉蜘蛛丝
             $drop = array(new Item(287));
         } elseif ($ok >= 75 and $ok < 80) {
             //掉石英
             $drop = array(new Item(406));
         } elseif ($ok >= 80 and $ok < 85) {
             //掉铁锭
             $drop = array(new Item(265));
         } elseif ($ok >= 85 and $ok < 90) {
             //掉金锭
             $drop = array(new Item(266));
         } elseif ($ok >= 90 and $ok < 95) {
             //掉甘蔗
             $drop = array(new Item(338));
         } elseif ($ok >= 95 and $ok < 100) {
             //掉萤石粉
             $drop = array(new Item(348));
         } elseif ($ok == 100) {
             //掉钻石
             $drop = array(new Item(264));
         } else {
             $drop = array();
         }
         $event->setDrops($drop);
     }
 }
Пример #6
0
 public function playerDead(EntityDeathEvent $event)
 {
     $this->playerRespawn($event->getEntity());
 }
Пример #7
0
 public function onEntityDeathEvent(EntityDeathEvent $event)
 {
     if ($event->getEntity()->getLastDamageCause() instanceof EntityDamageByEntityEvent) {
         $exp = $event->getEntity()->getMaxHealth() / 4;
         $exp += mt_rand(1, 3);
         ExperienceSystem::dropExpOrb($event->getEntity(), $exp);
     }
 }
Пример #8
0
 public function EntityDeathEvent(EntityDeathEvent $ev)
 {
     $entity = $ev->getEntity();
     if (!$entity instanceof BaseEntity or !isset(self::$drops[$entity::NETWORK_ID])) {
         return;
     }
     $drops = [];
     foreach (self::$drops[$entity::NETWORK_ID] as $key => $data) {
         if (!isset($data[0]) || !isset($data[1]) || !isset($data[2])) {
             unset(self::$drops[$entity::NETWORK_ID][$key]);
             continue;
         }
         $count = explode(",", $data[2]);
         $item = Item::get($data[0], $data[1]);
         $item->setCount(max(mt_rand(...$count), 0));
         $drops[] = $item;
     }
     $ev->setDrops($drops);
 }
Пример #9
0
 public function onPlayerDeath2(EntityDeathEvent $event)
 {
     $entity = $event->getEntity();
     $cause = $entity->getLastDamageCause();
     $killer = $cause->getDamager();
 }
Пример #10
0
 /**
  * @priority MONITOR
  */
 public function onDeath(EntityDeathEvent $e)
 {
     $this->deadDealer($e->getEntity());
 }
 /**
  * @param PlayerDeathEvent $event
  */
 public function onPlayerDeath(EntityDeathEvent $event)
 {
     // player held the flag until death
     if ($event->getEntity() instanceof Player) {
         $this->getManager()->handlePlayerQuit($event->getEntity());
     }
 }
Пример #12
0
 public function ZombieDeath(EntityDeathEvent $event)
 {
     //死亡移除数组
     //var_dump($event->getEntity()->getId());
     @($founded = array_search($event->getEntity()->getId(), $this->zombie));
     //得到玩家名在玩家列表中的键值
     //var_dump($founded);
     if ($founded !== false) {
         array_splice($this->zombie, $founded, 1);
         //移除此键值的数据
         //var_dump($this->zombie);
     }
 }
Пример #13
0
 public function onDeath(EntityDeathEvent $event)
 {
     $player = $event->getEntity();
     foreach ($this->getConfig()->get("Arenas") as $arena => $g) {
         if ($player->getLevel()->getName() === $g["world"]) {
             foreach ($this->getServer()->getLevelByName($g["world"])->getPlayers() as $p) {
                 $name = $player->getName();
                 $p->sendMessage(TextFormat::DARK_GRAY . "{$name} è morto/a!");
             }
         }
     }
 }
Пример #14
0
 public function EntityDeathEvent(EntityDeathEvent $ev)
 {
     $entity = $ev->getEntity();
     if (!$entity instanceof BaseEntity or !isset(self::$drops[$entity::NETWORK_ID])) {
         return;
     }
     $drops = [];
     foreach (self::$drops[$entity::NETWORK_ID] as $data) {
         $item = Item::get($data[0], $data[1]);
         $item->setCount(mt_rand(...explode(",", $data[2])));
         $rand = explode("/", $data[3]);
         if (mt_rand(...$rand) <= $rand[0]) {
             $drops[] = $item;
         }
     }
     $ev->setDrops($drops);
 }
Пример #15
0
 public function onEntityDeathEvent(EntityDeathEvent $event)
 {
     if ($event->getEntity() instanceof DummyEntity) {
         $this->getDummySystem()->deleteDummy($event->getEntity()->getName());
     }
 }