added xmlrpc structures + removed/refactored double trigger code

This commit is contained in:
kremsy 2017-04-07 23:03:56 +02:00
parent 31054d7502
commit 782d8b50e8
12 changed files with 335 additions and 114 deletions

View File

@ -36,7 +36,7 @@ interface Callbacks {
const XMLRPC_CALLBACKHELP = 'XmlRpc.CallbackHelp';
const XMLRPC_METHODSLIST = 'XmlRpc.MethodsList';
const XMLRPC_METHODHELP = 'XmlRpc.MethodHelp';
const XMLRPC_DOCUMENTATION = 'XmlRpc.MethodHelp';
const XMLRPC_DOCUMENTATION = 'XmlRpc.Documentation';
const XMLRPC_APIVERSION = 'XmlRpc.ApiVersion';
const XMLRPC_ALLAPIVERSIONS = 'XmlRpc.AllApiVersions';

View File

@ -9,7 +9,13 @@ use ManiaControl\Callbacks\Structures\ManiaPlanet\StartServerStructure;
use ManiaControl\Callbacks\Structures\NearMissStructure;
use ManiaControl\Callbacks\Structures\PlayerHitStructure;
use ManiaControl\Callbacks\Structures\ShootMania\StatusCallbackStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\ListStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\AllApiVersionsStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\ApiVersionStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\CallbackHelpStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\CallbackListStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\DocumentationStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\MethodHelpStructure;
use ManiaControl\Callbacks\Structures\XmlRpc\MethodListStructure;
use ManiaControl\ManiaControl;
/**
@ -51,40 +57,43 @@ class LibXmlRpcCallbacks implements CallbackListener {
switch ($name) {
//New callbacks
case Callbacks::XMLRPC_CALLBACKSLIST:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_CALLBACKSLIST, new ListStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_ENABLEDCALLBACKS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_ENABLEDCALLBACKS, new ListStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_DISABLEDCALLBACKS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_DISABLEDCALLBACKS, new ListStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new CallbackListStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_CALLBACKHELP:
$this->maniaControl->getCallbackManager()->triggerCallback($name, new CallbackHelpStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_APIVERSION:
//TODO
$this->maniaControl->getCallbackManager()->triggerCallback($name, new ApiVersionStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_ALLAPIVERSIONS:
//TODO
$this->maniaControl->getCallbackManager()->triggerCallback($name, new AllApiVersionsStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_DOCUMENTATION:
//TODO
$this->maniaControl->getCallbackManager()->triggerCallback($name, new DocumentationStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_METHODSLIST:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::XMLRPC_METHODSLIST, new ListStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new MethodListStructure($this->maniaControl, $data));
break;
case Callbacks::XMLRPC_METHODHELP:
//TODO
break;
case Callbacks::MP_STARTSERVERSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVERSTART, new StartServerStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTSERVEREND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVEREND, new StartServerStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTMATCHSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHSTART, new StartEndStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new MethodHelpStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTMATCHEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHEND, new StartEndStructure($this->maniaControl, $data));
case Callbacks::MP_STARTMATCHSTART:
case Callbacks::MP_STARTROUNDSTART:
case Callbacks::MP_STARTROUNDEND:
case Callbacks::MP_STARTTURNSTART:
case Callbacks::MP_STARTTURNEND:
case Callbacks::MP_STARTPLAYLOOP:
case Callbacks::MP_ENDPLAYLOOP:
case Callbacks::MP_ENDTURNSTART:
case Callbacks::MP_ENDTURNEND:
case Callbacks::MP_ENDROUNDSTART:
case Callbacks::MP_ENDROUNDEND:
case Callbacks::MP_ENDMATCHSTART:
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
@ -94,84 +103,34 @@ class LibXmlRpcCallbacks implements CallbackListener {
$this->maniaControl->getMapManager()->handleScriptBeginMap($jsonData->map->uid, 'False');
//TODO Test if json is correctly parsed
break;
case Callbacks::MP_STARTROUNDSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTROUNDSTART, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTROUNDEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTROUNDEND, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTTURNSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTTURNSTART, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTTURNEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTTURNEND, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTPLAYLOOP:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTPLAYLOOP, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDPLAYLOOP:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDPLAYLOOP, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDTURNSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDTURNSTART, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDTURNEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDTURNEND, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDROUNDSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDROUNDSTART, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDROUNDEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDROUNDEND, new StartEndStructure($this->maniaControl, $data));
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_ENDMATCHSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDMATCHSTART, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDMATCHEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDMATCHEND, new StartEndStructure($this->maniaControl, $data));
break;
case Callbacks::MP_STARTSERVERSTART:
case Callbacks::MP_STARTSERVEREND:
case Callbacks::MP_ENDSERVERSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDSERVERSTART, new StartServerStructure($this->maniaControl, $data));
break;
case Callbacks::MP_ENDSERVEREND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_ENDSERVEREND, new StartServerStructure($this->maniaControl, $data));
break;
case Callbacks::MP_LOADINGMAPSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPSTART);
$this->maniaControl->getCallbackManager()->triggerCallback($name, new StartServerStructure($this->maniaControl, $data));
break;
case Callbacks::MP_LOADINGMAPEND:
$jsonData = json_decode($data[0]);
$map = $this->maniaControl->getMapManager()->getMapByUid($jsonData->map->uid); //Verify Json
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPEND, $map);
break;
case Callbacks::MP_UNLOADINGMAPSTART:
$jsonData = json_decode($data[0]);
$map = $this->maniaControl->getMapManager()->getMapByUid($jsonData->map->uid); //Verify Json
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPSTART, $map);
$this->maniaControl->getCallbackManager()->triggerCallback($name, $map);
break;
case Callbacks::MP_LOADINGMAPSTART:
case Callbacks::MP_UNLOADINGMAPEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_LOADINGMAPEND);
break;
case Callbacks::MP_PODIUMSTART:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_PODIUMSTART);
break;
case Callbacks::MP_PODIUMEND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_PODIUMEND);
break;
case Callbacks::MP_WARMUP_START:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_WARMUP_START);
break;
case Callbacks::MP_WARMUP_END:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_WARMUP_END);
$this->maniaControl->getCallbackManager()->triggerCallback($name);
break;
case Callbacks::MP_WARMUP_STATUS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_WARMUP_STATUS, new StatusCallbackStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new StatusCallbackStructure($this->maniaControl, $data));
break;
//OLD Callbacks

View File

@ -78,82 +78,82 @@ class ShootManiaCallbacks implements CallbackListener {
switch ($name) {
//MP4 New Callbacks
case Callbacks::SM_SCORES:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_SCORES, new OnScoresStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data));
break;
case Callbacks::SM_UIPROPERTIES:
//TODO
break;
case Callbacks::SM_ONEVENTDEFAULT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONEVENTDEFAULT, new OnDefaultEventStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONSHOOT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONSHOOT, new OnShootStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnShootStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONHIT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONHIT, new OnHitStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnHitStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONNEARMISS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONNEARMISS, new OnNearMissStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnNearMissStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONARMOREMPTY:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONARMOREMPTY, new OnArmorEmptyStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnArmorEmptyStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONCAPTURE:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONCAPTURE, new OnCaptureStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCaptureStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONSHOTDENY:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONSHOTDENY, new OnShotDenyStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnShotDenyStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONCOMMAND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONCOMMAND, new OnCommandStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCommandStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONPLAYERREQUESTRESPAWN:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERREQUESTRESPAWN, new OnPlayerRequestRespawnStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerRequestRespawnStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONACTIONCUSTOMEVENT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONACTIONCUSTOMEVENT, new OnActionCustomEventStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnActionCustomEventStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONACTIONEVENT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONACTIONEVENT, new OnActionEvent($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnActionEvent($this->maniaControl, $data));
break;
case Callbacks::SM_ONPLAYERTOUCHESOBJECT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERTOUCHESOBJECT, new OnPlayerObjectStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerObjectStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONPLAYERTRIGGERSSECTOR:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERTRIGGERSSECTOR, new OnPlayerTriggersSectorStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerTriggersSectorStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONPLAYERTHROWSOBJECT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERTHROWSOBJECT, new OnPlayerObjectStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerObjectStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ONPLAYERREQUESTACTIONCHANGE:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ONPLAYERREQUESTACTIONCHANGE, new OnPlayerRequestActionChange($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnPlayerRequestActionChange($this->maniaControl, $data));
break;
case Callbacks::SM_COMBO_PAUSESTATUS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_COMBO_PAUSESTATUS, new StatusCallbackStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new StatusCallbackStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ELITE_STARTTURN:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ELITE_STARTTURN, new OnEliteStartTurnStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEliteStartTurnStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ELITE_ENDTURN:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ELITE_ENDTURN, new OnEliteEndTurnStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEliteEndTurnStructure($this->maniaControl, $data));
break;
case Callbacks::SM_JOUST_ONRELOAD:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_JOUST_ONRELOAD, new OnJoustReloadStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnJoustReloadStructure($this->maniaControl, $data));
break;
case Callbacks::SM_JOUST_SELECTEDPLAYERS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_JOUST_SELECTEDPLAYERS, new OnJoustSelectedPlayersStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnJoustSelectedPlayersStructure($this->maniaControl, $data));
break;
case Callbacks::SM_JOUST_ROUNDRESULT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_JOUST_ROUNDRESULT, new OnJoustRoundResultsStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnJoustRoundResultsStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ROYAL_POINTS:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ROYAL_POINTS, new OnRoyalPointsStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRoyalPointsStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ROYAL_PLAYERSPAWN:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ROYAL_PLAYERSPAWN, new OnRoyalPlayerSpawnStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRoyalPlayerSpawnStructure($this->maniaControl, $data));
break;
case Callbacks::SM_ROYAL_ROUNDWINNER:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::SM_ROYAL_ROUNDWINNER, new OnRoyalRoundWinnerStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnRoyalRoundWinnerStructure($this->maniaControl, $data));
break;
//Old Callbacks

View File

@ -0,0 +1,54 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the AllApiVersions Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class AllApiVersionsStructure extends BaseResponseStructure {
private $latest;
private $versions;
/**
* Construct a new Callbacks Version Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->latest = $this->getPlainJsonObject()->latest;
$this->versions = $this->getPlainJsonObject()->versions;
}
/**
* Get the Latest Version
*
* @api
* @return string
*/
public function getLatest() {
return $this->latest;
}
/**
* Get all Versions
*
* @api
* @return array
*/
public function getVersions() {
return $this->versions;
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the ApiVersion Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ApiVersionStructure extends BaseResponseStructure {
private $version;
/**
* Construct a new Callbacks Version Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->version = $this->getPlainJsonObject()->version;
}
/**
* Gets the API Version
*
* @api
* @return string version
*/
public function getVersion() {
return $this->version;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\ManiaControl;
/**
* Structure Class for the CallbackHelp Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class CallbackHelpStructure extends DocumentationStructure {
private $callbackName;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->callbackName = $this->getPlainJsonObject()->callback;
}
/**
* Gets the Name of the Method
*
* @api
* @return mixed
*/
public function getMethodName() {
return $this->callbackName;
}
}

View File

@ -3,17 +3,17 @@
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\Callbacks\Structures\Common\BaseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the List Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class ListStructure extends BaseResponseStructure {
class CallbackListStructure extends BaseResponseStructure {
/** @var array $callbacks */
private $callbacks;
@ -33,6 +33,7 @@ class ListStructure extends BaseResponseStructure {
/**
* Get Array of the Callbacks
*
* @api
* @return string[]
*/
public function getCallbacks() {

View File

@ -0,0 +1,42 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the Documentation Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class DocumentationStructure extends BaseResponseStructure {
private $documentation;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->documentation = $data[1];
}
/**
* Gets the Documentation
*
* @api
* @return string
*/
public function getDocumentation() {
return $this->documentation;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\ManiaControl;
/**
* Structure Class for the Method Help Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class MethodHelpStructure extends DocumentationStructure {
private $methodName;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->methodName = $this->getPlainJsonObject()->method;
}
/**
* Gets the Name of the Method
*
* @api
* @return mixed
*/
public function getMethodName() {
return $this->methodName;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace ManiaControl\Callbacks\Structures\XmlRpc;
use ManiaControl\Callbacks\Structures\Common\BaseResponseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the MethodList Structure Callback
*
* @api
* @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class MethodListStructure extends BaseResponseStructure {
/** @var array $callbacks */
private $methods;
/**
* Construct a new Callbacks List Structure
*
* @param ManiaControl $maniaControl
* @param array $data
*/
public function __construct(ManiaControl $maniaControl, $data) {
parent::__construct($maniaControl, $data);
$this->methods = $this->getPlainJsonObject()->methods;
}
/**
* Get Array of the Methods
*
* @api
* @return string[]
*/
public function getMethods() {
return $this->methods;
}
}

View File

@ -3,11 +3,11 @@
namespace ManiaControl\Callbacks;
use ManiaControl\Callbacks\Models\RecordCallback;
use ManiaControl\Callbacks\Structures\TrackMania\OnCommandStructure;
use ManiaControl\Callbacks\Structures\TrackMania\OnDefaultEventStructure;
use ManiaControl\Callbacks\Structures\TrackMania\OnEventStartLineStructure;
use ManiaControl\Callbacks\Structures\TrackMania\OnCommandStructure;
use ManiaControl\Callbacks\Structures\TrackMania\OnScoresStructure;
use ManiaControl\Callbacks\Structures\TrackMania\OnEventWayPointStructure;
use ManiaControl\Callbacks\Structures\TrackMania\OnScoresStructure;
use ManiaControl\ManiaControl;
use ManiaControl\Utils\Formatter;
@ -52,23 +52,23 @@ class TrackManiaCallbacks implements CallbackListener {
switch ($name) {
//MP4 New Callbacks
case Callbacks::TM_SCORES:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_SCORES, new OnScoresStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnScoresStructure($this->maniaControl, $data));
break;
case Callbacks::TM_ONEVENTDEFAULT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONEVENTDEFAULT, new OnDefaultEventStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnDefaultEventStructure($this->maniaControl, $data));
break;
case Callbacks::TM_ONEVENTSTARTLINE:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONEVENTSTARTLINE, new OnEventStartLineStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEventStartLineStructure($this->maniaControl, $data));
break;
case Callbacks::TM_ONCOMMAND:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONCOMMAND, new OnCommandStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnCommandStructure($this->maniaControl, $data));
break;
case Callbacks::TM_ONPLAYERADDED:
break;
case Callbacks::TM_ONPLAYERREMOVED:
break;
case Callbacks::TM_ONWAYPOINT:
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::TM_ONWAYPOINT, new OnEventWayPointStructure($this->maniaControl, $data));
$this->maniaControl->getCallbackManager()->triggerCallback($name, new OnEventWayPointStructure($this->maniaControl, $data));
break;
case Callbacks:: TM_ONGIVEUP:
break;

View File

@ -3,6 +3,7 @@
namespace ManiaControl\Script;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\Structures\XmlRpc\DocumentationStructure;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl;