本文整理汇总了PHP中pocketmine\Player::isOnline方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::isOnline方法的具体用法?PHP Player::isOnline怎么用?PHP Player::isOnline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\Player
的用法示例。
在下文中一共展示了Player::isOnline方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onRun
/**
* @param int $currentTick
*/
public function onRun($currentTick)
{
if ($this->requester instanceof Player && $this->requester->isOnline()) {
$this->getAPI()->getServer()->getLogger()->debug(TextFormat::YELLOW . "Running EssentialsPE's TPRequestTask");
$this->getAPI()->removeTPRequest($this->requester);
}
}
示例2: onRun
/**
* @param int $currentTick
*/
public function onRun($currentTick)
{
$this->getPlugin()->getServer()->getLogger()->debug(TextFormat::YELLOW . "Running EssentialsPE's AFKKickTask");
if ($this->player instanceof Player && $this->player->isOnline() && $this->getPlugin()->isAFK($this->player) && !$this->player->hasPermission("essentials.afk.kickexempt") && time() - $this->getPlugin()->getLastPlayerMovement($this->player) >= $this->getPlugin()->getConfig()->getNested("afk.auto-set")) {
$this->player->kick("You have been kicked for idling more than " . (($time = floor($this->getPlugin()->getConfig()->getNested("afk.auto-kick"))) / 60 >= 1 ? $time / 60 . " minutes" : $time . " seconds"), false);
}
}
示例3: getValidUUID
/**
* @param Player $player
* @return null|string
*/
public function getValidUUID(Player $player)
{
$uuid = $player->getUniqueId();
if ($uuid instanceof UUID) {
return $uuid->toString();
}
// Heheheh...
$this->getLogger()->warning("Why did you give me an invalid unique id? *cries* (userName: " . $player->getName() . ", isConnected: " . $player->isConnected() . ", isOnline: " . $player->isOnline() . ", isValid: " . $player->isValid() . ")");
return null;
}
示例4: showPlayer
/**
* @param Player $player
*/
public function showPlayer(Player $player)
{
if ($player === $this) {
return;
}
unset($this->hiddenPlayers[$player->getRawUniqueId()]);
if ($player->isOnline()) {
$player->spawnTo($this);
}
}
示例5: isValid
/**
* {@inheritdoc}
* This method also checks whether the player is online.
*/
public function isValid()
{
return parent::isValid() and $this->player instanceof Player and $this->player->isOnline();
}
示例6: giveFirecracker
public function giveFirecracker(Player $player)
{
if ($player->isOnline()) {
$player->getInventory()->remove(Item::get(Item::BRICK));
$player->getInventory()->addItem(Item::get(Item::BRICK, 0, 1));
}
if (isset($this->givetask[$player->getName()])) {
$this->getServer()->getScheduler()->cancelTask($this->givetask[$player->getName()]);
unset($this->givetask[$player->getName()]);
}
}
示例7: 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;
}
}
}
}
示例8: isOnline
public function isOnline(Player $player)
{
if ($player->isOnline()) {
return true;
} else {
return false;
}
}
示例9: loadInv
public function loadInv(Player $p)
{
if (!$p->isOnline()) {
return;
}
$p->getInventory()->clearAll();
foreach ($this->plugin->inv[strtolower($p->getName())] as $slot => $i) {
list($id, $dmg, $count) = explode(":", $i);
$item = Item::get($id, $dmg, $count);
$p->getInventory()->setItem($slot, $item);
unset($this->plugin->inv[strtolower($p->getName())]);
}
}