Пример #1
0
 public function kick(SpleefSessionData $data, $reason, $checkPlayers = true)
 {
     if ($data->isSpectating()) {
         unset($this->specs[$data->getSession()->getUID()]);
     } elseif ($checkPlayers) {
         unset($this->players[$data->getSession()->getUID()]);
         if (count($this->players) === 1) {
             /** @var SpleefSessionData $winner */
             $winner = array_values($this->players)[0];
             $award = 16 * Settings::coinsFactor($winner->getSession());
             $this->broadcast("The match has ended. {$winner->getSession()} won the match and is awarded with {$award} coins.");
             $winner->getSession()->setCoins($coins = $winner->getSession()->getCoins() + $award);
             $winner->getSession()->tell("You now have {$coins} coins.");
             $winner->addWin();
             $this->game->getDefaultChatChannel()->broadcast("{$winner} won a match in {$this}!");
             $this->reset();
         }
         Settings::spleef_updateArenaSigns($this);
     }
     $data->quitArena();
     $data->getSession()->tell("You left {$this->config->name}: {$reason}.");
     $data->getSession()->teleport(Settings::spleef_spawn($this->game->getMain()->getServer()));
 }
Пример #2
0
 public function rebouncePlayer(SpleefSessionData $data)
 {
     if ($data->isInArena()) {
         if ($data->isSpectating()) {
             $data->getSession()->teleport($data->getArena()->getConfig()->spectatorSpawnLoc);
         } else {
             $arena = $data->getArena();
             $arena->kick($data, "you fell out of the arena");
             $arena->broadcast("{$data} has fallen!");
             $data->addLoss();
         }
     } else {
         $data->getSession()->teleport(Settings::spleef_spawn($this->getMain()->getServer()));
     }
 }