Changed Internal Callbacks formats to use objects directly instead of an array
This commit is contained in:
parent
36fc15c7b1
commit
ff9c21a8af
@ -123,10 +123,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle ManiaControl OnInit callback
|
* Handle ManiaControl OnInit callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleOnInit(array $callback) {
|
public function handleOnInit() {
|
||||||
$this->initCompleted = true;
|
$this->initCompleted = true;
|
||||||
$this->rebuildAndShowMenu();
|
$this->rebuildAndShowMenu();
|
||||||
}
|
}
|
||||||
@ -149,10 +147,9 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
|||||||
/**
|
/**
|
||||||
* Handle PlayerJoined callback
|
* Handle PlayerJoined callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerJoined(array $callback) {
|
public function handlePlayerJoined(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
|
$manialinkText = $this->buildMenuIconsManialink($player)->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,10 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleOnInit(array $callback) {
|
/**
|
||||||
|
* Handle ManiaControl OnInit Callback
|
||||||
|
*/
|
||||||
|
public function handleOnInit() {
|
||||||
$this->updateMasterAdmins();
|
$this->updateMasterAdmins();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +174,7 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
$authStatement->close();
|
$authStatement->close();
|
||||||
|
|
||||||
$player->authLevel = $authLevel;
|
$player->authLevel = $authLevel;
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_AUTH_LEVEL_CHANGED, array(self::CB_AUTH_LEVEL_CHANGED, $player));
|
$this->maniaControl->callbackManager->triggerCallback($player);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -155,14 +155,15 @@ class CallbackManager {
|
|||||||
* Trigger a specific Callback
|
* Trigger a specific Callback
|
||||||
*
|
*
|
||||||
* @param string $callbackName
|
* @param string $callbackName
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function triggerCallback($callbackName, array $callback) {
|
public function triggerCallback($callbackName) {
|
||||||
if (!array_key_exists($callbackName, $this->callbackListeners)) {
|
if (!array_key_exists($callbackName, $this->callbackListeners)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$params = func_get_args();
|
||||||
|
$params = array_slice($params, 1, count($params), true);
|
||||||
foreach ($this->callbackListeners[$callbackName] as $listener) {
|
foreach ($this->callbackListeners[$callbackName] as $listener) {
|
||||||
call_user_func(array($listener[0], $listener[1]), $callback);
|
call_user_func_array(array($listener[0], $listener[1]), $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,14 +171,15 @@ class CallbackManager {
|
|||||||
* Trigger a specific Script Callback
|
* Trigger a specific Script Callback
|
||||||
*
|
*
|
||||||
* @param string $callbackName
|
* @param string $callbackName
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function triggerScriptCallback($callbackName, array $callback) {
|
public function triggerScriptCallback($callbackName) {
|
||||||
if (!array_key_exists($callbackName, $this->scriptCallbackListener)) {
|
if (!array_key_exists($callbackName, $this->scriptCallbackListener)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$params = func_get_args();
|
||||||
|
$params = array_slice($params, 1, count($params), true);
|
||||||
foreach($this->scriptCallbackListener[$callbackName] as $listener) {
|
foreach($this->scriptCallbackListener[$callbackName] as $listener) {
|
||||||
call_user_func(array($listener[0], $listener[1]), $callback);
|
call_user_func_array(array($listener[0], $listener[1]), $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,10 @@ class HelpManager implements CommandListener, CallbackListener {
|
|||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_ONINIT, $this, 'handleOnInit');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleOnInit(array $callback) {
|
/**
|
||||||
|
* Handle ManiaControl OnInit Callback
|
||||||
|
*/
|
||||||
|
public function handleOnInit() {
|
||||||
//Register the help command
|
//Register the help command
|
||||||
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false);
|
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_playerHelp', false);
|
||||||
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true);
|
$this->maniaControl->commandManager->registerCommandListener('help', $this, 'command_adminHelp', true);
|
||||||
|
@ -15,6 +15,7 @@ use ManiaControl\ManiaControl;
|
|||||||
use ManiaControl\Maps\MapManager;
|
use ManiaControl\Maps\MapManager;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||||
|
use ManiaControl\Maps\Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class offering a Configurator for Script Settings
|
* Class offering a Configurator for Script Settings
|
||||||
@ -85,20 +86,17 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit callback
|
* Handle OnInit callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function onInit(array $callback) {
|
public function onInit() {
|
||||||
$this->loadSettingsFromDatabase();
|
$this->loadSettingsFromDatabase();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnBegin Map Callback
|
* Handle OnBegin Map Callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Map $map
|
||||||
*/
|
*/
|
||||||
public function onBeginMap(array $callback) {
|
public function onBeginMap(Map $map) {
|
||||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_LOAD_DEFAULT_SETTINGS_MAP_BEGIN)) {
|
||||||
$this->loadSettingsFromDatabase();
|
$this->loadSettingsFromDatabase();
|
||||||
}
|
}
|
||||||
@ -456,13 +454,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTING_CHANGED, array(self::CB_SCRIPTSETTING_CHANGED, $setting, $value));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTING_CHANGED, $setting, $value);
|
||||||
|
|
||||||
$settingIndex++;
|
$settingIndex++;
|
||||||
}
|
}
|
||||||
$statement->close();
|
$statement->close();
|
||||||
|
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTINGS_CHANGED, array(self::CB_SCRIPTSETTINGS_CHANGED));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTINGS_CHANGED);
|
||||||
|
|
||||||
$chatMessage .= '!';
|
$chatMessage .= '!';
|
||||||
$this->maniaControl->chat->sendInformation($chatMessage);
|
$this->maniaControl->chat->sendInformation($chatMessage);
|
||||||
|
@ -80,10 +80,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit callback
|
* Handle OnInit callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function onInit(array $callback) {
|
public function onInit() {
|
||||||
$this->loadSettingsFromDatabase();
|
$this->loadSettingsFromDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ class ErrorHandler {
|
|||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
|
private $reportErrors = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct Error Handler
|
* Construct Error Handler
|
||||||
@ -42,6 +43,7 @@ class ErrorHandler {
|
|||||||
$message .= "Trace: {$ex->getTraceAsString()}" . PHP_EOL;
|
$message .= "Trace: {$ex->getTraceAsString()}" . PHP_EOL;
|
||||||
logMessage($message);
|
logMessage($message);
|
||||||
|
|
||||||
|
if ($this->reportErrors) {
|
||||||
$error = array();
|
$error = array();
|
||||||
$error["Type"] = "Exception";
|
$error["Type"] = "Exception";
|
||||||
$error["Message"] = $message;
|
$error["Message"] = $message;
|
||||||
@ -50,14 +52,17 @@ class ErrorHandler {
|
|||||||
|
|
||||||
if ($this->maniaControl->server) {
|
if ($this->maniaControl->server) {
|
||||||
$error['ServerLogin'] = $this->maniaControl->server->login;
|
$error['ServerLogin'] = $this->maniaControl->server->login;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$error['ServerLogin'] = '';
|
$error['ServerLogin'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
||||||
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager,
|
||||||
|
UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
||||||
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$error['UpdateChannel'] = '';
|
$error['UpdateChannel'] = '';
|
||||||
$error['ManiaControlVersion'] = ManiaControl::VERSION;
|
$error['ManiaControlVersion'] = ManiaControl::VERSION;
|
||||||
}
|
}
|
||||||
@ -70,9 +75,11 @@ class ErrorHandler {
|
|||||||
|
|
||||||
if (!json_decode($success)) {
|
if (!json_decode($success)) {
|
||||||
logMessage("Exception-Report failed!");
|
logMessage("Exception-Report failed!");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logMessage("Exception successfully reported!");
|
logMessage("Exception successfully reported!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->maniaControl->restart();
|
$this->maniaControl->restart();
|
||||||
exit();
|
exit();
|
||||||
@ -98,7 +105,7 @@ class ErrorHandler {
|
|||||||
$message = "{$errorTag}: {$errorString} in File '{$errorFile}' on Line {$errorLine}!";
|
$message = "{$errorTag}: {$errorString} in File '{$errorFile}' on Line {$errorLine}!";
|
||||||
logMessage($message);
|
logMessage($message);
|
||||||
|
|
||||||
if ($errorNumber != E_USER_ERROR && $errorNumber != E_USER_WARNING && $errorNumber != E_USER_NOTICE) {
|
if ($this->reportErrors && $errorNumber != E_USER_ERROR && $errorNumber != E_USER_WARNING && $errorNumber != E_USER_NOTICE) {
|
||||||
$error = array();
|
$error = array();
|
||||||
$error["Type"] = "Error";
|
$error["Type"] = "Error";
|
||||||
$error["Message"] = $message;
|
$error["Message"] = $message;
|
||||||
@ -107,14 +114,17 @@ class ErrorHandler {
|
|||||||
|
|
||||||
if ($this->maniaControl->server) {
|
if ($this->maniaControl->server) {
|
||||||
$error['ServerLogin'] = $this->maniaControl->server->login;
|
$error['ServerLogin'] = $this->maniaControl->server->login;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$error['ServerLogin'] = '';
|
$error['ServerLogin'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
if ($this->maniaControl->settingManager && $this->maniaControl->updateManager) {
|
||||||
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager, UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
$error['UpdateChannel'] = $this->maniaControl->settingManager->getSetting($this->maniaControl->updateManager,
|
||||||
|
UpdateManager::SETTING_UPDATECHECK_CHANNEL);
|
||||||
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
$error['ManiaControlVersion'] = $this->maniaControl->updateManager->getCurrentBuildDate();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$error['UpdateChannel'] = '';
|
$error['UpdateChannel'] = '';
|
||||||
$error['ManiaControlVersion'] = ManiaControl::VERSION;
|
$error['ManiaControlVersion'] = ManiaControl::VERSION;
|
||||||
}
|
}
|
||||||
@ -127,7 +137,8 @@ class ErrorHandler {
|
|||||||
|
|
||||||
if (!json_decode($success)) {
|
if (!json_decode($success)) {
|
||||||
logMessage("Error-Report failed!");
|
logMessage("Error-Report failed!");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
logMessage("Error successfully reported!");
|
logMessage("Error successfully reported!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ class ManiaControl implements CommandListener {
|
|||||||
*/
|
*/
|
||||||
public function handleShutdown() {
|
public function handleShutdown() {
|
||||||
// OnShutdown callback
|
// OnShutdown callback
|
||||||
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN, array(CallbackManager::CB_ONSHUTDOWN));
|
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN);
|
||||||
|
|
||||||
// Announce quit
|
// Announce quit
|
||||||
$this->chat->sendInformation('ManiaControl shutting down.');
|
$this->chat->sendInformation('ManiaControl shutting down.');
|
||||||
@ -245,7 +245,7 @@ class ManiaControl implements CommandListener {
|
|||||||
*/
|
*/
|
||||||
public function restart($message = null) {
|
public function restart($message = null) {
|
||||||
// Shutdown callback
|
// Shutdown callback
|
||||||
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN, array(CallbackManager::CB_ONSHUTDOWN));
|
$this->callbackManager->triggerCallback(CallbackManager::CB_ONSHUTDOWN);
|
||||||
|
|
||||||
// Announce restart
|
// Announce restart
|
||||||
$this->chat->sendInformation('Restarting ManiaControl...');
|
$this->chat->sendInformation('Restarting ManiaControl...');
|
||||||
@ -282,13 +282,13 @@ class ManiaControl implements CommandListener {
|
|||||||
$this->connect();
|
$this->connect();
|
||||||
|
|
||||||
// OnInit callback
|
// OnInit callback
|
||||||
$this->callbackManager->triggerCallback(CallbackManager::CB_ONINIT, array(CallbackManager::CB_ONINIT));
|
$this->callbackManager->triggerCallback(CallbackManager::CB_ONINIT);
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
$this->pluginManager->loadPlugins();
|
$this->pluginManager->loadPlugins();
|
||||||
|
|
||||||
// AfterInit callback
|
// AfterInit callback
|
||||||
$this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT, array(CallbackManager::CB_AFTERINIT));
|
$this->callbackManager->triggerCallback(CallbackManager::CB_AFTERINIT);
|
||||||
|
|
||||||
// Announce ManiaControl
|
// Announce ManiaControl
|
||||||
$this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!');
|
$this->chat->sendInformation('ManiaControl v' . self::VERSION . ' successfully started!');
|
||||||
|
@ -79,10 +79,9 @@ class CustomUIManager implements CallbackListener, TimerListener {
|
|||||||
/**
|
/**
|
||||||
* Handle PlayerJoined Callback
|
* Handle PlayerJoined Callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerJoined(array $callback) {
|
public function handlePlayerJoined(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
$this->updateManialink($player);
|
$this->updateManialink($player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ use FML\ManiaLink;
|
|||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class managing Icons
|
* Class managing Icons
|
||||||
@ -86,29 +87,26 @@ class IconManager implements CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit Callback
|
* Handle OnInit Callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleOnInit(array $callback) {
|
public function handleOnInit() {
|
||||||
$this->preloadIcons();
|
$this->preloadIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle PlayerConnect Callback
|
* Handle PlayerConnect Callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$login = $callback[1];
|
$this->preloadIcons($player);
|
||||||
$this->preloadIcons($login);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preload Icons
|
* Preload Icons
|
||||||
*
|
*
|
||||||
* @param string $login
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function preloadIcons($login = false) {
|
public function preloadIcons($player = null) {
|
||||||
$maniaLink = new ManiaLink(self::PRELOAD_MLID);
|
$maniaLink = new ManiaLink(self::PRELOAD_MLID);
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
@ -123,6 +121,6 @@ class IconManager implements CallbackListener {
|
|||||||
|
|
||||||
// Send manialink
|
// Send manialink
|
||||||
$manialinkText = $maniaLink->render()->saveXML();
|
$manialinkText = $maniaLink->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $login);
|
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -138,6 +138,9 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
if (is_string($logins)) {
|
if (is_string($logins)) {
|
||||||
return $this->maniaControl->client->sendDisplayManialinkPage($logins, $manialinkText, $timeout, $hideOnClick);
|
return $this->maniaControl->client->sendDisplayManialinkPage($logins, $manialinkText, $timeout, $hideOnClick);
|
||||||
}
|
}
|
||||||
|
if ($logins instanceof Player) {
|
||||||
|
return $this->maniaControl->client->sendDisplayManialinkPage($logins->login, $manialinkText, $timeout, $hideOnClick);
|
||||||
|
}
|
||||||
if (is_array($logins)) {
|
if (is_array($logins)) {
|
||||||
$success = true;
|
$success = true;
|
||||||
foreach ($logins as $login) {
|
foreach ($logins as $login) {
|
||||||
@ -201,7 +204,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
if ($widgetName != '') { //TODO make check by manialinkId, getter is needed to avoid uses on non main widgets
|
if ($widgetName != '') { //TODO make check by manialinkId, getter is needed to avoid uses on non main widgets
|
||||||
$this->disableAltMenu($player);
|
$this->disableAltMenu($player);
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_OPENED, array(self::CB_MAIN_WINDOW_OPENED, $player, $widgetName));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_OPENED, $player, $widgetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,7 +232,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
$this->enableAltMenu($player);
|
$this->enableAltMenu($player);
|
||||||
|
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_CLOSED, array(self::CB_MAIN_WINDOW_CLOSED, $player));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_CLOSED, $player);
|
||||||
} else {
|
} else {
|
||||||
$emptyManialink = new ManiaLink($widgetId);
|
$emptyManialink = new ManiaLink($widgetId);
|
||||||
$manialinkText = $emptyManialink->render()->saveXML();
|
$manialinkText = $emptyManialink->render()->saveXML();
|
||||||
|
@ -561,10 +561,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reopen the widget on Map Begin, MapListChanged, etc.
|
* Reopen the widget on Map Begin, MapListChanged, etc.
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function updateWidget(array $callback) {
|
public function updateWidget() {
|
||||||
foreach($this->mapListShown as $login => $shown) {
|
foreach($this->mapListShown as $login => $shown) {
|
||||||
if ($shown) {
|
if ($shown) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
|
@ -364,7 +364,7 @@ class MapManager implements CallbackListener {
|
|||||||
$this->maps = $tempList;
|
$this->maps = $tempList;
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPS_UPDATED, array(self::CB_MAPS_UPDATED));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPS_UPDATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -389,10 +389,8 @@ class MapManager implements CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit callback
|
* Handle OnInit callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleOnInit(array $callback) {
|
public function handleOnInit() {
|
||||||
$this->updateFullMapList();
|
$this->updateFullMapList();
|
||||||
$this->fetchCurrentMap();
|
$this->fetchCurrentMap();
|
||||||
|
|
||||||
@ -401,7 +399,6 @@ class MapManager implements CallbackListener {
|
|||||||
|
|
||||||
//Restructure Maplist
|
//Restructure Maplist
|
||||||
$this->restructureMapList();
|
$this->restructureMapList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -450,7 +447,7 @@ class MapManager implements CallbackListener {
|
|||||||
$this->mxManager->fetchManiaExchangeMapInformations($this->currentMap);
|
$this->mxManager->fetchManiaExchangeMapInformations($this->currentMap);
|
||||||
|
|
||||||
// Trigger own BeginMap callback
|
// Trigger own BeginMap callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_BEGINMAP, array(self::CB_BEGINMAP, $this->currentMap));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_BEGINMAP, $this->currentMap);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
|||||||
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||||
|
|
||||||
//CallbackManager
|
//CallbackManager
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_STATUS_CHANGED, $this, 'teamStatusChanged');
|
$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'teamStatusChanged');
|
||||||
|
|
||||||
// Action Open Playerlist
|
// Action Open Playerlist
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
||||||
@ -77,12 +77,12 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle TeamStatusChanged
|
* Handle TeamStatusChanged
|
||||||
* @param array $callback
|
*
|
||||||
|
* @param bool $teamMode
|
||||||
*/
|
*/
|
||||||
public function teamStatusChanged(array $callback) {
|
public function teamStatusChanged($teamMode) {
|
||||||
$status = $callback[1];
|
|
||||||
//Add Balance Team Icon if it's a teamMode
|
//Add Balance Team Icon if it's a teamMode
|
||||||
if ($status) {
|
if ($teamMode) {
|
||||||
// Action Balance Teams
|
// Action Balance Teams
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance');
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance');
|
||||||
$itemQuad = new Quad_Icons128x32_1();
|
$itemQuad = new Quad_Icons128x32_1();
|
||||||
|
@ -761,9 +761,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
/**
|
/**
|
||||||
* Reopen the widget on PlayerInfoChanged / Player Connect and Disconnect
|
* Reopen the widget on PlayerInfoChanged / Player Connect and Disconnect
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function updateWidget(array $callback) {
|
public function updateWidget(Player $player) {
|
||||||
foreach($this->playersListShown as $login => $shown) {
|
foreach($this->playersListShown as $login => $shown) {
|
||||||
if ($shown) {
|
if ($shown) {
|
||||||
// Check if Shown player still exists
|
// Check if Shown player still exists
|
||||||
|
@ -104,10 +104,8 @@ class PlayerManager implements CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit callback
|
* Handle OnInit callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function onInit(array $callback) {
|
public function onInit() {
|
||||||
// Add all players
|
// Add all players
|
||||||
$players = $this->maniaControl->client->getPlayerList(300, 0, 2);
|
$players = $this->maniaControl->client->getPlayerList(300, 0, 2);
|
||||||
foreach($players as $playerItem) {
|
foreach($players as $playerItem) {
|
||||||
@ -139,7 +137,8 @@ class PlayerManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_ONINIT, array(self::CB_ONINIT));
|
// TODO: what for?
|
||||||
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_ONINIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,7 +167,7 @@ class PlayerManager implements CallbackListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, array(self::CB_PLAYERDISCONNECT, $player));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERDISCONNECT, $player);
|
||||||
|
|
||||||
if ($player->isFakePlayer()) {
|
if ($player->isFakePlayer()) {
|
||||||
return;
|
return;
|
||||||
@ -194,7 +193,6 @@ class PlayerManager implements CallbackListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$player->ladderRank = $callback[1][0]["LadderRanking"];
|
$player->ladderRank = $callback[1][0]["LadderRanking"];
|
||||||
$player->teamId = $callback[1][0]["TeamId"];
|
$player->teamId = $callback[1][0]["TeamId"];
|
||||||
|
|
||||||
@ -224,11 +222,11 @@ class PlayerManager implements CallbackListener {
|
|||||||
$this->maniaControl->statisticManager->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->server->index);
|
$this->maniaControl->statisticManager->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->server->index);
|
||||||
|
|
||||||
// Trigger own PlayerJoined callback
|
// Trigger own PlayerJoined callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERCONNECT, array(self::CB_PLAYERCONNECT, $player));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERCONNECT, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERINFOCHANGED, array(self::CB_PLAYERINFOCHANGED));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERINFOCHANGED, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class Server implements CallbackListener {
|
|||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const TABLE_SERVERS = 'mc_servers';
|
const TABLE_SERVERS = 'mc_servers';
|
||||||
const CB_TEAM_STATUS_CHANGED = 'ServerCallback.TeamStatusChanged';
|
const CB_TEAM_MODE_CHANGED = 'ServerCallback.TeamModeChanged';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Properties
|
* Public Properties
|
||||||
@ -126,10 +126,8 @@ class Server implements CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit Callback
|
* Handle OnInit Callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function onInit(array $callback) {
|
public function onInit() {
|
||||||
$this->updateProperties();
|
$this->updateProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +142,7 @@ class Server implements CallbackListener {
|
|||||||
|
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
if ($oldStatus != $this->teamMode) {
|
if ($oldStatus != $this->teamMode) {
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_TEAM_STATUS_CHANGED, array(self::CB_TEAM_STATUS_CHANGED, $teamMode));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_TEAM_MODE_CHANGED, $teamMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,11 +69,9 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Menu items on init
|
* Handle ManiaControl OnInit Callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleOnInit(array $callback) {
|
public function handleOnInit() {
|
||||||
//Define Permissions
|
//Define Permissions
|
||||||
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN_SERVER, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
|
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHUTDOWN_SERVER, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
|
||||||
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHOW_SYSTEMINFO, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
|
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_SHOW_SYSTEMINFO, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
|
||||||
@ -146,7 +144,7 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> canceled the Vote!');
|
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> canceled the Vote!');
|
||||||
|
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_VOTE_CANCELED, array(self::CB_VOTE_CANCELED, $player));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_VOTE_CANCELED, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,10 +43,8 @@ class SettingManager implements CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle After Init Callback
|
* Handle After Init Callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleAfterInit(array $callback) {
|
public function handleAfterInit() {
|
||||||
$this->deleteUnusedSettings();
|
$this->deleteUnusedSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +316,7 @@ class SettingManager implements CallbackListener {
|
|||||||
$settingStatement->close();
|
$settingStatement->close();
|
||||||
|
|
||||||
//Trigger settings changed Callback
|
//Trigger settings changed Callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_SETTINGS_CHANGED, array(self::CB_SETTINGS_CHANGED, $className, $settingName, $value));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_SETTINGS_CHANGED, $className, $settingName, $value);
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,10 +51,8 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the menu entry
|
* Add the menu entry
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleOnInit(array $callback) {
|
public function handleOnInit() {
|
||||||
$this->maniaControl->commandManager->registerCommandListener('stats', $this, 'command_ShowStatsList');
|
$this->maniaControl->commandManager->registerCommandListener('stats', $this, 'command_ShowStatsList');
|
||||||
|
|
||||||
// Action Open StatsList
|
// Action Open StatsList
|
||||||
|
@ -11,6 +11,7 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
class StatisticCollector implements CallbackListener {
|
class StatisticCollector implements CallbackListener {
|
||||||
/**
|
/**
|
||||||
@ -54,7 +55,6 @@ class StatisticCollector implements CallbackListener {
|
|||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
private $onShootArray = array();
|
private $onShootArray = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct player manager
|
* Construct player manager
|
||||||
*
|
*
|
||||||
@ -76,11 +76,9 @@ class StatisticCollector implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* onInit
|
* Handle ManiaControl OnInit Callback
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function onInit(array $callback) {
|
public function onInit() {
|
||||||
//Define Stats MetaData
|
//Define Stats MetaData
|
||||||
$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYTIME, StatisticManager::STAT_TYPE_TIME);
|
$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_PLAYTIME, StatisticManager::STAT_TYPE_TIME);
|
||||||
$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_MAP_WINS);
|
$this->maniaControl->statisticManager->defineStatMetaData(self::STAT_MAP_WINS);
|
||||||
@ -203,11 +201,9 @@ class StatisticCollector implements CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Insert OnShoot Statistic when a player leaves
|
* Insert OnShoot Statistic when a player leaves
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function onPlayerDisconnect(array $callback) {
|
public function onPlayerDisconnect(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
|
|
||||||
// Check if Stat Collecting is enabled
|
// Check if Stat Collecting is enabled
|
||||||
if (!$this->maniaControl->settingManager->getSetting($this, self::SETTING_COLLECT_STATS_ENABLED)) {
|
if (!$this->maniaControl->settingManager->getSetting($this, self::SETTING_COLLECT_STATS_ENABLED)) {
|
||||||
return;
|
return;
|
||||||
|
@ -108,14 +108,13 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
/**
|
/**
|
||||||
* Handle ManiaControl PlayerJoined callback
|
* Handle ManiaControl PlayerJoined callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerJoined(array $callback) {
|
public function handlePlayerJoined(Player $player) {
|
||||||
if (!$this->coreUpdateData) {
|
if (!$this->coreUpdateData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Announce available update
|
// Announce available update
|
||||||
$player = $callback[1];
|
|
||||||
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) {
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_UPDATE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(self::CB_CUSTOM_VOTE_FINISHED, $this, 'handleVoteFinished');
|
$this->maniaControl->callbackManager->registerCallbackListener(self::CB_CUSTOM_VOTE_FINISHED, $this, 'handleVoteFinished');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_STATUS_CHANGED, $this, 'constructMenu');
|
$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'constructMenu');
|
||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_VOTE_ICON_POSX, 156.);
|
||||||
@ -193,10 +193,9 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle PlayerConnect callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
$this->showIcon($player->login);
|
$this->showIcon($player->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +481,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
|
|||||||
//Check if vote is over
|
//Check if vote is over
|
||||||
if ($timeUntilExpire <= 0 || (($playersVoteRatio >= $this->currentVote->neededPlayerRatio) && (($votePercentage >= $this->currentVote->neededRatio) || ($votePercentage <= 1 - $this->currentVote->neededRatio)))) {
|
if ($timeUntilExpire <= 0 || (($playersVoteRatio >= $this->currentVote->neededPlayerRatio) && (($votePercentage >= $this->currentVote->neededRatio) || ($votePercentage <= 1 - $this->currentVote->neededRatio)))) {
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_CUSTOM_VOTE_FINISHED, array(self::CB_CUSTOM_VOTE_FINISHED, $this->currentVote->voteCommand->index, $votePercentage));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_CUSTOM_VOTE_FINISHED, $this->currentVote->voteCommand->index, $votePercentage);
|
||||||
|
|
||||||
//reset vote
|
//reset vote
|
||||||
$this->destroyVote();
|
$this->destroyVote();
|
||||||
|
@ -176,10 +176,9 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle PlayerConnect callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
// Display Map Widget
|
// Display Map Widget
|
||||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) {
|
||||||
$this->displayDonateWidget($player->login);
|
$this->displayDonateWidget($player->login);
|
||||||
|
@ -125,9 +125,9 @@ class DynamicPointlimitPlugin implements CallbackListener, CommandListener, Plug
|
|||||||
/**
|
/**
|
||||||
* Function called on player connect and disconnect, changing the pointlimit.
|
* Function called on player connect and disconnect, changing the pointlimit.
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function changePointlimit(array $callback) {
|
public function changePointlimit(Player $player) {
|
||||||
$numberOfPlayers = 0;
|
$numberOfPlayers = 0;
|
||||||
$numberOfSpectators = 0;
|
$numberOfSpectators = 0;
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ class LocalRecordsPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
const SETTING_NOTIFY_BEST_RECORDS = 'Notify Publicly only for the X Best Records';
|
const SETTING_NOTIFY_BEST_RECORDS = 'Notify Publicly only for the X Best Records';
|
||||||
const SETTING_ADJUST_OUTER_BORDER = 'Adjust outer Border to Number of actual Records';
|
const SETTING_ADJUST_OUTER_BORDER = 'Adjust outer Border to Number of actual Records';
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Private properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -160,10 +160,8 @@ class LocalRecordsPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle ManiaControl After Init
|
* Handle ManiaControl After Init
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function handleAfterInit(array $callback) {
|
public function handleAfterInit() {
|
||||||
$this->updateManialink = true;
|
$this->updateManialink = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +152,7 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
$time = $data->Run->Time;
|
$time = $data->Run->Time;
|
||||||
// Trigger trackmania player finish callback
|
// Trigger trackmania player finish callback
|
||||||
$finishCallback = array($player->pid, $player->login, $time);
|
$finishCallback = array($player->pid, $player->login, $time);
|
||||||
$finishCallback = array(CallbackManager::CB_TM_PLAYERFINISH, $finishCallback);
|
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERFINISH, array(CallbackManager::CB_TM_PLAYERFINISH, $finishCallback));
|
||||||
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERFINISH, $finishCallback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,7 +170,6 @@ class ObstaclePlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
// Trigger Trackmania player checkpoint callback
|
// Trigger Trackmania player checkpoint callback
|
||||||
// TODO: Checkpoint index (5th element)
|
// TODO: Checkpoint index (5th element)
|
||||||
$checkpointCallback = array($player->pid, $player->login, $time, 0, 0);
|
$checkpointCallback = array($player->pid, $player->login, $time, 0, 0);
|
||||||
$checkpointCallback = array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback);
|
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT, array(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback));
|
||||||
$this->maniaControl->callbackManager->triggerCallback(CallbackManager::CB_TM_PLAYERCHECKPOINT, $checkpointCallback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,12 +158,9 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
|
|||||||
/**
|
/**
|
||||||
* Function handling on the connection of a player.
|
* Function handling on the connection of a player.
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$login = $callback[1]->login;
|
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
|
||||||
|
|
||||||
if($player->isSpectator) {
|
if($player->isSpectator) {
|
||||||
$this->spectators[$player->login] = $player->login;
|
$this->spectators[$player->login] = $player->login;
|
||||||
$this->maniaControl->client->forceSpectator($player->login, 1);
|
$this->maniaControl->client->forceSpectator($player->login, 1);
|
||||||
@ -180,11 +177,9 @@ class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAns
|
|||||||
/**
|
/**
|
||||||
* Function handling on the disconnection of a player.
|
* Function handling on the disconnection of a player.
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerDisconnect(array $callback) {
|
public function handlePlayerDisconnect(Player $player) {
|
||||||
/** @var Player $player */
|
|
||||||
$player = $callback[1];
|
|
||||||
if(isset($this->spectators[$player->login])) {
|
if(isset($this->spectators[$player->login])) {
|
||||||
unset($this->spectators[$player->login]);
|
unset($this->spectators[$player->login]);
|
||||||
}
|
}
|
||||||
|
@ -272,18 +272,12 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
$mysqli->query($query);
|
$mysqli->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle PlayerConnect callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
if (!$player) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->showRank($player);
|
$this->showRank($player);
|
||||||
$this->showNextRank($player);
|
$this->showNextRank($player);
|
||||||
}
|
}
|
||||||
@ -306,7 +300,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_RANK_BUILT, array(self::CB_RANK_BUILT));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_RANK_BUILT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -152,11 +152,9 @@ class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswer
|
|||||||
/**
|
/**
|
||||||
* Handle Player connect
|
* Handle Player connect
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
/** @var Player $player */
|
|
||||||
$this->displayIcon($player->login);
|
$this->displayIcon($player->login);
|
||||||
//Initialize Player
|
//Initialize Player
|
||||||
$this->playerSettings[$player->index] = array("Balance" => $this->getBalance($player->index), "Won" => 0, "Spent" => 0, "Plays" => 0, "ClicksLastSecond" => 0, "Visible" => 0);
|
$this->playerSettings[$player->index] = array("Balance" => $this->getBalance($player->index), "Won" => 0, "Spent" => 0, "Plays" => 0, "ClicksLastSecond" => 0, "Visible" => 0);
|
||||||
@ -165,12 +163,10 @@ class SlotMachinePlugin implements Plugin, CallbackListener, ManialinkPageAnswer
|
|||||||
/**
|
/**
|
||||||
* Handle Player disconnect
|
* Handle Player disconnect
|
||||||
*
|
*
|
||||||
* @param array $chatCallback
|
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerDisconnect(array $callback) {
|
public function handlePlayerDisconnect(Player $player) {
|
||||||
$this->updateDatabaseEveryMinute();
|
$this->updateDatabaseEveryMinute();
|
||||||
$player = $callback[1];
|
|
||||||
unset($this->playerSettings[$player->index]);
|
unset($this->playerSettings[$player->index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,10 +514,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle PlayerConnect callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerConnect(array $callback) {
|
public function handlePlayerConnect(Player $player) {
|
||||||
$player = $callback[1];
|
|
||||||
// Display Map Widget
|
// Display Map Widget
|
||||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED)) {
|
||||||
$this->displayMapWidget($player->login);
|
$this->displayMapWidget($player->login);
|
||||||
@ -533,9 +532,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
/**
|
/**
|
||||||
* Handle PlayerConnect callback
|
* Handle PlayerConnect callback
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handlePlayerDisconnect(array $callback) {
|
public function handlePlayerDisconnect(Player $player) {
|
||||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
||||||
$this->displayServerInfoWidget();
|
$this->displayServerInfoWidget();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user