/** * Handles the !switch command. * * @param array $matches * * @return void */ public function handleSwitch($matches) { if ($this->map->status == 4) { $re = RoundEvent::where('map_id', $this->map->id)->where('type', 'knife_round_win')->first(); if (is_null($re)) { return; } if ($re->data->knife_winner_side == $matches[4]) { $this->handler->chat->sendMessage('Sides will be swapped.'); $this->rcon->exec('mp_swapteams;'); $this->map->status = 5; $this->map->current_side = 't'; $this->map->save(); $this->handler->cancelTimer('staySwitch'); $this->dispatch(StartWarmup::class); } } }