moved core callbacks constants into callbacks interface

server options fix
This commit is contained in:
Steffen Schröder 2014-05-24 16:39:12 +02:00
parent 5e688a5354
commit f915417b8b
21 changed files with 63 additions and 51 deletions

View File

@ -9,7 +9,7 @@ use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -55,7 +55,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6.); $this->maniaControl->settingManager->initSetting($this, self::SETTING_MENU_ITEMSIZE, 6.);
// Register for callbacks // 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(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined');
$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined'); $this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'handlePlayerJoined');
} }

View File

@ -3,7 +3,7 @@
namespace ManiaControl\Admin; namespace ManiaControl\Admin;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
@ -51,7 +51,7 @@ class AuthenticationManager implements CallbackListener {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->authCommands = new AuthCommands($maniaControl); $this->authCommands = new AuthCommands($maniaControl);
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
} }
/** /**

View File

@ -17,9 +17,12 @@ class CallbackManager {
*/ */
// ManiaControl callbacks // ManiaControl callbacks
// TODO: move into Callbacks interface // TODO: move into Callbacks interface
const CB_ONINIT = 'ManiaControl.OnInit'; /** @deprecated Use Callbacks Interface */
const CB_AFTERINIT = 'ManiaControl.AfterInit'; const CB_ONINIT = 'Callbacks.OnInit';
const CB_ONSHUTDOWN = 'ManiaControl.OnShutdown'; /** @deprecated Use Callbacks Interface */
const CB_AFTERINIT = 'Callbacks.AfterInit';
/** @deprecated Use Callbacks Interface */
const CB_ONSHUTDOWN = 'Callbacks.OnShutdown';
// ManiaPlanet callbacks // ManiaPlanet callbacks
const CB_MP_SERVERSTART = 'ManiaPlanet.ServerStart'; const CB_MP_SERVERSTART = 'ManiaPlanet.ServerStart';
@ -49,8 +52,8 @@ class CallbackManager {
/* /*
* Public Properties * Public Properties
*/ */
public $shootManiaCallbacks = null;
public $libXmlRpcCallbacks = null; public $libXmlRpcCallbacks = null;
public $shootManiaCallbacks = null;
/* /*
* Private Properties * Private Properties

View File

@ -12,6 +12,13 @@ namespace ManiaControl\Callbacks;
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
interface Callbacks { interface Callbacks {
/*
* ManiaControl Callbacks
*/
const ONINIT = 'Callbacks.OnInit';
const AFTERINIT = 'Callbacks.AfterInit';
const ONSHUTDOWN = 'Callbacks.OnShutdown';
/** Script Callback: CallbackName, CallbackData */ /** Script Callback: CallbackName, CallbackData */
const SCRIPTCALLBACK = 'Callbacks.ScriptCallback'; const SCRIPTCALLBACK = 'Callbacks.ScriptCallback';
@ -48,6 +55,8 @@ interface Callbacks {
const ENDPODIUM = 'Callbacks.EndPodium'; const ENDPODIUM = 'Callbacks.EndPodium';
/** UnloadingMap Callback */ /** UnloadingMap Callback */
const UNLOADINGMAP = 'Callbacks.UnloadingMap'; const UNLOADINGMAP = 'Callbacks.UnloadingMap';
/** EndMatch Callback: MatchNumber */
const ENDMATCH = 'Callbacks.EndMatch';
/** BeginWarmup Callback */ /** BeginWarmup Callback */
const BEGINWARMUP = 'Callbacks.BeginWarmUp'; const BEGINWARMUP = 'Callbacks.BeginWarmUp';

View File

@ -8,7 +8,7 @@ use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\ManiaLink; use FML\ManiaLink;
use FML\Script\Features\Paging; use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -37,7 +37,7 @@ class HelpManager implements CommandListener, CallbackListener {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
} }
/** /**

View File

@ -54,7 +54,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); $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->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'onBeginMap');
$this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN, true);
$this->initTables(); $this->initTables();

View File

@ -14,7 +14,7 @@ use FML\Script\Features\Paging;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Structures\ServerOptions; use Maniaplanet\DedicatedServer\Structures\ServerOptions;
@ -52,7 +52,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
$this->initTables(); $this->initTables();
// Register for callbacks // 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 //Permission for Change Script-Settings
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_SERVER_SETTINGS, AuthenticationManager::AUTH_LEVEL_SUPERADMIN); $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); $prefixLength = strlen(self::ACTION_PREFIX_SETTING);
$newSettings = array(); $newSettings = new ServerOptions();
foreach ($configData[3] as $setting) { foreach ($configData[3] as $setting) {
$settingName = substr($setting['Name'], $prefixLength); $settingName = substr($setting['Name'], $prefixLength);
$newSettings[$settingName] = $setting['Value']; $newSettings->$settingName = $setting['Value'];
settype($newSettings[$settingName], gettype($serverSettings[$settingName])); settype($newSettings->$settingName, gettype($serverSettings[$settingName]));
} }
$success = $this->applyNewServerSettings($newSettings, $player); $success = $this->applyNewServerSettings($newSettings, $player);

View File

@ -6,6 +6,7 @@ use ManiaControl\Admin\ActionsMenu;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Bills\BillManager; use ManiaControl\Bills\BillManager;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Callbacks\TimerManager; use ManiaControl\Callbacks\TimerManager;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
@ -221,7 +222,7 @@ class ManiaControl implements CommandListener, TimerListener {
*/ */
public function restart($message = null) { public function restart($message = null) {
// Shutdown callback // Shutdown callback
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN); $this->callbackManager->triggerCallback(Callbacks::ONSHUTDOWN);
// Announce restart // Announce restart
$this->chat->sendInformation('Restarting ManiaControl...'); $this->chat->sendInformation('Restarting ManiaControl...');
@ -287,7 +288,7 @@ class ManiaControl implements CommandListener, TimerListener {
*/ */
public function handleShutdown() { public function handleShutdown() {
// OnShutdown callback // OnShutdown callback
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN); $this->callbackManager->triggerCallback(Callbacks::ONSHUTDOWN);
// Announce quit // Announce quit
$this->chat->sendInformation('ManiaControl shutting down.'); $this->chat->sendInformation('ManiaControl shutting down.');
@ -336,14 +337,14 @@ class ManiaControl implements CommandListener, TimerListener {
} }
// OnInit callback // OnInit callback
$this->callbackManager->triggerCallback(CallbackManager::CB_ONINIT); $this->callbackManager->triggerCallback(Callbacks::ONINIT);
// Load plugins // Load plugins
$this->pluginManager->loadPlugins(); $this->pluginManager->loadPlugins();
$this->updateManager->pluginUpdateManager->checkPluginsUpdate(); $this->updateManager->pluginUpdateManager->checkPluginsUpdate();
// AfterInit callback // AfterInit callback
$this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT); $this->callbackManager->triggerCallback(Callbacks::AFTERINIT);
// Enable Garbage Collecting // Enable Garbage Collecting
gc_enable(); gc_enable();

View File

@ -6,7 +6,7 @@ use FML\Controls\Frame;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
@ -50,7 +50,7 @@ class IconManager implements CallbackListener {
$this->addDefaultIcons(); $this->addDefaultIcons();
// Register for callbacks // 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'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
} }

View File

@ -33,10 +33,6 @@ class MapManager implements CallbackListener {
* Constants * Constants
*/ */
const TABLE_MAPS = 'mc_maps'; const TABLE_MAPS = 'mc_maps';
/** @deprecated CB_BEGINMAP */
const CB_BEGINMAP = 'MapManager.BeginMap';
/** @deprecated CB_ENDMAP */
const CB_ENDMAP = 'MapManager.EndMap';
const CB_MAPS_UPDATED = 'MapManager.MapsUpdated'; const CB_MAPS_UPDATED = 'MapManager.MapsUpdated';
const CB_KARMA_UPDATED = 'MapManager.KarmaUpdated'; const CB_KARMA_UPDATED = 'MapManager.KarmaUpdated';
const SETTING_PERMISSION_ADD_MAP = 'Add Maps'; const SETTING_PERMISSION_ADD_MAP = 'Add Maps';
@ -48,6 +44,11 @@ class MapManager implements CallbackListener {
const SETTING_AUTOSAVE_MAPLIST = 'Autosave Maplist file'; const SETTING_AUTOSAVE_MAPLIST = 'Autosave Maplist file';
const SETTING_MAPLIST_FILE = 'File to write Maplist in'; 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 * Public Properties
*/ */
@ -86,8 +87,8 @@ class MapManager implements CallbackListener {
$this->mapActions = new MapActions($maniaControl); $this->mapActions = new MapActions($maniaControl);
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'handleOnInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MAPLISTMODIFIED, $this, 'mapsModified');
// Define Rights // Define Rights
@ -680,9 +681,7 @@ class MapManager implements CallbackListener {
// Update the mx of the map (for update checks, etc.) // Update the mx of the map (for update checks, etc.)
$this->mxManager->fetchManiaExchangeMapInformation($this->currentMap); $this->mxManager->fetchManiaExchangeMapInformation($this->currentMap);
// Trigger own BeginMap callback ( // Trigger own BeginMap callback
//TODO remove deprecated callback later
$this->maniaControl->callbackManager->triggerCallback(self::CB_BEGINMAP, $this->currentMap);
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMAP, $this->currentMap); $this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMAP, $this->currentMap);
} }
@ -697,8 +696,6 @@ class MapManager implements CallbackListener {
$this->mapBegan = false; $this->mapBegan = false;
// Trigger own EndMap callback // 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); $this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDMAP, $this->currentMap);
} }

View File

@ -4,7 +4,6 @@ namespace ManiaControl\Maps;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; 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::ENDMAP, $this, 'endMap');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'beginMap'); $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 // Init settings
$this->maniaControl->settingManager->initSetting($this, self::SETTING_SKIP_MAP_ON_LEAVE, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_SKIP_MAP_ON_LEAVE, true);

View File

@ -5,6 +5,7 @@ namespace ManiaControl\Players;
use ManiaControl\Admin\AdminLists; use ManiaControl\Admin\AdminLists;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
@ -66,7 +67,7 @@ class PlayerManager implements CallbackListener, TimerListener {
$this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true); $this->maniaControl->settingManager->initSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES, true);
// Register for callbacks // 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_PLAYERCONNECT, $this, 'playerConnect');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'playerDisconnect'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'playerDisconnect');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERINFOCHANGED, $this, 'playerInfoChanged'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERINFOCHANGED, $this, 'playerInfoChanged');

View File

@ -32,7 +32,7 @@ class RankingManager implements CallbackListener {
//Register Callbacks //Register Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks'); $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_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) //TODO won message at end of the map (disable as setting) (and public announce only all %50 (setting) players)
} }

View File

@ -3,7 +3,7 @@
namespace ManiaControl\Server; namespace ManiaControl\Server;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Utils\CommandLineHelper; use ManiaControl\Utils\CommandLineHelper;
@ -61,7 +61,7 @@ class Server implements CallbackListener {
$this->scriptManager = new ScriptManager($maniaControl); $this->scriptManager = new ScriptManager($maniaControl);
// Register for callbacks // Register for callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'onInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ONINIT, $this, 'onInit');
} }
/** /**

View File

@ -7,7 +7,7 @@ use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use ManiaControl\Admin\AuthenticationManager; use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
@ -55,7 +55,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
// Register for callbacks // Register for callbacks
$this->maniaControl->timerManager->registerTimerListening($this, 'each5Seconds', 5000); $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 // Register for commands
$this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true, 'Sets the ServerName.'); $this->maniaControl->commandManager->registerCommandListener('setservername', $this, 'command_SetServerName', true, 'Sets the ServerName.');

View File

@ -3,7 +3,7 @@
namespace ManiaControl\Settings; namespace ManiaControl\Settings;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Plugins\PluginManager; use ManiaControl\Plugins\PluginManager;
use ManiaControl\Utils\ClassUtil; use ManiaControl\Utils\ClassUtil;
@ -39,7 +39,7 @@ class SettingManager implements CallbackListener {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->initTables(); $this->initTables();
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_AFTERINIT, $this, 'handleAfterInit'); $this->maniaControl->callbackManager->registerCallbackListener(Callbacks::AFTERINIT, $this, 'handleAfterInit');
} }
/** /**

View File

@ -13,6 +13,7 @@ use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
@ -51,7 +52,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer'); $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');
} }
/** /**

View File

@ -4,6 +4,7 @@ namespace ManiaControl\Statistics;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
@ -68,7 +69,7 @@ class StatisticCollector implements CallbackListener {
//Register Callbacks //Register Callbacks
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_MODESCRIPTCALLBACK, $this, 'handleCallbacks'); $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_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'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'onPlayerDisconnect');
//Initialize Settings //Initialize Settings

View File

@ -23,7 +23,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
/* /*
* Constants * 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_INTERVAL = 'Core Update Check Interval (Hours)';
const SETTING_UPDATECHECK_CHANNEL = 'Core Update Channel (release, beta, nightly)'; const SETTING_UPDATECHECK_CHANNEL = 'Core Update Channel (release, beta, nightly)';
const SETTING_PERFORM_BACKUPS = 'Perform Backup before Updating'; const SETTING_PERFORM_BACKUPS = 'Perform Backup before Updating';
@ -58,7 +58,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Init settings // 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_AUTO_UPDATE, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_INTERVAL, 1); $this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_INTERVAL, 1);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, $this->getUpdateChannels()); $this->maniaControl->settingManager->initSetting($this, self::SETTING_UPDATECHECK_CHANNEL, $this->getUpdateChannels());
@ -98,7 +98,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
* @param float $time * @param float $time
*/ */
public function hourlyUpdateCheck($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) { if (!$updateCheckEnabled) {
$this->setCoreUpdateData(); $this->setCoreUpdateData();
return; return;

View File

@ -125,7 +125,7 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
// Register for callbacks // Register for callbacks
$this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); $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(Callbacks::BEGINMAP, $this, 'handleMapBegin');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERFINISH, $this, 'handlePlayerFinish'); $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_TM_PLAYERFINISH, $this, 'handlePlayerFinish');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');

View File

@ -81,7 +81,7 @@ class EndurancePlugin implements CallbackListener, Plugin {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
// Register for callbacks // 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->registerCallbackListener(Callbacks::BEGINMAP, $this, 'callback_BeginMap');
$this->maniaControl->callbackManager->registerScriptCallbackListener(self::CB_CHECKPOINT, $this, 'callback_Checkpoint'); $this->maniaControl->callbackManager->registerScriptCallbackListener(self::CB_CHECKPOINT, $this, 'callback_Checkpoint');