- static getTitle() function of configurator menu interface
- removed reopenMenu() configurator function - use more intelligent showMenu() function
This commit is contained in:
@ -268,17 +268,6 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
||||
return $manialink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reopen the Menu
|
||||
*
|
||||
* @param Player $player
|
||||
* @param int $menuId
|
||||
*/
|
||||
public function reopenMenu(Player $player, $menuId = 0) {
|
||||
// TODO: improve "reopen" to not need the $menuId param by saving the last shown menu
|
||||
$this->showMenu($player, $menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle toggle menu action
|
||||
*
|
||||
|
@ -19,7 +19,7 @@ interface ConfiguratorMenu {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle();
|
||||
public static function getTitle();
|
||||
|
||||
/**
|
||||
* Get the Configurator Menu Frame
|
||||
|
@ -56,6 +56,13 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_CHANGE_MC_SETTINGS, AuthenticationManager::AUTH_LEVEL_ADMIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||
*/
|
||||
public static function getTitle() {
|
||||
return self::TITLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getMenu()
|
||||
*/
|
||||
@ -337,14 +344,6 @@ class ManiaControlSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$this->maniaControl->chat->sendSuccess('Settings saved!', $player);
|
||||
|
||||
// Reopen the Menu
|
||||
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle());
|
||||
$this->maniaControl->configurator->reopenMenu($player, $menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||
*/
|
||||
public function getTitle() {
|
||||
return self::TITLE;
|
||||
$this->maniaControl->configurator->showMenu($player, $this);
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,13 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||
*/
|
||||
public static function getTitle() {
|
||||
return 'Script Settings';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle OnInit callback
|
||||
*/
|
||||
@ -310,9 +317,8 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$this->maniaControl->chat->sendError('Script Settings Saving failed!', $player);
|
||||
}
|
||||
|
||||
//Reopen the Menu
|
||||
$menuId = $this->maniaControl->configurator->getMenuId($this->getTitle());
|
||||
$this->maniaControl->configurator->reopenMenu($player, $menuId);
|
||||
// Reopen the Menu
|
||||
$this->maniaControl->configurator->showMenu($player, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -396,11 +402,4 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
||||
}
|
||||
return (string)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see \ManiaControl\Configurators\ConfiguratorMenu::getTitle()
|
||||
*/
|
||||
public function getTitle() {
|
||||
return 'Script Settings';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user