From f915417b8b5cd8d6a430d77002c82769a729bedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sat, 24 May 2014 16:39:12 +0200 Subject: [PATCH] moved core callbacks constants into callbacks interface server options fix --- application/core/Admin/ActionsMenu.php | 4 ++-- .../core/Admin/AuthenticationManager.php | 4 ++-- .../core/Callbacks/CallbackManager.php | 11 ++++++---- application/core/Callbacks/Callbacks.php | 9 ++++++++ application/core/Commands/HelpManager.php | 4 ++-- .../core/Configurators/ScriptSettings.php | 2 +- .../core/Configurators/ServerSettings.php | 10 ++++----- application/core/ManiaControl.php | 9 ++++---- application/core/Manialinks/IconManager.php | 4 ++-- application/core/Maps/MapManager.php | 21 ++++++++----------- application/core/Maps/MapQueue.php | 3 +-- application/core/Players/PlayerManager.php | 3 ++- application/core/Server/RankingManager.php | 2 +- application/core/Server/Server.php | 4 ++-- application/core/Server/ServerCommands.php | 4 ++-- application/core/Settings/SettingManager.php | 4 ++-- .../core/Statistics/SimpleStatsList.php | 3 ++- .../core/Statistics/StatisticCollector.php | 3 ++- application/core/Update/UpdateManager.php | 6 +++--- .../plugins/MCTeam/LocalRecordsPlugin.php | 2 +- .../plugins/steeffeen/EndurancePlugin.php | 2 +- 21 files changed, 63 insertions(+), 51 deletions(-) diff --git a/application/core/Admin/ActionsMenu.php b/application/core/Admin/ActionsMenu.php index 9ee8ca51..dfa7ff05 100644 --- a/application/core/Admin/ActionsMenu.php +++ b/application/core/Admin/ActionsMenu.php @@ -9,7 +9,7 @@ use FML\Controls\Quad; use FML\Controls\Quads\Quad_Icons64x64_1; use FML\ManiaLink; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Players\Player; @@ -55,7 +55,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { $this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6.); // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); $this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined'); } diff --git a/application/core/Admin/AuthenticationManager.php b/application/core/Admin/AuthenticationManager.php index 9a6d9751..81ed3df0 100644 --- a/application/core/Admin/AuthenticationManager.php +++ b/application/core/Admin/AuthenticationManager.php @@ -3,7 +3,7 @@ namespace ManiaControl\Admin; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Players\Player; use ManiaControl\Players\PlayerManager; @@ -51,7 +51,7 @@ class AuthenticationManager implements CallbackListener { $this->maniaControl = $maniaControl; $this->authCommands = new AuthCommands($maniaControl); - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); } /** diff --git a/application/core/Callbacks/CallbackManager.php b/application/core/Callbacks/CallbackManager.php index c1f79f6b..2268b5d7 100644 --- a/application/core/Callbacks/CallbackManager.php +++ b/application/core/Callbacks/CallbackManager.php @@ -17,9 +17,12 @@ class CallbackManager { */ // ManiaControl callbacks // TODO: move into Callbacks interface - const CB_ONINIT = 'ManiaControl.OnInit'; - const CB_AFTERINIT = 'ManiaControl.AfterInit'; - const CB_ONSHUTDOWN = 'ManiaControl.OnShutdown'; + /** @deprecated Use Callbacks Interface */ + const CB_ONINIT = 'Callbacks.OnInit'; + /** @deprecated Use Callbacks Interface */ + const CB_AFTERINIT = 'Callbacks.AfterInit'; + /** @deprecated Use Callbacks Interface */ + const CB_ONSHUTDOWN = 'Callbacks.OnShutdown'; // ManiaPlanet callbacks const CB_MP_SERVERSTART = 'ManiaPlanet.ServerStart'; @@ -49,8 +52,8 @@ class CallbackManager { /* * Public Properties */ - public $shootManiaCallbacks = null; public $libXmlRpcCallbacks = null; + public $shootManiaCallbacks = null; /* * Private Properties diff --git a/application/core/Callbacks/Callbacks.php b/application/core/Callbacks/Callbacks.php index 2a312f63..d8008522 100644 --- a/application/core/Callbacks/Callbacks.php +++ b/application/core/Callbacks/Callbacks.php @@ -12,6 +12,13 @@ namespace ManiaControl\Callbacks; * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 */ interface Callbacks { + /* + * ManiaControl Callbacks + */ + const ONINIT = 'Callbacks.OnInit'; + const AFTERINIT = 'Callbacks.AfterInit'; + const ONSHUTDOWN = 'Callbacks.OnShutdown'; + /** Script Callback: CallbackName, CallbackData */ const SCRIPTCALLBACK = 'Callbacks.ScriptCallback'; @@ -48,6 +55,8 @@ interface Callbacks { const ENDPODIUM = 'Callbacks.EndPodium'; /** UnloadingMap Callback */ const UNLOADINGMAP = 'Callbacks.UnloadingMap'; + /** EndMatch Callback: MatchNumber */ + const ENDMATCH = 'Callbacks.EndMatch'; /** BeginWarmup Callback */ const BEGINWARMUP = 'Callbacks.BeginWarmUp'; diff --git a/application/core/Commands/HelpManager.php b/application/core/Commands/HelpManager.php index 77f1ede9..9f5b0760 100644 --- a/application/core/Commands/HelpManager.php +++ b/application/core/Commands/HelpManager.php @@ -8,7 +8,7 @@ use FML\Controls\Quads\Quad_BgsPlayerCard; use FML\ManiaLink; use FML\Script\Features\Paging; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Players\Player; @@ -37,7 +37,7 @@ class HelpManager implements CommandListener, CallbackListener { $this->maniaControl = $maniaControl; // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); } /** diff --git a/application/core/Configurators/ScriptSettings.php b/application/core/Configurators/ScriptSettings.php index 91c3634c..7b76f39d 100644 --- a/application/core/Configurators/ScriptSettings.php +++ b/application/core/Configurators/ScriptSettings.php @@ -54,7 +54,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_ONINIT, $this, 'onInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'onBeginMap'); $this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, true); $this->initTables(); diff --git a/application/core/Configurators/ServerSettings.php b/application/core/Configurators/ServerSettings.php index 370e8a2c..737ba566 100644 --- a/application/core/Configurators/ServerSettings.php +++ b/application/core/Configurators/ServerSettings.php @@ -14,7 +14,7 @@ use FML\Script\Features\Paging; use FML\Script\Script; use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Players\Player; use Maniaplanet\DedicatedServer\Structures\ServerOptions; @@ -52,7 +52,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { $this->initTables(); // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); //Permission for Change Script-Settings $this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVER_SETTINGS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); @@ -258,11 +258,11 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { $prefixLength = strlen(self::ACTION_PREFIX_SETTING); - $newSettings = array(); + $newSettings = new ServerOptions(); foreach ($configData[3] as $setting) { $settingName = substr($setting['Name'], $prefixLength); - $newSettings[$settingName] = $setting['Value']; - settype($newSettings[$settingName], gettype($serverSettings[$settingName])); + $newSettings->$settingName = $setting['Value']; + settype($newSettings->$settingName, gettype($serverSettings[$settingName])); } $success = $this->applyNewServerSettings($newSettings, $player); diff --git a/application/core/ManiaControl.php b/application/core/ManiaControl.php index c90285d7..786120fa 100644 --- a/application/core/ManiaControl.php +++ b/application/core/ManiaControl.php @@ -6,6 +6,7 @@ use ManiaControl\Admin\ActionsMenu; use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Bills\BillManager; use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerManager; use ManiaControl\Commands\CommandListener; @@ -221,7 +222,7 @@ class ManiaControl implements CommandListener, TimerListener { */ public function restart($message = null) { // Shutdown callback - $this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN); + $this->callbackManager->triggerCallback(Callbacks::ONSHUTDOWN); // Announce restart $this->chat->sendInformation('Restarting ManiaControl...'); @@ -287,7 +288,7 @@ class ManiaControl implements CommandListener, TimerListener { */ public function handleShutdown() { // OnShutdown callback - $this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN); + $this->callbackManager->triggerCallback(Callbacks::ONSHUTDOWN); // Announce quit $this->chat->sendInformation('ManiaControl shutting down.'); @@ -336,14 +337,14 @@ class ManiaControl implements CommandListener, TimerListener { } // OnInit callback - $this->callbackManager->triggerCallback(CallbackManager::CB_ONINIT); + $this->callbackManager->triggerCallback(Callbacks::ONINIT); // Load plugins $this->pluginManager->loadPlugins(); $this->updateManager->pluginUpdateManager->checkPluginsUpdate(); // AfterInit callback - $this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT); + $this->callbackManager->triggerCallback(Callbacks::AFTERINIT); // Enable Garbage Collecting gc_enable(); diff --git a/application/core/Manialinks/IconManager.php b/application/core/Manialinks/IconManager.php index 8d81d565..e2796703 100644 --- a/application/core/Manialinks/IconManager.php +++ b/application/core/Manialinks/IconManager.php @@ -6,7 +6,7 @@ use FML\Controls\Frame; use FML\Controls\Quad; use FML\ManiaLink; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Players\Player; use ManiaControl\Players\PlayerManager; @@ -50,7 +50,7 @@ class IconManager implements CallbackListener { $this->addDefaultIcons(); // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); } diff --git a/application/core/Maps/MapManager.php b/application/core/Maps/MapManager.php index e7331f5d..673c6634 100644 --- a/application/core/Maps/MapManager.php +++ b/application/core/Maps/MapManager.php @@ -32,11 +32,7 @@ class MapManager implements CallbackListener { /* * Constants */ - const TABLE_MAPS = 'mc_maps'; - /** @deprecated CB_BEGINMAP */ - const CB_BEGINMAP = 'MapManager.BeginMap'; - /** @deprecated CB_ENDMAP */ - const CB_ENDMAP = 'MapManager.EndMap'; + const TABLE_MAPS = 'mc_maps'; const CB_MAPS_UPDATED = 'MapManager.MapsUpdated'; const CB_KARMA_UPDATED = 'MapManager.KarmaUpdated'; const SETTING_PERMISSION_ADD_MAP = 'Add Maps'; @@ -48,6 +44,11 @@ class MapManager implements CallbackListener { const SETTING_AUTOSAVE_MAPLIST = 'Autosave Maplist file'; const SETTING_MAPLIST_FILE = 'File to write Maplist in'; + /** @deprecated Use Callbacks Interface */ + const CB_BEGINMAP = 'Callbacks.BeginMap'; + /** @deprecated Use Callbacks Interface */ + const CB_ENDMAP = 'Callbacks.EndMap'; + /* * Public Properties */ @@ -86,8 +87,8 @@ class MapManager implements CallbackListener { $this->mapActions = new MapActions($maniaControl); // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified'); // Define Rights @@ -680,9 +681,7 @@ class MapManager implements CallbackListener { // Update the mx of the map (for update checks, etc.) $this->mxManager->fetchManiaExchangeMapInformation($this->currentMap); - // Trigger own BeginMap callback ( - //TODO remove deprecated callback later - $this->maniaControl->callbackManager->triggerCallback(self::CB_BEGINMAP, $this->currentMap); + // Trigger own BeginMap callback $this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMAP, $this->currentMap); } @@ -697,8 +696,6 @@ class MapManager implements CallbackListener { $this->mapBegan = false; // Trigger own EndMap callback - $this->maniaControl->callbackManager->triggerCallback(self::CB_ENDMAP, $this->currentMap); - //TODO remove deprecated callback later $this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDMAP, $this->currentMap); } diff --git a/application/core/Maps/MapQueue.php b/application/core/Maps/MapQueue.php index 097b224d..c305d3f2 100644 --- a/application/core/Maps/MapQueue.php +++ b/application/core/Maps/MapQueue.php @@ -4,7 +4,6 @@ namespace ManiaControl\Maps; use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks; use ManiaControl\Commands\CommandListener; use ManiaControl\ManiaControl; @@ -55,7 +54,7 @@ class MapQueue implements CallbackListener, CommandListener { $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'endMap'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'beginMap'); - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); // Init settings $this->maniaControl->settingManager->initSetting($this, self::SETTING_SKIP_MAP_ON_LEAVE, true); diff --git a/application/core/Players/PlayerManager.php b/application/core/Players/PlayerManager.php index 533b71fa..0205bfcc 100644 --- a/application/core/Players/PlayerManager.php +++ b/application/core/Players/PlayerManager.php @@ -5,6 +5,7 @@ namespace ManiaControl\Players; use ManiaControl\Admin\AdminLists; use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\TimerListener; use ManiaControl\ManiaControl; use ManiaControl\Statistics\StatisticManager; @@ -66,7 +67,7 @@ class PlayerManager implements CallbackListener, TimerListener { $this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true); // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::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'); diff --git a/application/core/Server/RankingManager.php b/application/core/Server/RankingManager.php index 47f0e3d6..02d378e3 100644 --- a/application/core/Server/RankingManager.php +++ b/application/core/Server/RankingManager.php @@ -32,7 +32,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_ONINIT, $this, 'onInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); //TODO won message at end of the map (disable as setting) (and public announce only all %50 (setting) players) } diff --git a/application/core/Server/Server.php b/application/core/Server/Server.php index 489f3a4e..da152fb0 100644 --- a/application/core/Server/Server.php +++ b/application/core/Server/Server.php @@ -3,7 +3,7 @@ namespace ManiaControl\Server; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Players\Player; use ManiaControl\Utils\CommandLineHelper; @@ -61,7 +61,7 @@ class Server implements CallbackListener { $this->scriptManager = new ScriptManager($maniaControl); // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); } /** diff --git a/application/core/Server/ServerCommands.php b/application/core/Server/ServerCommands.php index bd403b46..31057936 100644 --- a/application/core/Server/ServerCommands.php +++ b/application/core/Server/ServerCommands.php @@ -7,7 +7,7 @@ use FML\Controls\Quads\Quad_Icons128x32_1; use FML\Controls\Quads\Quad_Icons64x64_1; use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\TimerListener; use ManiaControl\Commands\CommandListener; use ManiaControl\ManiaControl; @@ -55,7 +55,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage // Register for callbacks $this->maniaControl->timerManager->registerTimerListening($this, 'each5Seconds', 5000); - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); // Register for commands $this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true, 'Sets the ServerName.'); diff --git a/application/core/Settings/SettingManager.php b/application/core/Settings/SettingManager.php index 0d85c64b..02ff2ad4 100644 --- a/application/core/Settings/SettingManager.php +++ b/application/core/Settings/SettingManager.php @@ -3,7 +3,7 @@ namespace ManiaControl\Settings; use ManiaControl\Callbacks\CallbackListener; -use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Plugins\PluginManager; use ManiaControl\Utils\ClassUtil; @@ -39,7 +39,7 @@ class SettingManager implements CallbackListener { $this->maniaControl = $maniaControl; $this->initTables(); - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); } /** diff --git a/application/core/Statistics/SimpleStatsList.php b/application/core/Statistics/SimpleStatsList.php index ebcf4cec..6aaeba0d 100644 --- a/application/core/Statistics/SimpleStatsList.php +++ b/application/core/Statistics/SimpleStatsList.php @@ -13,6 +13,7 @@ use FML\Controls\Quads\Quad_UIConstruction_Buttons; use FML\ManiaLink; use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\Commands\CommandListener; use ManiaControl\ManiaControl; use ManiaControl\Manialinks\ManialinkManager; @@ -51,7 +52,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_ONINIT, $this, 'handleOnInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit'); } /** diff --git a/application/core/Statistics/StatisticCollector.php b/application/core/Statistics/StatisticCollector.php index 333d6868..7f92b216 100644 --- a/application/core/Statistics/StatisticCollector.php +++ b/application/core/Statistics/StatisticCollector.php @@ -4,6 +4,7 @@ namespace ManiaControl\Statistics; use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackManager; +use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; use ManiaControl\Players\Player; use ManiaControl\Players\PlayerManager; @@ -68,7 +69,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_ONINIT, $this, 'onInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'onPlayerDisconnect'); //Initialize Settings diff --git a/application/core/Update/UpdateManager.php b/application/core/Update/UpdateManager.php index c965e629..9d0016c6 100644 --- a/application/core/Update/UpdateManager.php +++ b/application/core/Update/UpdateManager.php @@ -23,7 +23,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener /* * Constants */ - const SETTING_ENABLEUPDATECHECK = 'Enable Automatic Core Update Check'; + const SETTING_ENABLE_UPDATECHECK = 'Enable Automatic Core Update Check'; const SETTING_UPDATECHECK_INTERVAL = 'Core Update Check Interval (Hours)'; const SETTING_UPDATECHECK_CHANNEL = 'Core Update Channel (release, beta, nightly)'; const SETTING_PERFORM_BACKUPS = 'Perform Backup before Updating'; @@ -58,7 +58,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener $this->maniaControl = $maniaControl; // Init settings - $this->maniaControl->settingManager->initSetting($this, self::SETTING_ENABLEUPDATECHECK, true); + $this->maniaControl->settingManager->initSetting($this, self::SETTING_ENABLE_UPDATECHECK, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_AUTO_UPDATE, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_INTERVAL, 1); $this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, $this->getUpdateChannels()); @@ -98,7 +98,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener * @param float $time */ public function hourlyUpdateCheck($time) { - $updateCheckEnabled = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ENABLEUPDATECHECK); + $updateCheckEnabled = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_ENABLE_UPDATECHECK); if (!$updateCheckEnabled) { $this->setCoreUpdateData(); return; diff --git a/application/plugins/MCTeam/LocalRecordsPlugin.php b/application/plugins/MCTeam/LocalRecordsPlugin.php index ac154971..86f1e276 100644 --- a/application/plugins/MCTeam/LocalRecordsPlugin.php +++ b/application/plugins/MCTeam/LocalRecordsPlugin.php @@ -125,7 +125,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList // Register for callbacks $this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleMapBegin'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERFINISH, $this, 'handlePlayerFinish'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); diff --git a/application/plugins/steeffeen/EndurancePlugin.php b/application/plugins/steeffeen/EndurancePlugin.php index ca806d0c..287dcbdc 100644 --- a/application/plugins/steeffeen/EndurancePlugin.php +++ b/application/plugins/steeffeen/EndurancePlugin.php @@ -81,7 +81,7 @@ class EndurancePlugin implements CallbackListener, Plugin { $this->maniaControl = $maniaControl; // Register for callbacks - $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'callback_OnInit'); + $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'callback_OnInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'callback_BeginMap'); $this->maniaControl->callbackManager->registerScriptCallbackListener(self::CB_CHECKPOINT, $this, 'callback_Checkpoint');