TrackManiaControl/core/Maps/MapActions.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2014-05-09 11:58:33 +02:00
<?php
namespace ManiaControl\Maps;
use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
2014-05-09 11:58:33 +02:00
/**
* ManiaControl Map Actions Class
2014-05-09 11:58:33 +02:00
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class MapActions {
/*
* Private properties
2014-05-09 11:58:33 +02:00
*/
/** @var ManiaControl $maniaControl */
2014-05-09 11:58:33 +02:00
private $maniaControl = null;
/**
* Construct a map actions instance
2014-05-09 11:58:33 +02:00
*
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
}
/**
* Skip the current Map
2014-05-09 11:58:33 +02:00
*/
public function skipMap() {
// Force an EndMap on the MapQueue to set the next Map
2014-08-13 11:05:52 +02:00
$this->maniaControl->getMapManager()->getMapQueue()->endMap(null);
2014-05-09 11:58:33 +02:00
// Ignore EndMap on MapQueue
2014-08-13 11:05:52 +02:00
$this->maniaControl->getMapManager()->getMapQueue()->dontQueueNextMapChange();
2014-05-09 11:58:33 +02:00
// Switch The Map
2014-05-09 11:58:33 +02:00
try {
2014-08-13 11:05:52 +02:00
$this->maniaControl->getClient()->nextMap();
2014-05-09 11:58:33 +02:00
} catch (ChangeInProgressException $e) {
}
}
2014-06-23 16:04:00 +02:00
}