From cb1e5b965823a28cef8e0822c8627264f0226a3d Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 2 Mar 2014 13:29:27 +0100 Subject: [PATCH] temp solved dissapearing widgets, custom ui --- application/core/Manialinks/CustomUIManager.php | 13 +++++++++---- application/core/Players/PlayerManager.php | 4 ++-- application/plugins/Dedimania/Dedimania.php | 12 +++++++----- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/application/core/Manialinks/CustomUIManager.php b/application/core/Manialinks/CustomUIManager.php index c469d468..a2a1079a 100644 --- a/application/core/Manialinks/CustomUIManager.php +++ b/application/core/Manialinks/CustomUIManager.php @@ -55,11 +55,12 @@ class CustomUIManager implements CallbackListener, TimerListener { * @param Player $player */ private function updateManialink(Player $player = null) { - if ($player) { - $this->maniaControl->manialinkManager->sendManialink($this->customUI, $player->login); + $manialinkText = $this->customUI->render()->saveXML(); + /*if ($player) { + $this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login); return; - } - $this->maniaControl->manialinkManager->sendManialink($this->customUI); + }*/ + $this->maniaControl->manialinkManager->sendManialink($manialinkText); } /** @@ -82,6 +83,10 @@ class CustomUIManager implements CallbackListener, TimerListener { */ public function handlePlayerJoined(Player $player) { $this->updateManialink($player); + //send it again after 10 secs + $this->maniaControl->timerManager->registerOneTimeListening($this, function($time) use (&$player){ + $this->updateManialink($player); + },5000); } /** diff --git a/application/core/Players/PlayerManager.php b/application/core/Players/PlayerManager.php index 754d02e1..aaef5772 100644 --- a/application/core/Players/PlayerManager.php +++ b/application/core/Players/PlayerManager.php @@ -204,7 +204,7 @@ class PlayerManager implements CallbackListener, TimerListener { //Check if Player finished joining the game if($player->hasJoinedGame && !$prevJoinState){ - //Delay join on 5secs to avoid the non appearing widgets in tm + //Delay join on 2secs to avoid the non appearing widgets in tm $this->maniaControl->timerManager->registerOneTimeListening($this, function($time) use (&$player){ if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES) && !$player->isFakePlayer()) { $string = array(0 => '$0f0Player', 1 => '$0f0Moderator', 2 => '$0f0Admin', 3 => '$0f0SuperAdmin', 4 => '$0f0MasterAdmin'); @@ -221,7 +221,7 @@ class PlayerManager implements CallbackListener, TimerListener { // Trigger own PlayerJoined callback $this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERCONNECT, $player); - }, 2000); + }, 1000); } // Trigger own callback diff --git a/application/plugins/Dedimania/Dedimania.php b/application/plugins/Dedimania/Dedimania.php index d40b65ba..9fbf05cc 100644 --- a/application/plugins/Dedimania/Dedimania.php +++ b/application/plugins/Dedimania/Dedimania.php @@ -158,7 +158,9 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { $this->updateManialink = false; $manialink = $this->buildManialink(); - $this->maniaControl->manialinkManager->sendManialink($manialink); + if($manialink != ''){ + $this->maniaControl->manialinkManager->sendManialink($manialink); + } } /** @@ -201,6 +203,10 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { if (count($this->maniaControl->playerManager->getPlayers()) == 1) { $this->fetchDedimaniaRecords(true); } + + //Display the Manialink + $manialink = $this->buildManialink(); + $this->maniaControl->manialinkManager->sendManialink($manialink, $player->login); } } } else { @@ -209,10 +215,6 @@ class Dedimania implements CallbackListener, TimerListener, Plugin { var_dump($data); } } - - $manialink = $this->buildManialink(); - $this->maniaControl->manialinkManager->sendManialink($manialink, $player->login); - return true; }, $content, true); }