Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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;
 }