reopen menus on change
This commit is contained in:
parent
24fa0863b7
commit
a743356be3
@ -76,8 +76,8 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(ScriptSettings::CB_SCRIPTSETTINGS_CHANGED, $this, 'reopenMenu');
|
//$this->maniaControl->callbackManager->registerCallbackListener(ScriptSettings::CB_SCRIPTSETTINGS_CHANGED, $this, 'reopenMenu');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(ServerSettings::CB_SERVERSETTINGS_CHANGED, $this, 'reopenMenu');
|
//$this->maniaControl->callbackManager->registerCallbackListener(ServerSettings::CB_SERVERSETTINGS_CHANGED, $this, 'reopenMenu');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
|
|
||||||
// Create server settings
|
// Create server settings
|
||||||
@ -119,11 +119,11 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
*
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
public function reopenMenu(array $callback) {
|
public function reopenMenu($menuId = 0) {
|
||||||
foreach($this->playersMenuShown as $login => $shown) {
|
foreach($this->playersMenuShown as $login => $shown) {
|
||||||
if($shown == true) {
|
if($shown == true) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
$this->showMenu($player);
|
$this->showMenu($player, $menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,6 +200,24 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Menu Id
|
||||||
|
*
|
||||||
|
* @param $name
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMenuId($name) {
|
||||||
|
$i = 0;
|
||||||
|
foreach($this->menus as $menu) {
|
||||||
|
/** @var ConfiguratorMenu $menu */
|
||||||
|
if($menu->getTitle() == $name) {
|
||||||
|
return $i;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build menu manialink if necessary
|
* Build menu manialink if necessary
|
||||||
*
|
*
|
||||||
@ -248,7 +266,6 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
$script = new Script();
|
$script = new Script();
|
||||||
$manialink->setScript($script);
|
$manialink->setScript($script);
|
||||||
|
|
||||||
$menuRelationships = array();
|
|
||||||
$menuItemY = $menuHeight * 0.42;
|
$menuItemY = $menuHeight * 0.42;
|
||||||
$menuId = 0;
|
$menuId = 0;
|
||||||
foreach($this->menus as $index => $menu) {
|
foreach($this->menus as $index => $menu) {
|
||||||
|
@ -11,7 +11,6 @@ use FML\Controls\Quads\Quad_Icons64x64_1;
|
|||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Formatter;
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const ACTION_PREFIX_SETTING = 'ScriptSetting.';
|
const ACTION_PREFIX_SETTING = 'ScriptSetting';
|
||||||
const ACTION_SETTING_BOOL = 'ScriptSetting.ActionBoolSetting.';
|
const ACTION_SETTING_BOOL = 'ScriptSetting.ActionBoolSetting.';
|
||||||
const CB_SCRIPTSETTING_CHANGED = 'ScriptSettings.SettingChanged';
|
const CB_SCRIPTSETTING_CHANGED = 'ScriptSettings.SettingChanged';
|
||||||
const CB_SCRIPTSETTINGS_CHANGED = 'ScriptSettings.SettingsChanged';
|
const CB_SCRIPTSETTINGS_CHANGED = 'ScriptSettings.SettingsChanged';
|
||||||
@ -44,8 +43,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
'handleManialinkPageAnswer');
|
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
|
||||||
$this->initTables();
|
$this->initTables();
|
||||||
}
|
}
|
||||||
@ -96,7 +94,9 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$this->maniaControl->client->query('GetModeScriptSettings');
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
$scriptSettings = $this->maniaControl->client->getResponse();
|
||||||
if(isset($scriptSettings['faultString'])) {
|
if(isset($scriptSettings['faultString'])) {
|
||||||
if ($scriptSettings['faultString'] == 'Not in script mode.') return false;
|
if($scriptSettings['faultString'] == 'Not in script mode.') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
trigger_error('Error occured: ' . $scriptSettings['faultString']);
|
trigger_error('Error occured: ' . $scriptSettings['faultString']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -111,12 +111,14 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
$loadedSettings = array();
|
$loadedSettings = array();
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
if (!isset($scriptSettings[$row->settingName])) continue;
|
if(!isset($scriptSettings[$row->settingName]))
|
||||||
|
continue;
|
||||||
$loadedSettings[$row->settingName] = $row->settingValue;
|
$loadedSettings[$row->settingName] = $row->settingValue;
|
||||||
settype($loadedSettings[$row->settingName], gettype($scriptSettings[$row->settingName]));
|
settype($loadedSettings[$row->settingName], gettype($scriptSettings[$row->settingName]));
|
||||||
}
|
}
|
||||||
$result->close();
|
$result->close();
|
||||||
if (!$loadedSettings) return true;
|
if(!$loadedSettings)
|
||||||
|
return true;
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('SetModeScriptSettings', $loadedSettings);
|
$success = $this->maniaControl->client->query('SetModeScriptSettings', $loadedSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
@ -226,8 +228,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$substyle = '';
|
$substyle = '';
|
||||||
if($settingValue === false) {
|
if($settingValue === false) {
|
||||||
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed;
|
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed;
|
||||||
}
|
} else if($settingValue === true) {
|
||||||
else if ($settingValue === true) {
|
|
||||||
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlGreen;
|
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlGreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,8 +241,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$quad->setSize(4, 4);
|
$quad->setSize(4, 4);
|
||||||
$quad->setHAlign(Control::CENTER);
|
$quad->setHAlign(Control::CENTER);
|
||||||
$quad->setAction(self::ACTION_SETTING_BOOL . $settingName);
|
$quad->setAction(self::ACTION_SETTING_BOOL . $settingName);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$entry = new Entry();
|
$entry = new Entry();
|
||||||
$settingFrame->add($entry);
|
$settingFrame->add($entry);
|
||||||
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
$entry->setStyle(Label_Text::STYLE_TextValueSmall);
|
||||||
@ -249,7 +249,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$entry->setX($width / 2 * 0.55);
|
$entry->setX($width / 2 * 0.55);
|
||||||
$entry->setTextSize(1);
|
$entry->setTextSize(1);
|
||||||
$entry->setSize($width * 0.3, $settingHeight * 0.9);
|
$entry->setSize($width * 0.3, $settingHeight * 0.9);
|
||||||
$entry->setName(self::ACTION_PREFIX_SETTING . $settingName);
|
$entry->setName(self::ACTION_PREFIX_SETTING . '.' . $settingName);
|
||||||
$entry->setDefault($settingValue);
|
$entry->setDefault($settingValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,6 +278,12 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
||||||
*/
|
*/
|
||||||
public function saveConfigData(array $configData, Player $player) {
|
public function saveConfigData(array $configData, Player $player) {
|
||||||
|
|
||||||
|
$prefix = explode(".", $configData[3][0]['Name']);
|
||||||
|
if($prefix[0] != self::ACTION_PREFIX_SETTING) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->maniaControl->client->query('GetModeScriptSettings');
|
$this->maniaControl->client->query('GetModeScriptSettings');
|
||||||
$scriptSettings = $this->maniaControl->client->getResponse();
|
$scriptSettings = $this->maniaControl->client->getResponse();
|
||||||
|
|
||||||
@ -285,11 +291,9 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
$newSettings = array();
|
$newSettings = array();
|
||||||
foreach($configData[3] as $setting) {
|
foreach($configData[3] as $setting) {
|
||||||
if (substr($setting['Name'], 0, $prefixLength) != self::ACTION_PREFIX_SETTING) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$settingName = substr($setting['Name'], $prefixLength);
|
|
||||||
|
$settingName = substr($setting['Name'], $prefixLength + 1);
|
||||||
if(!isset($scriptSettings[$settingName])) {
|
if(!isset($scriptSettings[$settingName])) {
|
||||||
var_dump('no setting ' . $settingName);
|
var_dump('no setting ' . $settingName);
|
||||||
continue;
|
continue;
|
||||||
@ -305,6 +309,10 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->applyNewScriptSettings($newSettings, $player);
|
$this->applyNewScriptSettings($newSettings, $player);
|
||||||
|
|
||||||
|
//Reopen the Menu
|
||||||
|
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle());
|
||||||
|
$this->maniaControl->configurator->reopenMenu($menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -360,7 +368,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @param bool
|
* @param bool
|
||||||
*/
|
*/
|
||||||
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
||||||
if (!$newSettings) return true;
|
if(!$newSettings)
|
||||||
|
return true;
|
||||||
$success = $this->maniaControl->client->query('SetModeScriptSettings', $newSettings);
|
$success = $this->maniaControl->client->query('SetModeScriptSettings', $newSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
||||||
@ -408,8 +417,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTING_CHANGED,
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_SCRIPTSETTING_CHANGED, array(self::CB_SCRIPTSETTING_CHANGED, $setting, $value));
|
||||||
array(self::CB_SCRIPTSETTING_CHANGED, $setting, $value));
|
|
||||||
|
|
||||||
$settingIndex++;
|
$settingIndex++;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const ACTION_PREFIX_SETTING = 'ServerSettings.';
|
const ACTION_PREFIX_SETTING = 'ServerSettings';
|
||||||
const ACTION_SETTING_BOOL = 'ServerSettings.ActionBoolSetting.';
|
const ACTION_SETTING_BOOL = 'ServerSettings.ActionBoolSetting.';
|
||||||
const CB_SERVERSETTING_CHANGED = 'ServerSettings.SettingChanged';
|
const CB_SERVERSETTING_CHANGED = 'ServerSettings.SettingChanged';
|
||||||
const CB_SERVERSETTINGS_CHANGED = 'ServerSettings.SettingsChanged';
|
const CB_SERVERSETTINGS_CHANGED = 'ServerSettings.SettingsChanged';
|
||||||
@ -44,8 +44,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$this->initTables();
|
$this->initTables();
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||||
'handleManialinkPageAnswer');
|
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'onInit');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,12 +102,15 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$serverSettings = $this->maniaControl->client->getResponse();
|
$serverSettings = $this->maniaControl->client->getResponse();
|
||||||
$loadedSettings = array();
|
$loadedSettings = array();
|
||||||
while($row = $result->fetch_object()) {
|
while($row = $result->fetch_object()) {
|
||||||
if (!isset($serverSettings[$row->settingName])) continue;
|
if(!isset($serverSettings[$row->settingName])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$loadedSettings[$row->settingName] = $row->settingValue;
|
$loadedSettings[$row->settingName] = $row->settingValue;
|
||||||
settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName]));
|
settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName]));
|
||||||
}
|
}
|
||||||
$result->close();
|
$result->close();
|
||||||
if (!$loadedSettings) return true;
|
if(!$loadedSettings)
|
||||||
|
return true;
|
||||||
|
|
||||||
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
|
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
@ -210,8 +212,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$substyle = '';
|
$substyle = '';
|
||||||
if($value === false) {
|
if($value === false) {
|
||||||
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed;
|
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed;
|
||||||
}
|
} else if($value === true) {
|
||||||
else if ($value === true) {
|
|
||||||
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlGreen;
|
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlGreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +223,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
$entry->setX($width / 2 * 0.46);
|
$entry->setX($width / 2 * 0.46);
|
||||||
$entry->setTextSize(1);
|
$entry->setTextSize(1);
|
||||||
$entry->setSize($width * 0.48, $settingHeight * 0.9);
|
$entry->setSize($width * 0.48, $settingHeight * 0.9);
|
||||||
$entry->setName(self::ACTION_PREFIX_SETTING . $name);
|
$entry->setName(self::ACTION_PREFIX_SETTING . '.' . $name);
|
||||||
$entry->setDefault($value);
|
$entry->setDefault($value);
|
||||||
|
|
||||||
if($name == "Comment") { //
|
if($name == "Comment") { //
|
||||||
@ -263,6 +264,12 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData()
|
||||||
*/
|
*/
|
||||||
public function saveConfigData(array $configData, Player $player) {
|
public function saveConfigData(array $configData, Player $player) {
|
||||||
|
|
||||||
|
$prefix = explode(".", $configData[3][0]['Name']);
|
||||||
|
if($prefix[0] != self::ACTION_PREFIX_SETTING) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Note on ServerOptions the whole Options have to be saved, otherwise a error will appear
|
// Note on ServerOptions the whole Options have to be saved, otherwise a error will appear
|
||||||
$this->maniaControl->client->query('GetServerOptions');
|
$this->maniaControl->client->query('GetServerOptions');
|
||||||
$serverSettings = $this->maniaControl->client->getResponse();
|
$serverSettings = $this->maniaControl->client->getResponse();
|
||||||
@ -273,27 +280,27 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
|
|
||||||
$boolSettingName = '';
|
$boolSettingName = '';
|
||||||
if(isset($actionArray[2])) {
|
if(isset($actionArray[2])) {
|
||||||
$boolSettingName = self::ACTION_PREFIX_SETTING . $actionArray[2];
|
$boolSettingName = self::ACTION_PREFIX_SETTING . '.' . $actionArray[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
$newSettings = array();
|
$newSettings = array();
|
||||||
foreach($configData[3] as $setting) {
|
foreach($configData[3] as $setting) {
|
||||||
if (substr($setting['Name'], 0, $prefixLength) != self::ACTION_PREFIX_SETTING) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if it was a boolean button
|
// Check if it was a boolean button
|
||||||
if($setting['Name'] == $boolSettingName) {
|
if($setting['Name'] == $boolSettingName) {
|
||||||
$setting['Value'] = ($setting['Value'] ? false : true);
|
$setting['Value'] = ($setting['Value'] ? false : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$settingName = substr($setting['Name'], $prefixLength);
|
$settingName = substr($setting['Name'], $prefixLength + 1);
|
||||||
|
|
||||||
$newSettings[$settingName] = $setting['Value'];
|
$newSettings[$settingName] = $setting['Value'];
|
||||||
settype($newSettings[$settingName], gettype($serverSettings[$settingName]));
|
settype($newSettings[$settingName], gettype($serverSettings[$settingName]));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->applyNewScriptSettings($newSettings, $player);
|
$this->applyNewScriptSettings($newSettings, $player);
|
||||||
|
|
||||||
|
//Reopen the Menu
|
||||||
|
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle());
|
||||||
|
$this->maniaControl->configurator->reopenMenu($menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,7 +311,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
public function handleManialinkPageAnswer(array $callback) {
|
public function handleManialinkPageAnswer(array $callback) {
|
||||||
$actionId = $callback[1][2];
|
$actionId = $callback[1][2];
|
||||||
$boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0);
|
$boolSetting = (strpos($actionId, self::ACTION_SETTING_BOOL) === 0);
|
||||||
if (!$boolSetting) return;
|
if(!$boolSetting)
|
||||||
|
return;
|
||||||
|
|
||||||
$login = $callback[1][1];
|
$login = $callback[1][1];
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
@ -321,7 +329,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
||||||
if (!$newSettings) return true;
|
if(!$newSettings)
|
||||||
|
return true;
|
||||||
$success = $this->maniaControl->client->query('SetServerOptions', $newSettings);
|
$success = $this->maniaControl->client->query('SetServerOptions', $newSettings);
|
||||||
if(!$success) {
|
if(!$success) {
|
||||||
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
$this->maniaControl->chat->sendError('Error occurred: ' . $this->maniaControl->getClientErrorText(), $player->login);
|
||||||
@ -370,8 +379,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_SERVERSETTING_CHANGED,
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_SERVERSETTING_CHANGED, array(self::CB_SERVERSETTING_CHANGED, $setting, $value));
|
||||||
array(self::CB_SERVERSETTING_CHANGED, $setting, $value));
|
|
||||||
|
|
||||||
$settingIndex++;
|
$settingIndex++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user