當前位置: 首頁>>代碼示例>>PHP>>正文


PHP player\PlayerDeathEvent類代碼示例

本文整理匯總了PHP中pocketmine\event\player\PlayerDeathEvent的典型用法代碼示例。如果您正苦於以下問題:PHP PlayerDeathEvent類的具體用法?PHP PlayerDeathEvent怎麽用?PHP PlayerDeathEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PlayerDeathEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onPlayerDeath

 /**
  * @priority LOW
  */
 public function onPlayerDeath(PlayerDeathEvent $e)
 {
     list($timer, $msg) = $this->getState($e->getEntity(), [0, ""]);
     if (time() - $timer > 1) {
         return;
     }
     $e->setDeathMessage($msg);
     $this->unsetState($e->getEntity());
 }
開發者ID:Gabriel865,項目名稱:pocketmine-plugins,代碼行數:12,代碼來源:CmdSlay.php

示例2: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     if ($player instanceof Player) {
         $name = $player->getName();
         $level = $player->getLevel()->getName();
         $disabledWorlds = $this->getConfig()->getNested("go-to-server-spawn-on-death");
         foreach ($disabledWorlds as $disabledWorld) {
             if ($disabledWorld === $level) {
                 return;
             } else {
                 $this->temp->setNested("{$name}", $level);
                 $this->temp->save();
             }
         }
     }
 }
開發者ID:HerO-0110,項目名稱:PerWorldDeath,代碼行數:17,代碼來源:PerWorldDeath.php

示例3: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $this->clearjoin = $this->getConfig()->get("Clear on Death");
     if ($this->clearjoin == true) {
         $event->setDrops(array(Item::get(0, 0, 0)));
     }
 }
開發者ID:Pocket-GAD,項目名稱:PocketMine-MP-Plugins,代碼行數:7,代碼來源:Main.php

示例4: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     if ($this->plugin->isActive($player)) {
         $this->plugin->removeActive($player);
     }
 }
開發者ID:HeroGamingZ,項目名稱:PocketMine-MP-Plugins,代碼行數:7,代碼來源:EventListener.php

示例5: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $player = $event->getEntity();
     if (Main::isActive($player)) {
         Main::removeActive($player);
     }
 }
開發者ID:Pocket-GAD,項目名稱:PocketMine-MP-Plugins,代碼行數:7,代碼來源:EventListener.php

示例6: onPlayerDeathEvent

 public function onPlayerDeathEvent(PlayerDeathEvent $event)
 {
     $cfg = $this->getConfig();
     $duration = $cfg->get("Duration");
     $particles = $cfg->get("Particles");
     $amplifier = $cfg->get("Amplifier");
     $give = $cfg->get("Add-Money");
     $lose = $cfg->get("Lost-Money");
     $id = $cfg->get("Effect-ID");
     $effect = Effect::getEffect($id);
     $effect->setVisible($particles);
     $effect->setAmplifier($amplifier);
     $effect->setDuration($duration);
     $player = $event->getEntity();
     $name = strtolower($player->getName());
     if ($player instanceof Player) {
         $cause = $player->getLastDamageCause();
         if ($cause instanceof EntityDamageByEntityEvent) {
             $damager = $cause->getDamager();
             if ($damager instanceof Player) {
                 $damager->sendMessage("You killed " . $player . ".\nYou earn \$" . $give . " for getting a kill and an effect!");
                 $damager->addEffect($effect);
                 $this->money->addMoney($damager, $give);
                 $player->sendMessage("You were killed by " . $damager);
                 $this->money->reduceMoney($player, $lose);
             }
         }
     }
 }
開發者ID:betausing,項目名稱:Private-Plugins,代碼行數:29,代碼來源:Main.php

示例7: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $cfg = $this->getConfig();
     $enable = $cfg->get("enable");
     if ($event->getEntity() instanceof Player and $enable !== true) {
         $event->setDrops([]);
     }
 }
開發者ID:somenabzofturtles,項目名稱:Small-PM-Plugins,代碼行數:8,代碼來源:Main.php

示例8: onDeath

 public function onDeath(PlayerDeathEvent $ev)
 {
     $p = $ev->getEntity();
     if (!$p instanceof Player) {
         return;
     }
     $this->setState($p, [$p->getX(), $p->getY(), $p->getZ(), $p->getLevel()->getName()]);
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:8,代碼來源:CmdTpBack.php

示例9: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     if (!$this->killedByBlock) {
         return;
     }
     $this->killedByBlock = false;
     $event->setDeathMessage(null);
     $this->getServer()->broadcastMessage($this->getCustomMessage($event->getEntity()));
 }
開發者ID:Redsnow132,項目名稱:KillBlock,代碼行數:9,代碼來源:KillBlock.php

示例10: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     foreach ($this->tntRun->arenas as $arena) {
         if ($arena->getPlayerManager()->isPlaying($event->getEntity())) {
             $arena->getPlayerHandler()->leavePlayer($event->getEntity());
             return;
         }
     }
 }
開發者ID:EmreTr1,項目名稱:TNTRun,代碼行數:9,代碼來源:EventListener.php

示例11: onPlayerDeathEvent

 public function onPlayerDeathEvent(PlayerDeathEvent $event)
 {
     $message = $event->getDeathMessage();
     if ($message instanceof TranslationContainer) {
         $message = $this->getServer()->getLanguage()->translateString($message->getText(), $message->getParameters());
     }
     AnnounceSystem::getInstance()->pushBroadCastPopup($message, 2);
     $event->setDeathMessage(null);
 }
開發者ID:organization,項目名稱:AnnounceClear,代碼行數:9,代碼來源:AnnounceClear.php

示例12: onDeath

 /**
  * @priority MONITOR
  */
 public function onDeath(PlayerDeathEvent $ev)
 {
     $player = $ev->getEntity();
     if (!$player instanceof Player) {
         return;
     }
     for ($i = 0; $i < 20; $i++) {
         $player->getLevel()->addParticle(new DustParticle(self::randVector($player), mt_rand() / mt_getrandmax() * 2, 0, 64, 0));
     }
 }
開發者ID:DWWf,項目名稱:pocketmine-plugins,代碼行數:13,代碼來源:BloodMgr.php

示例13: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $deadPlayer = $event->getEntity();
     $arena = $this->arenaManager->getPlayerArena($deadPlayer);
     if ($arena != NULL) {
         $event->setDrops([]);
         $event->setKeepInventory(false);
         $arena->onPlayerDeath($deadPlayer);
     }
 }
開發者ID:imjayl,項目名稱:pocketmine-1vs1-plugin,代碼行數:10,代碼來源:EventsManager.php

示例14: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $event)
 {
     $p = $event->getEntity();
     $pos = $event->getEntity()->getPosition();
     if ($pos->y <= 0) {
         $pos->add(0, -$pos->y, 0);
     }
     $pos->add(0, 1, 0);
     $p->setSpawn($pos);
 }
開發者ID:Skull3x,項目名稱:MineBlock,代碼行數:10,代碼來源:DeathPointSpawnPoint.php

示例15: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     if ($event->getEntity()->getLastDamageCause() instanceof EntityDamageByEntityEvent) {
         $killer = $event->getEntity()->getLastDamageCause()->getDamager();
         if ($killer instanceof Player) {
             $this->plugin->updatePlayer($event->getEntity(), "deaths");
             $this->plugin->updatePlayer($killer, "kills");
         }
     }
 }
開發者ID:Pocket-GAD,項目名稱:PocketMine-MP-Plugins,代碼行數:10,代碼來源:EventListener.php


注:本文中的pocketmine\event\player\PlayerDeathEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。