From 7c01319a4ab090cc503aeac13a9ea4af85835eb1 Mon Sep 17 00:00:00 2001 From: kremsy Date: Fri, 24 Mar 2017 17:08:27 +0100 Subject: [PATCH] added callback names --- core/Callbacks/Callbacks.php | 32 +++++++++++++++++-- core/Callbacks/LibXmlRpcCallbacks.php | 4 +++ .../ManiaPlanet/StartEndStructure.php | 31 ++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 core/Callbacks/Structures/ManiaPlanet/StartEndStructure.php diff --git a/core/Callbacks/Callbacks.php b/core/Callbacks/Callbacks.php index 579b8245..f15ae0d6 100644 --- a/core/Callbacks/Callbacks.php +++ b/core/Callbacks/Callbacks.php @@ -30,9 +30,35 @@ interface Callbacks { */ //NEW Callbacks - const XMLRPC_CALLBACKSLIST = 'Callbacks.XmlRpcCallbacksList'; - const MP_STARTSERVERSTART = 'Callbacks.ManiaPlanetStartServerStart'; - const MP_STARTSERVEREND = 'Callbacks.ManiaPlanetStartServerStart'; + const XMLRPC_CALLBACKSLIST = 'Callbacks.XmlRpcCallbacksList'; + const MP_STARTSERVERSTART = 'Callbacks.ManiaPlanetStartServerStart'; + const MP_STARTSERVEREND = 'Callbacks.ManiaPlanetStartServerEnd'; + const MP_STARTMATCHSTART = 'Callbacks.ManiaPlanetStartMatchStart'; + const MP_STARTMATCHEND = 'Callbacks.ManiaPlanetStartMatchEnd'; + const MP_STARTMAPSTART = 'Callbacks.ManiaPlanetStartMapStart'; + const MP_STARTMAPEND = 'Callbacks.ManiaPlanetStartMapEnd'; + const MP_STARTROUNDSTART = 'Callbacks.ManiaPlanetStartRoundStart'; + const MP_STARTROUNDEND = 'Callbacks.ManiaPlanetStartRoundEnd'; + const MP_STARTTURNSTART = 'Callbacks.ManiaPlanetStartTurnStart'; + const MP_STARTTURNEND = 'Callbacks.ManiaPlanetStartTurnEnd'; + const MP_STARTPLAYLOOPSTART = 'Callbacks.ManiaPlanetStartPlayLoopStart'; + const MP_STARTPLAYLOOPEND = 'Callbacks.ManiaPlanetStartPlayLoopEnd'; + const MP_ENDTTURNSTART = 'Callbacks.ManiaPlanetEndTurnStart'; + const MP_ENDTURNEND = 'Callbacks.ManiaPlanetEndTurnEnd'; + const MP_ENDROUNDSTART = 'Callbacks.ManiaPlanetEndRoundStart'; + const MP_ENDROUNDEND = 'Callbacks.ManiaPlanetEndRoundEnd'; + const MP_ENDMAPSTART = 'Callbacks.ManiaPlanetEndMapStart'; + const MP_ENDMAPEND = 'Callbacks.ManiaPlanetEndMapEnd'; + const MP_ENDMATCHSTART = 'Callbacks.ManiaPlanetEndMatchStart'; + const MP_ENDMATCHEND = 'Callbacks.ManiaPlanetEndMatchEnd'; + const MP_ENDSERVERSTART = 'Callbacks.ManiaPlanetEndServerStart'; + const MP_ENDSERVEREND = 'Callbacks.ManiaPlanetEndServerEnd'; + const MP_LOADINGMAPSTART = 'Callbacks.ManiaPlanetLoadingMapStart'; + const MP_LOADINGMAPEND = 'Callbacks.ManiaPlanetLoadingMapEnd'; + const MP_UNLOADINGMAPSTART = 'Callbacks.ManiaPlanetUnLoadingMapStart'; + const MP_UNLOADINGMAPEND = 'Callbacks.ManiaPlanetUnLoadingMapEnd'; + const MP_PODIUMSTART = 'Callbacks.ManiaPlanetPodiumStart'; + const MP_PODIUMEND = 'Callbacks.ManiaPlanetPodiumEnd'; //OLD Callbacks /** BeginMatch Callback: MatchNumber */ diff --git a/core/Callbacks/LibXmlRpcCallbacks.php b/core/Callbacks/LibXmlRpcCallbacks.php index b5d74751..0e77917b 100644 --- a/core/Callbacks/LibXmlRpcCallbacks.php +++ b/core/Callbacks/LibXmlRpcCallbacks.php @@ -4,6 +4,7 @@ namespace ManiaControl\Callbacks; use ManiaControl\Callbacks\Structures\ArmorEmptyStructure; use ManiaControl\Callbacks\Structures\CaptureStructure; +use ManiaControl\Callbacks\Structures\ManiaPlanet\StartEndStructure; use ManiaControl\Callbacks\Structures\ManiaPlanet\StartServerStructure; use ManiaControl\Callbacks\Structures\NearMissStructure; use ManiaControl\Callbacks\Structures\PlayerHitStructure; @@ -56,6 +57,9 @@ class LibXmlRpcCallbacks implements CallbackListener { case 'Maniaplanet.StartServer_End': $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVEREND, new StartServerStructure($this->maniaControl, $data)); break; + case 'ManiaPlanet.StartMatch_Start': + $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHSTART, new StartEndStructure($this->maniaControl, $data)); + break; //OLD Callbacks case 'LibXmlRpc_BeginMatch': $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINMATCH, $data[0]); diff --git a/core/Callbacks/Structures/ManiaPlanet/StartEndStructure.php b/core/Callbacks/Structures/ManiaPlanet/StartEndStructure.php new file mode 100644 index 00000000..0b3c663e --- /dev/null +++ b/core/Callbacks/Structures/ManiaPlanet/StartEndStructure.php @@ -0,0 +1,31 @@ + + * @copyright 2014-2017 ManiaControl Team + * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 + */ +class StartEndStructure extends BaseStructure { + public $count; + + public function __construct(ManiaControl $maniaControl, $data) { + parent::__construct($maniaControl, $data); + + $this->count = $this->getPlainJsonObject()->count; + } + + /** + * @return mixed + */ + public function getCount() { + return $this->count; + } +} \ No newline at end of file