Fixed Missing Dedimania Inserts on Restarting Map. Resolves #158.

This commit is contained in:
kremsy 2017-07-17 14:40:52 +02:00
parent dcd8404b79
commit a052037ac5
2 changed files with 18 additions and 15 deletions

View File

@ -54,6 +54,23 @@ class LibXmlRpcCallbacks implements CallbackListener {
* @param mixed $data * @param mixed $data
*/ */
public function handleScriptCallback($name, $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)) { if (!$this->maniaControl->getCallbackManager()->callbackListeningExists($name)) {
return; //Leave that disabled while testing/implementing Callbacks return; //Leave that disabled while testing/implementing Callbacks
} }
@ -98,20 +115,6 @@ class LibXmlRpcCallbacks implements CallbackListener {
case Callbacks::MP_ENDMATCHEND: case Callbacks::MP_ENDMATCHEND:
$this->maniaControl->getCallbackManager()->triggerCallback($name, new StartEndStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback($name, new StartEndStructure($this->maniaControl, $data));
break; 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_STARTSERVERSTART:
case Callbacks::MP_STARTSERVEREND: case Callbacks::MP_STARTSERVEREND:
case Callbacks::MP_ENDSERVERSTART: case Callbacks::MP_ENDSERVERSTART:

View File

@ -52,7 +52,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/* /*
* Constants * Constants
*/ */
const VERSION = '0.225'; const VERSION = '0.226';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2017-05-03_21_00'; const MIN_DEDIVERSION = '2017-05-03_21_00';
const SCRIPT_TIMEOUT = 40; const SCRIPT_TIMEOUT = 40;