diff --git a/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Client.php b/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Client.php index ba43c95f..c25b3670 100644 --- a/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Client.php +++ b/application/core/Libs/Maniaplanet/DedicatedServer/Xmlrpc/Client.php @@ -196,7 +196,7 @@ class Client { $size = 0; $recvhandle = 0; - @stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 200); + @stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 1000); // Get result if ($this->protocol == 1) { diff --git a/application/core/Statistics/StatisticCollector.php b/application/core/Statistics/StatisticCollector.php index 5cb16421..2bd508ab 100644 --- a/application/core/Statistics/StatisticCollector.php +++ b/application/core/Statistics/StatisticCollector.php @@ -244,9 +244,13 @@ class StatisticCollector implements CallbackListener { $shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); $victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]); $weapon = $callback[1][1][3]; - $this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter); - $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); - $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); + if ($shooter) { + $this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter); + $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); + } + if ($victim) { + $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); + } break; case 'LibXmlRpc_OnNearMiss': $player = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); @@ -298,9 +302,13 @@ class StatisticCollector implements CallbackListener { $shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login); $victim = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Victim->Login); $weapon = $paramsObject->Event->WeaponNum; - $this->maniaControl->statisticManager->incrementStat($this->getWeaponStat($weapon, false), $shooter); - $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); - $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); + if ($shooter) { + $this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter); + $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); + } + if ($victim) { + $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); + } break; case 'OnArmorEmpty': $paramsObject = json_decode($callback[1][1]); diff --git a/application/plugins/Karma.php b/application/plugins/Karma.php index 64e6b2f7..3e825a22 100644 --- a/application/plugins/Karma.php +++ b/application/plugins/Karma.php @@ -560,16 +560,18 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { /** * Update Settings + * * @param $class * @param $settingName * @param $value */ - public function updateSettings($class, $settingName, $value){ - if(!$class = get_class()) + public function updateSettings($class, $settingName, $value) { + if (!$class = get_class()) { return; + } $serverLogin = $this->maniaControl->server->login; - if($settingName == '$l[http://karma.mania-exchange.com/auth/getapikey?server=' . $serverLogin . ']MX Karma Code for ' . $serverLogin . '$l'){ + if ($settingName == '$l[http://karma.mania-exchange.com/auth/getapikey?server=' . $serverLogin . ']MX Karma Code for ' . $serverLogin . '$l') { $this->mxKarmaOpenSession(); } } @@ -667,7 +669,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { return; } - if (!isset($this->mxKarma['session']) && isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'] != true) { + if (!isset($this->mxKarma['session']) && !(isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'])) { $this->mxKarmaOpenSession(); return; } @@ -718,7 +720,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { return; } - if (!isset($this->mxKarma['session']) && isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'] != true) { + if (!isset($this->mxKarma['session']) && !(isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'])) { $this->mxKarmaOpenSession(); return; } @@ -738,6 +740,11 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin { * @param bool $import */ private function postKarmaVotes(Map $map, array $votes, $import = false) { + if (!isset($this->mxKarma['session']) && !(isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'])) { + $this->mxKarmaOpenSession(); + return; + } + $gameMode = $this->maniaControl->server->getGameMode(true); if (count($votes) == 0) {