2014-05-09 11:58:33 +02:00
|
|
|
<?php
|
2014-05-13 16:40:05 +02:00
|
|
|
|
|
|
|
namespace ManiaControl\Maps;
|
|
|
|
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
|
|
|
|
|
2014-05-09 11:58:33 +02:00
|
|
|
/**
|
2014-07-25 16:28:47 +02:00
|
|
|
* ManiaControl Map Actions Class
|
2014-05-09 11:58:33 +02:00
|
|
|
*
|
|
|
|
* @author ManiaControl Team <mail@maniacontrol.com>
|
2015-01-19 11:06:20 +01:00
|
|
|
* @copyright 2014-2015 ManiaControl Team
|
2014-05-09 11:58:33 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
|
|
|
*/
|
|
|
|
class MapActions {
|
|
|
|
/*
|
2014-07-25 16:28:47 +02:00
|
|
|
* Private properties
|
2014-05-09 11:58:33 +02:00
|
|
|
*/
|
2014-08-02 22:31:46 +02:00
|
|
|
/** @var ManiaControl $maniaControl */
|
2014-05-09 11:58:33 +02:00
|
|
|
private $maniaControl = null;
|
|
|
|
|
|
|
|
/**
|
2014-07-25 16:28:47 +02:00
|
|
|
* Construct a map actions instance
|
2014-05-09 11:58:33 +02:00
|
|
|
*
|
|
|
|
* @param ManiaControl $maniaControl
|
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-07-25 16:28:47 +02:00
|
|
|
* Skip the current Map
|
2014-05-09 11:58:33 +02:00
|
|
|
*/
|
|
|
|
public function skipMap() {
|
2014-08-03 01:34:18 +02:00
|
|
|
// 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
|
|
|
|
2014-08-03 01:34:18 +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
|
|
|
|
2014-08-03 01:34:18 +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
|
|
|
}
|