update serverwidget on player connect / disconnect
This commit is contained in:
parent
f555af5f4a
commit
98dfae02bd
@ -73,7 +73,6 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
||||
private $maniaControl = null;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the plugin
|
||||
*
|
||||
@ -91,6 +90,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_BEGINMAP, $this, 'handleOnBeginMap');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ENDMAP, $this, 'handleOnEndMap');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'handlePlayerDisconnect');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_1_MINUTE, $this, 'handleEveryMinute');
|
||||
|
||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_MAP_WIDGET_ACTIVATED, true);
|
||||
@ -305,8 +305,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
||||
foreach($players as $player) {
|
||||
if($player->isSpectator) {
|
||||
$spectatorCount++;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$playerCount++;
|
||||
}
|
||||
}
|
||||
@ -446,8 +445,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
||||
$map = $this->maniaControl->client->getResponse();
|
||||
$name = $map['Name'];
|
||||
$author = $map['Author'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$requester = $queuedMap[0];
|
||||
$map = $queuedMap[1];
|
||||
$name = $map->name;
|
||||
@ -521,7 +519,18 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
||||
$this->displayClockWidget($player->login);
|
||||
}
|
||||
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
||||
$this->displayServerInfoWidget($player->login);
|
||||
$this->displayServerInfoWidget();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle PlayerConnect callback
|
||||
*
|
||||
* @param array $callback
|
||||
*/
|
||||
public function handlePlayerDisconnect(array $callback) {
|
||||
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
||||
$this->displayServerInfoWidget();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user