当前位置: 首页>>代码示例>>PHP>>正文


PHP PlayerDeathEvent::getEntity方法代码示例

本文整理汇总了PHP中pocketmine\event\player\PlayerDeathEvent::getEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP PlayerDeathEvent::getEntity方法的具体用法?PHP PlayerDeathEvent::getEntity怎么用?PHP PlayerDeathEvent::getEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\player\PlayerDeathEvent的用法示例。


在下文中一共展示了PlayerDeathEvent::getEntity方法的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)
 {
     foreach ($this->tntRun->arenas as $arena) {
         if ($arena->getPlayerManager()->isPlaying($event->getEntity())) {
             $arena->getPlayerHandler()->leavePlayer($event->getEntity());
             return;
         }
     }
 }
开发者ID:EmreTr1,项目名称:TNTRun,代码行数:9,代码来源:EventListener.php

示例4: 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

示例5: 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

示例6: PlayerDeathEvent

 /**
  * @param PlayerDeathEvent $event
  *
  * @priority LOWEST
  * @ignoreCancelled true
  */
 public function PlayerDeathEvent(PlayerDeathEvent $event)
 {
     if (isset($this->players[$event->getEntity()->getName()])) {
         unset($this->players[$event->getEntity()->getName()]);
         if (isset($this->tasks[$event->getEntity()->getName()])) {
             $this->getServer()->getScheduler()->cancelTask($this->tasks[$event->getEntity()->getName()]);
         }
         unset($this->tasks[$event->getEntity()->getName()]);
     }
 }
开发者ID:kdani1,项目名称:CombatLogger,代码行数:16,代码来源:Main.php

示例7: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $event->setDrops([]);
     if (isset($this->attackQueue[$event->getEntity()->getName()])) {
         $damager = $this->getServer()->getPlayerExact($this->attackQueue[$event->getEntity()->getName()]);
         if (!$damager instanceof Player) {
             return;
         }
         $amount = $this->db["payback"];
         $this->economyAPI->addMoney($damager, $amount);
         $message = str_replace("%money%", $amount, $this->get("pvpmoney-paid"));
         $this->message($damager, $message);
         unset($this->attackQueue[$event->getEntity()->getName()]);
     }
 }
开发者ID:nesgohood,项目名称:PMMP-Plugins,代码行数:15,代码来源:PVPMoney.php

示例8: 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

示例9: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $cause = $event->getEntity()->getLastDamageCause();
     if ($cause instanceof EntityDamageByEntityEvent) {
         $player = $event->getEntity();
         $killer = $event->getEntity()->getLastDamageCause()->getDamager();
         $fizz = new FizzSound($killer);
         $bat = new BatSound($player);
         $player->sendMessage(TextFormat::RED . $killer->getName() . TextFormat::GOLD . " Killed you with " . TextFormat::LIGHT_PURPLE . $killer->getHealth() . TextFormat::RED . " hearts left and while using " . TextFormat::BLUE . $killer->getInventory()->getItemInHand() . "!");
         $player->getLevel()->addSound($bat);
         if ($killer instanceof Player) {
             $killer->sendMessage(TextFormat::GREEN . "You Killed " . $player->getName() . "!");
             $killer->getLevel()->addSound($fizz);
         }
     }
 }
开发者ID:xHFx,项目名称:HealthMessageReturn,代码行数:16,代码来源:Main.php

示例10: onPlayerDeath

 public function onPlayerDeath(PlayerDeathEvent $e)
 {
     $pl = $e->getEntity();
     if (!$pl instanceof Player) {
         return;
     }
     if (!$pl->hasPermission("gb.cdeath")) {
         return;
     }
     $keepinv = $this->keepinv;
     if ($keepinv == "perms") {
         foreach (["keep", "nodrops", "default"] as $m) {
             if ($pl->hasPermission("gb.keepinv." . $m)) {
                 break;
             }
         }
     }
     switch ($keepinv) {
         case "keep":
             $e->setKeepInventory(true);
             $e->setDrops([]);
             break;
         case "nodrops":
             $e->setKeepInventory(false);
             $e->setDrops([]);
             break;
     }
 }
开发者ID:DWWf,项目名称:pocketmine-plugins,代码行数:28,代码来源:CustomDeath.php

示例11: 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

示例12: 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

示例13: onPlayerDeathEvent

 public function onPlayerDeathEvent(PlayerDeathEvent $event)
 {
     if ($event->getEntity() instanceof Player) {
         $player = $event->getEntity();
         $name = $event->getEntity()->getName();
         if ($this->allEnabled == "true") {
             $event->setKeepInventory(true);
             $player->sendMessage(TextFormat::YELLOW . "Your inventory has been saved");
         } else {
             if (in_array($name, $this->playersEnabled)) {
                 $event->setKeepInventory(true);
                 $player->sendMessage(TextFormat::YELLOW . "Your inventory has been saved");
             }
         }
     }
 }
开发者ID:Blubberboy333,项目名称:EasyKeep,代码行数:16,代码来源:Main.php

示例14: 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

示例15: onDeath

 public function onDeath(PlayerDeathEvent $event)
 {
     $this->plugin->players = $this->plugin->players - 1;
     $d = $this->plugin->points->get($event->getEntity()->getName());
     $d["deaths"] = $d["deaths"] + 1;
     $killer = $event->getEntity()->getLastDamageCause()->getCause()->getDamager();
     if ($killer instanceof Player) {
         $k = $this->plugin->points->get($killer->getName());
         $k["kills"] = $k["kills"] + 1;
     }
     $event->getEntity()->kick("Death");
     $event->setDeathMessage("[HG] " . $event->getEntity()->getName() . " died!\nThere are " . $this->plugin->players . " left.");
     if ($this->plugin->players <= 1) {
         $this->plugin->getServer()->broadcastMessage("[HG] Game ended!");
         $this->plugin->getServer()->shutdown();
     }
 }
开发者ID:linuzo,项目名称:SimpleHungerGames,代码行数:17,代码来源:EventHandler.php


注:本文中的pocketmine\event\player\PlayerDeathEvent::getEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。