isOnline() 공개 메소드

public isOnline ( ) : boolean
리턴 boolean
예제 #1
0
 /**
  * @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
0
 /**
  * @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
0
 /**
  * @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: "******", isConnected: " . $player->isConnected() . ", isOnline: " . $player->isOnline() . ", isValid: " . $player->isValid() . ")");
     return null;
 }
예제 #4
0
 /**
  * @param Player $player
  */
 public function showPlayer(Player $player)
 {
     if ($player === $this) {
         return;
     }
     unset($this->hiddenPlayers[$player->getRawUniqueId()]);
     if ($player->isOnline()) {
         $player->spawnTo($this);
     }
 }
예제 #5
0
 /**
  * {@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
0
 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
0
 /**
  * @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
0
 public function isOnline(Player $player)
 {
     if ($player->isOnline()) {
         return true;
     } else {
         return false;
     }
 }
예제 #9
0
 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())]);
     }
 }