added callback names

This commit is contained in:
kremsy 2017-03-24 17:08:27 +01:00
parent b96c3e92fd
commit 7c01319a4a
3 changed files with 64 additions and 3 deletions

View File

@ -30,9 +30,35 @@ interface Callbacks {
*/ */
//NEW Callbacks //NEW Callbacks
const XMLRPC_CALLBACKSLIST = 'Callbacks.XmlRpcCallbacksList'; const XMLRPC_CALLBACKSLIST = 'Callbacks.XmlRpcCallbacksList';
const MP_STARTSERVERSTART = 'Callbacks.ManiaPlanetStartServerStart'; const MP_STARTSERVERSTART = 'Callbacks.ManiaPlanetStartServerStart';
const MP_STARTSERVEREND = '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 //OLD Callbacks
/** BeginMatch Callback: MatchNumber */ /** BeginMatch Callback: MatchNumber */

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Callbacks;
use ManiaControl\Callbacks\Structures\ArmorEmptyStructure; use ManiaControl\Callbacks\Structures\ArmorEmptyStructure;
use ManiaControl\Callbacks\Structures\CaptureStructure; use ManiaControl\Callbacks\Structures\CaptureStructure;
use ManiaControl\Callbacks\Structures\ManiaPlanet\StartEndStructure;
use ManiaControl\Callbacks\Structures\ManiaPlanet\StartServerStructure; use ManiaControl\Callbacks\Structures\ManiaPlanet\StartServerStructure;
use ManiaControl\Callbacks\Structures\NearMissStructure; use ManiaControl\Callbacks\Structures\NearMissStructure;
use ManiaControl\Callbacks\Structures\PlayerHitStructure; use ManiaControl\Callbacks\Structures\PlayerHitStructure;
@ -56,6 +57,9 @@ class LibXmlRpcCallbacks implements CallbackListener {
case 'Maniaplanet.StartServer_End': case 'Maniaplanet.StartServer_End':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVEREND, new StartServerStructure($this->maniaControl, $data)); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTSERVEREND, new StartServerStructure($this->maniaControl, $data));
break; break;
case 'ManiaPlanet.StartMatch_Start':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::MP_STARTMATCHSTART, new StartEndStructure($this->maniaControl, $data));
break;
//OLD Callbacks //OLD Callbacks
case 'LibXmlRpc_BeginMatch': case 'LibXmlRpc_BeginMatch':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINMATCH, $data[0]); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINMATCH, $data[0]);

View File

@ -0,0 +1,31 @@
<?php
namespace ManiaControl\Callbacks\Structures\ManiaPlanet;
use ManiaControl\Callbacks\Structures\BaseStructure;
use ManiaControl\ManiaControl;
/**
* Structure Class for the Default Start End Callbacks
*
* @author ManiaControl Team <mail@maniacontrol.com>
* @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;
}
}