当前位置: 首页>>代码示例>>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;未经允许,请勿转载。