Hide Widget when widget or plugin deactivated
This commit is contained in:
		| @@ -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); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user