本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例4: targetOption
public function targetOption(Player $player, $distance)
{
return $player->spawned && $player->isAlive() && !$player->closed && $player->getInventory()->getItemInHand()->getId() == Item::WHEAT && $distance <= 49;
}
示例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;
}
}
}
}