refactoring and improvements
This commit is contained in:
parent
acf9053117
commit
332f8d76fb
@ -2,6 +2,7 @@
|
||||
|
||||
namespace ManiaControl\Files;
|
||||
|
||||
use cURL\Event;
|
||||
use cURL\Exception;
|
||||
use cURL\Request;
|
||||
use cURL\Response;
|
||||
@ -86,7 +87,7 @@ class AsynchronousFileReader {
|
||||
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) //
|
||||
->set(CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$request->addListener('complete', function (\cURL\Event $event) use (&$function) {
|
||||
$request->addListener('complete', function (Event $event) use (&$function) {
|
||||
/** @var Response $response */
|
||||
$response = $event->response;
|
||||
|
||||
@ -156,7 +157,7 @@ class AsynchronousFileReader {
|
||||
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) //
|
||||
->set(CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$request->addListener('complete', function (\cURL\Event $event) use (&$function) {
|
||||
$request->addListener('complete', function (Event $event) use (&$function) {
|
||||
/** @var Response $response */
|
||||
$response = $event->response;
|
||||
$error = "";
|
||||
|
@ -25,6 +25,7 @@ use ManiaControl\Update\UpdateManager;
|
||||
use Maniaplanet\DedicatedServer\Connection;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\NotInScriptModeException;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\TransportException;
|
||||
|
||||
require_once __DIR__ . '/Libs/Maniaplanet/DedicatedServer/Connection.php';
|
||||
require_once __DIR__ . '/Libs/GbxDataFetcher/gbxdatafetcher.inc.php';
|
||||
@ -61,7 +62,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
||||
public $authenticationManager = null;
|
||||
public $callbackManager = null;
|
||||
public $chat = null;
|
||||
public $config = null;
|
||||
public $config = null;
|
||||
public $configurator = null;
|
||||
/** @var Connection $client */
|
||||
public $client = null;
|
||||
@ -435,7 +436,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
||||
$this->client->setModeScriptSettings($scriptSettings);
|
||||
} catch(Exception $e) {
|
||||
//TODO temp added 19.04.2014
|
||||
$this->maniaControl->errorHandler->triggerDebugNotice("Exception line 437 ManiaControl.php " . $e->getMessage());
|
||||
$this->errorHandler->triggerDebugNotice("Exception line 437 ManiaControl.php " . $e->getMessage());
|
||||
|
||||
trigger_error("Couldn't set mode script settings to enable script callbacks. " . $e->getMessage());
|
||||
return;
|
||||
|
@ -24,6 +24,7 @@ class Server implements CallbackListener {
|
||||
/*
|
||||
* Public Properties
|
||||
*/
|
||||
/** @var Config $config */
|
||||
public $config = null;
|
||||
public $index = -1;
|
||||
public $ip = null;
|
||||
|
@ -7,7 +7,6 @@ use ManiaControl\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Plugins\Plugin;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
||||
use Maniaplanet\DedicatedServer\Xmlrpc\FatalException;
|
||||
|
||||
/**
|
||||
* Class reporting ManiaControl Usage for the Server
|
||||
|
@ -16,6 +16,7 @@ use ManiaControl\Files\FileUtil;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Plugins\Plugin;
|
||||
|
||||
/**
|
||||
* Configurator for enabling and disabling Plugins
|
||||
@ -100,7 +101,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
||||
if ($pluginList && isset($pluginList[0])) {
|
||||
$pluginClasses = $this->maniaControl->pluginManager->getPluginClasses();
|
||||
$pluginIds = array();
|
||||
/** @var Plugin $class */
|
||||
/** @var Plugin $class */
|
||||
foreach($pluginClasses as $class) {
|
||||
$pluginIds[] = $class::getId();
|
||||
}
|
||||
|
@ -389,20 +389,19 @@ class ChatMessagePlugin implements CommandListener, Plugin {
|
||||
* @return mixed
|
||||
*/
|
||||
private function getTarget($login) {
|
||||
$pid = 1;
|
||||
|
||||
/** @var Player $player */
|
||||
$player = null;
|
||||
foreach($this->maniaControl->playerManager->getPlayers() as $player) {
|
||||
if ($login == $player->login || $login == $pid || $login == $player->nickname) {
|
||||
if ($login == $player->login || $login == $player->pid || $login == $player->nickname) {
|
||||
return $player->nickname;
|
||||
}
|
||||
$pid++;
|
||||
}
|
||||
|
||||
if ($login == 'lj' && $pid > 1) {
|
||||
if ($player && $login == 'lj') {
|
||||
return $player->nickname;
|
||||
}
|
||||
|
||||
return $login;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,7 +270,9 @@ class LocalRecordsPlugin implements CallbackListener, CommandListener, TimerList
|
||||
|
||||
// Check old record of the player
|
||||
$oldRecord = $this->getLocalRecord($map, $player);
|
||||
$oldRank = -1;
|
||||
if ($oldRecord) {
|
||||
$oldRank = $oldRecord->rank;
|
||||
if ($oldRecord->time < $time) {
|
||||
// Not improved
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user