advanced callback structure
This commit is contained in:
@ -13,6 +13,8 @@ namespace ManiaControl\Server;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
class ModeScriptEventManager {
|
||||
const API_VERSION = "2.0.0";
|
||||
|
||||
/** @var ManiaControl $maniaControl */
|
||||
private $maniaControl;
|
||||
|
||||
@ -31,12 +33,11 @@ class ModeScriptEventManager {
|
||||
public function enableCallbacks() {
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.EnableCallbacks', array('true'));
|
||||
|
||||
$this->setApiVersion();
|
||||
$this->setApiVersion(self::API_VERSION);
|
||||
|
||||
$this->getAllApiVersions();
|
||||
|
||||
$this->getCallbacksList(); //TODO verify why this does not work
|
||||
var_dump("test");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,7 +59,7 @@ class ModeScriptEventManager {
|
||||
* Sets the Api Version
|
||||
* @param string $version
|
||||
*/
|
||||
public function setApiVersion($version = "1.2.3-beta.4.5.6+build789"){ //TODO constant of API Versions
|
||||
public function setApiVersion($version = self::API_VERSION){
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.SetApiVersion', array($version));
|
||||
}
|
||||
|
||||
|
@ -44,17 +44,15 @@ class ScriptManager {
|
||||
try {
|
||||
$scriptSettings = $this->maniaControl->getClient()->getModeScriptSettings();
|
||||
} catch (GameModeException $e) {
|
||||
var_dump("test");
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO remove later, than only the last 2 lines are needed in future
|
||||
if (!array_key_exists('S_UseScriptCallbacks', $scriptSettings)) {
|
||||
return false;
|
||||
if (array_key_exists('S_UseScriptCallbacks', $scriptSettings)) {
|
||||
$scriptSettings['S_UseScriptCallbacks'] = true;
|
||||
$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings);
|
||||
}
|
||||
$scriptSettings['S_UseScriptCallbacks'] = true;
|
||||
$this->maniaControl->getClient()->setModeScriptSettings($scriptSettings);
|
||||
|
||||
|
||||
|
||||
$this->maniaControl->getModeScriptEventManager()->enableCallbacks();
|
||||
Logger::logInfo("Script Callbacks successfully enabled!");
|
||||
|
Reference in New Issue
Block a user