From 34989d233dfec1a0ba9bbad0cfd6c4e36ed3eb59 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 2 Mar 2014 14:18:10 +0100 Subject: [PATCH] solved ui probs --- .../core/Manialinks/CustomUIManager.php | 5 +-- .../core/Manialinks/ManialinkManager.php | 3 ++ application/core/Players/PlayerManager.php | 31 +++++++++---------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/application/core/Manialinks/CustomUIManager.php b/application/core/Manialinks/CustomUIManager.php index 0f7d046e..f758d3d9 100644 --- a/application/core/Manialinks/CustomUIManager.php +++ b/application/core/Manialinks/CustomUIManager.php @@ -82,10 +82,11 @@ class CustomUIManager implements CallbackListener, TimerListener { */ public function handlePlayerJoined(Player $player) { $this->updateManialink($player); - //send it again after 5 secs + + //send it again after 500ms $this->maniaControl->timerManager->registerOneTimeListening($this, function($time) use (&$player){ $this->updateManialink($player); - },5000); + },500); } /** diff --git a/application/core/Manialinks/ManialinkManager.php b/application/core/Manialinks/ManialinkManager.php index 1a3caefe..2cea8377 100644 --- a/application/core/Manialinks/ManialinkManager.php +++ b/application/core/Manialinks/ManialinkManager.php @@ -131,6 +131,9 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener public function sendManialink($manialinkText, $logins = null, $timeout = 0, $hideOnClick = false) { $manialinkText = (string) $manialinkText; + if(!$manialinkText) + return true; + try { if (!$logins) { return $this->maniaControl->client->sendDisplayManialinkPage(null, $manialinkText, $timeout, $hideOnClick); diff --git a/application/core/Players/PlayerManager.php b/application/core/Players/PlayerManager.php index 754d02e1..7c3990ac 100644 --- a/application/core/Players/PlayerManager.php +++ b/application/core/Players/PlayerManager.php @@ -203,25 +203,24 @@ class PlayerManager implements CallbackListener, TimerListener { $player->updateSpectatorStatus($callback[1][0]["SpectatorStatus"]); //Check if Player finished joining the game - if($player->hasJoinedGame && !$prevJoinState){ - //Delay join on 5secs 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'); - $chatMessage = '$s$0f0' . $string[$player->authLevel] . ' $fff' . $player->nickname . '$z$s$0f0 Nation:$fff ' . $player->getCountry() . ' $z$s$0f0joined!'; - $this->maniaControl->chat->sendChat($chatMessage); - $this->maniaControl->chat->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION . '!', $player->login); - } + if ($player->hasJoinedGame && !$prevJoinState) { - $logMessage = "Player joined: {$player->login} / " . Formatter::stripCodes($player->nickname) . " Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; - $this->maniaControl->log($logMessage); + 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'); + $chatMessage = '$s$0f0' . $string[$player->authLevel] . ' $fff' . $player->nickname . '$z$s$0f0 Nation:$fff ' . $player->getCountry() . ' $z$s$0f0joined!'; + $this->maniaControl->chat->sendChat($chatMessage); + $this->maniaControl->chat->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION . '!', $player->login); + } - // Increment the Player Join Count - $this->maniaControl->statisticManager->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->server->index); + $logMessage = "Player joined: {$player->login} / " . Formatter::stripCodes($player->nickname) . " Nation: " . $player->getCountry() . " IP: {$player->ipAddress}"; + $this->maniaControl->log($logMessage); + + // Increment the Player Join Count + $this->maniaControl->statisticManager->incrementStat(self::STAT_JOIN_COUNT, $player, $this->maniaControl->server->index); + + // Trigger own PlayerJoined callback + $this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERCONNECT, $player); - // Trigger own PlayerJoined callback - $this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERCONNECT, $player); - }, 2000); } // Trigger own callback