From a052037ac5a19f0adffef1154f6b8e61c23fdf9d Mon Sep 17 00:00:00 2001 From: kremsy Date: Mon, 17 Jul 2017 14:40:52 +0200 Subject: [PATCH] Fixed Missing Dedimania Inserts on Restarting Map. Resolves #158. --- core/Callbacks/LibXmlRpcCallbacks.php | 31 +++++++++++++++------------ core/ManiaControl.php | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/core/Callbacks/LibXmlRpcCallbacks.php b/core/Callbacks/LibXmlRpcCallbacks.php index 35ffaabb..0b6dd01c 100644 --- a/core/Callbacks/LibXmlRpcCallbacks.php +++ b/core/Callbacks/LibXmlRpcCallbacks.php @@ -54,6 +54,23 @@ class LibXmlRpcCallbacks implements CallbackListener { * @param mixed $data */ public function handleScriptCallback($name, $data) { + //Internal Callbacks always triggered + switch($name){ + case 'Maniaplanet.StartMap_Start': //Use the MapManager Callback + //No use for this Implementation right now (as the MapManager Callback should be used + break; + case 'Maniaplanet.StartMap_End': //Use the MapManager Callback + $jsonData = json_decode($data[0]); + $this->maniaControl->getMapManager()->handleScriptBeginMap($jsonData->map->uid, $jsonData->restarted); + break; + case 'Maniaplanet.EndMap_Start': + //no need for this implementation, callback handled by Map Manager + break; + case 'Maniaplanet.EndMap_End': //Use the MapManager Callback + $this->maniaControl->getMapManager()->handleScriptEndMap(); //Verify if better here or at EndMap_End + break; + } + if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) { return; //Leave that disabled while testing/implementing Callbacks } @@ -98,20 +115,6 @@ class LibXmlRpcCallbacks implements CallbackListener { case Callbacks::MP_ENDMATCHEND: $this->maniaControl->getCallbackManager()->triggerCallback($name, new StartEndStructure($this->maniaControl, $data)); break; - case 'Maniaplanet.StartMap_Start': //Use the MapManager Callback - //No use for this Implementation right now (as the MapManager Callback should be used - break; - case 'Maniaplanet.StartMap_End': //Use the MapManager Callback - $jsonData = json_decode($data[0]); - $this->maniaControl->getMapManager()->handleScriptBeginMap($jsonData->map->uid, $jsonData->restarted); - //TODO Test if json is correctly parsed - break; - case 'Maniaplanet.EndMap_Start': - //no need for this implementation, callback handled by Map Manager - break; - case 'Maniaplanet.EndMap_End': //Use the MapManager Callback - $this->maniaControl->getMapManager()->handleScriptEndMap(); //Verify if better here or at EndMap_End - break; case Callbacks::MP_STARTSERVERSTART: case Callbacks::MP_STARTSERVEREND: case Callbacks::MP_ENDSERVERSTART: diff --git a/core/ManiaControl.php b/core/ManiaControl.php index 7f04e540..df8b5888 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, /* * Constants */ - const VERSION = '0.225'; + const VERSION = '0.226'; const API_VERSION = '2013-04-16'; const MIN_DEDIVERSION = '2017-05-03_21_00'; const SCRIPT_TIMEOUT = 40;