From a8e571d00221bf89f138ed827d8787bcafe35632 Mon Sep 17 00:00:00 2001 From: Alexander Nell Date: Mon, 16 Mar 2020 10:56:38 +0100 Subject: [PATCH] Hide Widget when widget or plugin deactivated --- plugins/MCTeam/Dedimania/DedimaniaPlugin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/MCTeam/Dedimania/DedimaniaPlugin.php b/plugins/MCTeam/Dedimania/DedimaniaPlugin.php index c08cfe2b..2fa011ef 100644 --- a/plugins/MCTeam/Dedimania/DedimaniaPlugin.php +++ b/plugins/MCTeam/Dedimania/DedimaniaPlugin.php @@ -153,8 +153,7 @@ class DedimaniaPlugin implements CallbackListener, CommandListener, TimerListene $this->recordWidget = new RecordWidget($this->maniaControl); - if ($this->maniaControl->getServer()->getGameMode() == 0) - { + if ($this->maniaControl->getServer()->getGameMode() == 0) { $gameMode = $this->maniaControl->getClient()->getScriptName()['CurrentValue']; $this->isMultilap = ($gameMode == 'Laps.Script.txt' || $this->maniaControl->getMapManager()->getCurrentMap()->nbLaps > 0); $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)) { $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() */ public function unload() { + $this->maniaControl->getManialinkManager()->hideManialink(self::MLID_DEDIMANIA); } /**