cb names updated

This commit is contained in:
kremsy 2014-02-19 12:53:06 +01:00 committed by Steffen Schröder
parent 34f5598f24
commit db255fe1c0
20 changed files with 39 additions and 37 deletions

View File

@ -43,7 +43,7 @@ class AuthenticationManager implements CallbackListener {
$this->maniaControl = $maniaControl;
$this->authCommands = new AuthCommands($maniaControl);
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
}
public function handleOnInit(array $callback) {

View File

@ -14,12 +14,13 @@ class CallbackManager {
* Constants
*/
// ManiaControl callbacks
const CB_MC_ONINIT = 'ManiaControl.OnInit';
const CB_MC_AFTERINIT = 'ManiaControl.AfterInit';
const CB_MC_ONSHUTDOWN = 'ManiaControl.OnShutdown';
const CB_MC_CLIENTUPDATED = 'ManiaControl.ClientUpdated';
const CB_MC_BEGINMAP = 'ManiaControl.BeginMap';
const CB_MC_ENDMAP = 'ManiaControl.EndMap';
const CB_ONINIT = 'ManiaControl.OnInit';
const CB_AFTERINIT = 'ManiaControl.AfterInit';
const CB_ONSHUTDOWN = 'ManiaControl.OnShutdown';
const CB_CLIENTUPDATED = 'ManiaControl.ClientUpdated';
const CB_BEGINMAP = 'ManiaControl.BeginMap';
const CB_ENDMAP = 'ManiaControl.EndMap';
// ManiaPlanet callbacks
const CB_MP_SERVERSTART = 'ManiaPlanet.ServerStart';
const CB_MP_SERVERSTOP = 'ManiaPlanet.ServerStop';
@ -39,6 +40,7 @@ class CallbackManager {
const CB_MP_MODESCRIPTCALLBACK = 'ManiaPlanet.ModeScriptCallback';
const CB_MP_MODESCRIPTCALLBACKARRAY = 'ManiaPlanet.ModeScriptCallbackArray';
const CB_MP_TUNNELDATARECEIVED = 'ManiaPlanet.TunnelDataReceived';
// TrackMania callbacks
const CB_TM_PLAYERCHECKPOINT = 'TrackMania.PlayerCheckpoint';
const CB_TM_PLAYERFINISH = 'TrackMania.PlayerFinish';
@ -199,14 +201,14 @@ class CallbackManager {
switch($callbackName) {
case 'ManiaPlanet.BeginMap':
if (!$this->mapBegan) {
$this->triggerCallback(self::CB_MC_BEGINMAP, $callback);
$this->triggerCallback(self::CB_BEGINMAP, $callback);
$this->mapBegan = true;
$this->mapEnded = false;
}
break;
case 'ManiaPlanet.EndMap':
if (!$this->mapEnded) {
$this->triggerCallback(self::CB_MC_ENDMAP, $callback);
$this->triggerCallback(self::CB_ENDMAP, $callback);
$this->mapEnded = true;
$this->mapBegan = false;
}
@ -239,7 +241,7 @@ class CallbackManager {
case 'LibXmlRpc_BeginMap':
$this->triggerScriptCallback($scriptCallbackName, $scriptCallbackData);
if (!$this->mapBegan) {
$this->triggerCallback(self::CB_MC_BEGINMAP, $callback);
$this->triggerCallback(self::CB_BEGINMAP, $callback);
$this->mapBegan = true;
$this->mapEnded = false;
}
@ -248,7 +250,7 @@ class CallbackManager {
case 'LibXmlRpc_EndMap':
$this->triggerScriptCallback($scriptCallbackName, $scriptCallbackData);
if (!$this->mapEnded) {
$this->triggerCallback(self::CB_MC_ENDMAP, $callback);
$this->triggerCallback(self::CB_ENDMAP, $callback);
$this->mapEnded = true;
$this->mapBegan = false;
}

View File

@ -29,7 +29,7 @@ class HelpManager implements CommandListener, CallbackListener {
$this->maniaControl = $maniaControl;
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
}
public function handleOnInit(array $callback) {

View File

@ -47,7 +47,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_BEGINMAP, $this, 'onBeginMap');
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, true);
$this->initTables();

View File

@ -46,7 +46,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit');
}
/**

View File

@ -214,7 +214,7 @@ class ManiaControl implements CommandListener {
*/
public function handleShutdown() {
// OnShutdown callback
$this->callbackManager->triggerCallback(CallbackManager::CB_MC_ONSHUTDOWN, array(CallbackManager::CB_MC_ONSHUTDOWN));
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN, array(CallbackManager::CB_ONSHUTDOWN));
// Announce quit
$this->chat->sendInformation('ManiaControl shutting down.');
@ -245,7 +245,7 @@ class ManiaControl implements CommandListener {
*/
public function restart($message = null) {
// Shutdown callback
$this->callbackManager->triggerCallback(CallbackManager::CB_MC_ONSHUTDOWN, array(CallbackManager::CB_MC_ONSHUTDOWN));
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN, array(CallbackManager::CB_ONSHUTDOWN));
// Announce restart
$this->chat->sendInformation('Restarting ManiaControl...');
@ -282,13 +282,13 @@ class ManiaControl implements CommandListener {
$this->connect();
// OnInit callback
$this->callbackManager->triggerCallback(CallbackManager::CB_MC_ONINIT, array(CallbackManager::CB_MC_ONINIT));
$this->callbackManager->triggerCallback(CallbackManager::CB_ONINIT, array(CallbackManager::CB_ONINIT));
// Load plugins
$this->pluginManager->loadPlugins();
// AfterInit callback
$this->callbackManager->triggerCallback(CallbackManager::CB_MC_AFTERINIT, array(CallbackManager::CB_MC_AFTERINIT));
$this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT, array(CallbackManager::CB_AFTERINIT));
// Announce ManiaControl
$this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!');

View File

@ -69,8 +69,8 @@ class MapManager implements CallbackListener {
$this->mapQueue = new MapQueue($this->maniaControl);
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_BEGINMAP, $this, 'handleBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified');
//Define Rights

View File

@ -42,7 +42,7 @@ class MapQueue implements CallbackListener, CommandListener {
public function __construct(ManiaControl $maniaControl) {
$this->maniaControl = $maniaControl;
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ENDMAP, $this, 'endMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ENDMAP, $this, 'endMap');
// Init settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SKIP_MAP_ON_LEAVE, true);

View File

@ -61,7 +61,7 @@ class PlayerManager implements CallbackListener {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true);
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCONNECT, $this, 'playerConnect');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'playerDisconnect');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERINFOCHANGED, $this, 'playerInfoChanged');

View File

@ -35,7 +35,7 @@ class RankingManager implements CallbackListener {
//Register Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACKARRAY, $this, 'handleCallbacks');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit');
//TODO won message at end of the map (disable as setting)
}

View File

@ -58,7 +58,7 @@ class Server implements CallbackListener {
$this->rankingManager = new RankingManager($maniaControl);
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit');
}
/**

View File

@ -53,7 +53,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
// Register for callbacks
$this->maniaControl->timerManager->registerTimerListening($this, 'each5Seconds', 5000);
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
// Register for commands
$this->maniaControl->commandManager->registerCommandListener('setpwd', $this, 'command_SetPwd', true);

View File

@ -38,7 +38,7 @@ class SettingManager implements CallbackListener {
$this->maniaControl = $maniaControl;
$this->initTables();
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_AFTERINIT, $this, 'handleAfterInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit');
}
/**

View File

@ -46,7 +46,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$this->maniaControl = $maniaControl;
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
}
/**

View File

@ -66,7 +66,7 @@ class StatisticCollector implements CallbackListener {
//Register Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACKARRAY, $this, 'handleCallbacks');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'onPlayerDisconnect');
//Initialize Settings

View File

@ -45,8 +45,8 @@ class EndurancePlugin implements CallbackListener, Plugin {
$this->maniaControl = $maniaControl;
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'callback_OnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'callback_BeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'callback_OnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_BEGINMAP, $this, 'callback_BeginMap');
$this->maniaControl->callbackManager->registerScriptCallbackListener(self::CB_CHECKPOINT, $this, 'callback_Checkpoint');
return true;

View File

@ -76,7 +76,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
// Register for callbacks
$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000);
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_BEGINMAP, $this, 'handleBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCONNECT, $this, 'handlePlayerConnect');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCHAT, $this, 'handlePlayerChat');

View File

@ -78,9 +78,9 @@ class LocalRecordsPlugin implements CallbackListener, TimerListener, Plugin {
// Register for callbacks
$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000);
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_AFTERINIT, $this, 'handleAfterInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleMapBegin');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_CLIENTUPDATED, $this,
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_BEGINMAP, $this, 'handleMapBegin');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_CLIENTUPDATED, $this,
'handleClientUpdated');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERFINISH, $this,
'handlePlayerFinish');

View File

@ -84,7 +84,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
//Register CallbackListeners
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ENDMAP, $this, 'handleEndMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ENDMAP, $this, 'handleEndMap');
//Register CommandListener
$this->maniaControl->commandManager->registerCommandListener('rank', $this, 'command_showRank', false);

View File

@ -95,8 +95,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$this->maniaControl->manialinkManager->customUIManager->setChallengeInfoVisible(false);
// Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleOnBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ENDMAP, $this, 'handleOnEndMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_BEGINMAP, $this, 'handleOnBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ENDMAP, $this, 'handleOnEndMap');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');