public function sendMessage($message, $level = self::CHAT_ADMIN) { $fs = true; if ($level === self::CHAT_ALL) { $inbox = Main::getStatsCore($this->main->getServer())->getOfflineInbox(); foreach ($this->getMembers() as $member) { if (($p = $this->getMain()->getServer()->getPlayerExact($member)) instanceof Player) { $p->sendMessage("[PF] {$message}"); } else { $inbox->addMessage($this->getMain(), $member, "[PF] {$message}"); } } } foreach ($this->getMain()->getServer()->getOnlinePlayers() as $player) { $rank = $this->getMemberRank($player); if ($rank instanceof Rank and $rank->hasPerm($level)) { $player->sendMessage("[{$this}] {$message}"); } if ($player->getName() === $this->founder) { $fs = false; } } if ($fs) { Main::getStatsCore($this->main->getServer())->getOfflineInbox()->addMessage($this->main, $this->founder, $message); } }
public function __construct($res, Main $main, $isAsync = true) { $this->res = $res; $this->main = $main; $this->onPreRun(); if (!$isAsync) { $this->onRun(); $this->onCompletion($main->getServer()); } }
public function __construct($res, callable $onFinished, callable $statesSetter, Main $main, $isAsync = true) { $this->res = $res; $this->onFinished = $onFinished; $this->statesSetter = $statesSetter; $this->main = $main; if (!$isAsync) { $this->onRun(); $this->onCompletion($main->getServer()); } }