update widget on playerinfo changed (for example when player got from player to spec)

This commit is contained in:
kremsy 2014-07-04 10:12:17 +02:00
parent 5ce1878ce3
commit a1dfdca189

View File

@ -127,7 +127,8 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::BEGINMAP, $this, 'handleOnBeginMap');
$this->maniaControl->callbackManager->registerCallbackListener(Callbacks::ENDMAP, $this, 'handleOnEndMap');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerConnect');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'handlePlayerDisconnect');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECT, $this, 'updateWidgets');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidgets');
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED, true);
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_POSX, 160 - 20);
@ -512,9 +513,9 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
}
/**
* Handle PlayerDisconnect Callback
* Update Widget on certain callbacks
*/
public function handlePlayerDisconnect() {
public function updateWidgets() {
if ($this->maniaControl->settingManager->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
$this->displayServerInfoWidget();
}