improvements on plugin load / unload

This commit is contained in:
kremsy 2014-01-18 10:32:33 +01:00 committed by Steffen Schröder
parent 90b0579c17
commit d173a48159
3 changed files with 13 additions and 2 deletions

View File

@ -134,6 +134,10 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
* Unload the plugin and its resources * Unload the plugin and its resources
*/ */
public function unload() { public function unload() {
$this->destroyVote();
$emptyManialink = new ManiaLink(self::MLID_ICON);
$manialinkText = $emptyManialink->render()->saveXML();
$this->maniaControl->manialinkManager->sendManialink($manialinkText);
$this->maniaControl->commandManager->unregisterCommandListener($this); $this->maniaControl->commandManager->unregisterCommandListener($this);
unset($this->maniaControl); unset($this->maniaControl);
} }
@ -716,6 +720,6 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
* @return string * @return string
*/ */
public static function getDescription() { public static function getDescription() {
return null; return 'Plugin offers your Custom Votes like Restart, Skip, Balance...';
} }
} }

View File

@ -81,6 +81,9 @@ class KarmaPlugin implements CallbackListener, Plugin {
* @see \ManiaControl\Plugins\Plugin::unload() * @see \ManiaControl\Plugins\Plugin::unload()
*/ */
public function unload() { public function unload() {
$emptyManialink = new ManiaLink(self::MLID_KARMA);
$manialinkText = $emptyManialink->render()->saveXML();
$this->maniaControl->manialinkManager->sendManialink($manialinkText);
$this->maniaControl->callbackManager->unregisterCallbackListener($this); $this->maniaControl->callbackManager->unregisterCallbackListener($this);
unset($this->maniaControl); unset($this->maniaControl);
} }

View File

@ -124,6 +124,10 @@ class WidgetPlugin implements CallbackListener, Plugin {
* Unload the plugin and its resources * Unload the plugin and its resources
*/ */
public function unload() { public function unload() {
$this->closeWidget(self::MLID_CLOCKWIDGET);
$this->closeWidget(self::MLID_SERVERINFOWIDGET);
$this->closeWidget(self::MLID_MAPWIDGET);
$this->closeWidget(self::MLID_NEXTMAPWIDGET);
$this->maniaControl->callbackManager->unregisterCallbackListener($this); $this->maniaControl->callbackManager->unregisterCallbackListener($this);
unset($this->maniaControl); unset($this->maniaControl);
} }
@ -584,6 +588,6 @@ class WidgetPlugin implements CallbackListener, Plugin {
* @return string * @return string
*/ */
public static function getDescription() { public static function getDescription() {
return null; return 'Plugin offers some Widgets';
} }
} }