Added Interface for SidebarMenuManager, improved its functionality

This commit is contained in:
Jocy
2017-05-11 22:35:16 +02:00
parent f1ce8d8004
commit 9f701cddea
6 changed files with 100 additions and 23 deletions

View File

@ -24,6 +24,7 @@ use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Manialinks\SidebarMenuEntryRenderable;
use ManiaControl\Manialinks\SidebarMenuManager;
use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager;
@ -46,7 +47,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
* @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkPageAnswerListener, TimerListener, Plugin {
class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener, CallbackListener, ManialinkPageAnswerListener, TimerListener, Plugin {
/*
* Constants
*/
@ -161,7 +162,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true);
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_TIME, 40);
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry(SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID);
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry($this,SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID);
//Define Votes
$this->defineVote("teambalance", "Vote for Team Balance");
@ -371,6 +372,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$this->destroyVote();
$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_ICON);
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->deleteMenuEntry($this,self::CUSTOMVOTES_MENU_ID,true);
}
/**
@ -796,6 +798,13 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
$this->constructMenu();
}
/**
* Call here the function which updates the MenuIcon Manialink
*/
public function renderMenuIcon() {
$this->showIcon();
}
}
/**