public function addSpectator(Gamer $gamer, int &$fault = MatchJoinFault::SUCCESS) : bool { if (!$this->hasSpectatePermission($gamer->getPlayer())) { $fault = MatchJoinFault::NO_PERM; return false; } $this->spectators[$gamer->getId()] = $gamer; // TODO return true; }
public final function join(Gamer $gamer) { $items = $gamer->getData()->getItems($this->getName()->get()); $inv = $gamer->getPlayer()->getInventory(); $inv->clearAll(); // rude foreach ($items as $slot => $item) { $inv->setItem($slot, $item); } $this->onJoin($gamer); }
public function addSpectator(Gamer $gamer, int &$fault = MatchJoinFault::SUCCESS) : bool { if (!$this->hasSpectatePermission($gamer->getPlayer())) { $fault = MatchJoinFault::NO_PERM; return false; } if ($gamer->getModule() !== $this->game) { $fault = MatchJoinFault::NOT_IN_GAME; return false; } $this->spectators[$gamer->getId()] = $gamer; $gamer->getPlayer()->teleport($this->getMatchConfig()->getNextSpectatorJoinPosition()); return true; }