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


PHP Player::isAlive方法代码示例

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


在下文中一共展示了Player::isAlive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: targetOption

 public function targetOption(Player $player, $distance)
 {
     return $player->spawned && $player->isAlive() && !$player->closed && $player->isSurvival() && $distance <= 81;
 }
开发者ID:rilex04,项目名称:EntityManager,代码行数:4,代码来源:Monster.php

示例2: spawnTo

 /**
  * @param Player $player
  */
 public function spawnTo(Player $player)
 {
     if ($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()) {
         parent::spawnTo($player);
     }
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:9,代码来源:Player.php

示例3: handlePlayerLeaveTheGame

 public function handlePlayerLeaveTheGame(Player $player)
 {
     if ($player != null) {
         foreach ($this->plugin->gameLevelManager->levels as &$lv) {
             if ($lv instanceof GameLevelModel) {
                 if (count($lv->joinedPlayers) > 0) {
                     if (isset($lv->joinedPlayers[$player->getName()])) {
                         unset($lv->joinedPlayers[$player->getName()]);
                         $this->plugin->log("[HG]gamelevelmanager handlePlayerLeaveTheGame: " . $player->getName() . " |  remains: " . count($lv->joinedPlayers));
                         if (count($lv->joinedPlayers) === 0 || count($lv->joinedPlayers) === 1) {
                             if ($lv->currentStep === GameLevelModel::STATUS_MAP_SELECTION || $lv->currentStep === GameLevelModel::STEP_WAITING) {
                                 $this->plugin->openGate($lv);
                                 $this->plugin->log("[HG] No player left in portal - reset portal state | " . $lv->type . " | " . $lv->name);
                                 $lv->joinDownCounter = $lv->joinDownCounterReset;
                                 $lv->status = GameLevelModel::STATUS_AVAILABLE;
                                 $lv->currentStep = GameLevelModel::STEP_JOINING;
                             }
                         }
                         // @FIXE ME remove votes
                         foreach ($this->plugin->arenaManager->arenas as &$arena) {
                             if ($arena instanceof MapArenaModel) {
                                 if (isset($arena->votedPlayers[$player->getName()])) {
                                     unset($arena->votedPlayers[$player->getName()]);
                                     if ($arena->vote >= 1) {
                                         $arena->vote--;
                                     }
                                     break;
                                 }
                             }
                         }
                     }
                     if (!empty($lv->currentMap)) {
                         if (isset($lv->currentMap->livePlayers[$player->getName()])) {
                             unset($lv->currentMap->livePlayers[$player->getName()]);
                             $recordloss = new HungerGamesRecordLossTask($this->plugin, $lv, $player->getName());
                             $this->plugin->getServer()->getScheduler()->scheduleDelayedTask($recordloss, 30);
                         }
                         if (isset($lv->currentMap->joinedPlayers[$player->getName()])) {
                             unset($lv->currentMap->joinedPlayers[$player->getName()]);
                         }
                         if (isset($lv->currentMap->votedPlayers[$player->getName()])) {
                             unset($lv->currentMap->votedPlayers[$player->getName()]);
                         }
                         break;
                     }
                 }
             }
         }
     }
     // @FIXME
     if (!empty($player->getInventory() && $player->isAlive())) {
         HungerGameKit::clearAllInventories($player);
     }
 }
开发者ID:robozeri,项目名称:SG,代码行数:54,代码来源:GameLevelManager.php

示例4: targetOption

 public function targetOption(Player $player, $distance)
 {
     return $player->spawned && $player->isAlive() && !$player->closed && $player->getInventory()->getItemInHand()->getId() == Item::WHEAT && $distance <= 49;
 }
开发者ID:rilex04,项目名称:EntityManager,代码行数:4,代码来源:Cow.php

示例5: getKiller

 /**
  * @param Player $level
  * @return Player $killer
  */
 public function getKiller(Player $player)
 {
     if ($player->isOnline() && !$player->isAlive()) {
         $cause = $player->getLastDamageCause();
         if ($cause instanceof EntityDamageByEntityEvent) {
             $killer = $cause->getDamager();
             if ($killer->isOnline() && $killer instanceof Player) {
                 return $killer;
             }
         }
     }
 }
开发者ID:gitter-badger,项目名称:Development-1,代码行数:16,代码来源:SAPI.php


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