Exemplo n.º 1
0
 function onPlayerDisconnect($login, $disconnectionReason)
 {
     \ManiaLive\Utilities\Logger::debug(sprintf('Player disconnected: %s (%s)', $login, $disconnectionReason));
     $player = Services\PlayerInfo::Get($login);
     $player->setAway();
     if (array_key_exists($login, $this->blockedPlayers)) {
         $this->matchMakingService->decreasePlayerPenalty($login, time() - $this->blockedPlayers[$login], $this->storage->serverLogin, $this->scriptName, $this->titleIdString);
         unset($this->blockedPlayers[$login]);
     }
     $match = $this->matchMakingService->getPlayerCurrentMatch($login, $this->storage->serverLogin, $this->scriptName, $this->titleIdString);
     if ($match) {
         if (array_key_exists($login, $this->matchCancellers)) {
             unset($this->matchCancellers[$login]);
         }
         if (array_key_exists($match->id, $this->countDown) && $this->countDown[$match->id] > 0) {
             $this->cancelMatch($login, $match);
         }
         if (array_key_exists($login, $this->replacerCountDown) && $this->replacerCountDown[$login] > 0) {
             $this->cancelReplacement($login, $match);
         }
     }
     $this->gui->removePlayerFromPlayerList($login);
     $this->allyService->setPlayerAway($login);
 }