structural changes for v0.2

This commit is contained in:
kremsy 2017-03-22 17:57:21 +01:00
parent df2d548755
commit 60524e9244
3 changed files with 83 additions and 24 deletions

View File

@ -26,6 +26,7 @@ use ManiaControl\Maps\MapManager;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\PluginManager; use ManiaControl\Plugins\PluginManager;
use ManiaControl\Server\ModeScriptEventManager;
use ManiaControl\Server\Server; use ManiaControl\Server\Server;
use ManiaControl\Settings\SettingManager; use ManiaControl\Settings\SettingManager;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
@ -47,11 +48,11 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/* /*
* Constants * Constants
*/ */
const VERSION = '0.166'; const VERSION = '0.200';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2014-04-02_18_00'; const MIN_DEDIVERSION = '2014-04-02_18_00';
const SCRIPT_TIMEOUT = 10; const SCRIPT_TIMEOUT = 10;
const URL_WEBSERVICE = 'https://ws.maniacontrol.com/'; const URL_WEBSERVICE = 'http://ws.maniacontrol.com/';
const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl'; const SETTING_PERMISSION_SHUTDOWN = 'Shutdown ManiaControl';
const SETTING_PERMISSION_RESTART = 'Restart ManiaControl'; const SETTING_PERMISSION_RESTART = 'Restart ManiaControl';
@ -170,9 +171,14 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
private $requestQuitMessage = null; private $requestQuitMessage = null;
/** @var EchoManager $echoManager */ /** @var EchoManager $echoManager */
private $echoManager = null; private $echoManager = null;
/** @var CommunicationManager $communicationManager */
private $communicationManager = null; private $communicationManager = null;
/** @var ModeScriptEventManager $modeScriptEventManager */
private $modeScriptEventManager = null;
/** /**
* Construct a new ManiaControl instance * Construct a new ManiaControl instance
*/ */
@ -184,26 +190,27 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
$this->loadConfig(); $this->loadConfig();
// Load ManiaControl Modules // Load ManiaControl Modules
$this->callbackManager = new CallbackManager($this); $this->callbackManager = new CallbackManager($this);
$this->echoManager = new EchoManager($this); $this->modeScriptEventManager = new ModeScriptEventManager($this);
$this->communicationManager = new CommunicationManager($this); $this->echoManager = new EchoManager($this);
$this->timerManager = new TimerManager($this); $this->communicationManager = new CommunicationManager($this);
$this->database = new Database($this); $this->timerManager = new TimerManager($this);
$this->fileReader = new AsynchronousFileReader($this); $this->database = new Database($this);
$this->billManager = new BillManager($this); $this->fileReader = new AsynchronousFileReader($this);
$this->settingManager = new SettingManager($this); $this->billManager = new BillManager($this);
$this->statisticManager = new StatisticManager($this); $this->settingManager = new SettingManager($this);
$this->manialinkManager = new ManialinkManager($this); $this->statisticManager = new StatisticManager($this);
$this->actionsMenu = new ActionsMenu($this); $this->manialinkManager = new ManialinkManager($this);
$this->chat = new Chat($this); $this->actionsMenu = new ActionsMenu($this);
$this->commandManager = new CommandManager($this); $this->chat = new Chat($this);
$this->server = new Server($this); $this->commandManager = new CommandManager($this);
$this->authenticationManager = new AuthenticationManager($this); $this->server = new Server($this);
$this->playerManager = new PlayerManager($this); $this->authenticationManager = new AuthenticationManager($this);
$this->mapManager = new MapManager($this); $this->playerManager = new PlayerManager($this);
$this->configurator = new Configurator($this); $this->mapManager = new MapManager($this);
$this->pluginManager = new PluginManager($this); $this->configurator = new Configurator($this);
$this->updateManager = new UpdateManager($this); $this->pluginManager = new PluginManager($this);
$this->updateManager = new UpdateManager($this);
$this->getErrorHandler()->init(); $this->getErrorHandler()->init();
@ -467,6 +474,13 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
return $this->billManager; return $this->billManager;
} }
/**
* @return ModeScriptEventManager
*/
public function getModeScriptEventManager() {
return $this->modeScriptEventManager;
}
/** /**
* Check connection * Check connection
*/ */
@ -699,4 +713,6 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
public function handleServerStopCallback() { public function handleServerStopCallback() {
$this->requestQuit('The Server has been shut down!'); $this->requestQuit('The Server has been shut down!');
} }
} }

View File

@ -0,0 +1,41 @@
<?php
/**
* Manager for Mode Script Events
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
namespace ManiaControl\Server;
//TODO maybe own folder
use ManiaControl\ManiaControl;
class ModeScriptEventManager {
/** @var ManiaControl $maniaControl */
private $maniaControl;
/**
* Construct a new ranking manager instance
*
* @param ManiaControl $maniaControl
*/
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
}
/**
* Enables XmlRpc Callbacks
*/
public function enableCallbacks() {
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('true'));
}
/**
* Disables XmlRpc Callbacks
*/
public function disableCallbacks() {
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('false'));
}
}

View File

@ -47,7 +47,9 @@ class ScriptManager {
return false; return false;
} }
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('true')); //TODO verify that the old S_ isnt needed anymore
$this->maniaControl->getModeScriptEventManager()->enableCallbacks();
Logger::logInfo("Script Callbacks successfully enabled!"); Logger::logInfo("Script Callbacks successfully enabled!");
return true; return true;
} }