Hide Widget when widget or plugin deactivated

This commit is contained in:
Alexander Nell 2020-03-16 10:56:38 +01:00
parent 35683d45ba
commit a8e571d002

View File

@ -153,8 +153,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
$this->recordWidget = new RecordWidget($this->maniaControl); $this->recordWidget = new RecordWidget($this->maniaControl);
if ($this->maniaControl->getServer()->getGameMode() == 0) if ($this->maniaControl->getServer()->getGameMode() == 0) {
{
$gameMode = $this->maniaControl->getClient()->getScriptName()['CurrentValue']; $gameMode = $this->maniaControl->getClient()->getScriptName()['CurrentValue'];
$this->isMultilap = ($gameMode == 'Laps.Script.txt' || $this->maniaControl->getMapManager()->getCurrentMap()->nbLaps > 0); $this->isMultilap = ($gameMode == 'Laps.Script.txt' || $this->maniaControl->getMapManager()->getCurrentMap()->nbLaps > 0);
$this->isRounds = ($gameMode == 'Rounds.Script.txt'); $this->isRounds = ($gameMode == 'Rounds.Script.txt');
@ -178,6 +177,8 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) { if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_WIDGET_ENABLE)) {
$this->sendManialink(); $this->sendManialink();
} else {
$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_DEDIMANIA);
} }
} }
@ -748,6 +749,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene
* @see \ManiaControl\Plugins\Plugin::unload() * @see \ManiaControl\Plugins\Plugin::unload()
*/ */
public function unload() { public function unload() {
$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_DEDIMANIA);
} }
/** /**