/** * @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); } }
/** * @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); } }
/** * @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; }
/** * @param Player $player */ public function showPlayer(Player $player) { if ($player === $this) { return; } unset($this->hiddenPlayers[$player->getRawUniqueId()]); if ($player->isOnline()) { $player->spawnTo($this); } }
/** * {@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(); }
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()]); } }
/** * @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; } } } }
public function isOnline(Player $player) { if ($player->isOnline()) { return true; } else { return false; } }
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())]); } }