add UsageInformation Interface to every class which can be used by Plugin Authors

This commit is contained in:
kremsy 2017-03-26 19:44:55 +02:00
parent be99324441
commit f83640179d
44 changed files with 300 additions and 118 deletions

View File

@ -10,6 +10,8 @@ use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -22,7 +24,9 @@ use ManiaControl\Players\PlayerManager;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener { class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
@ -124,8 +128,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
$itemMarginFactorY = 1.2; $itemMarginFactorY = 1.2;
// If game is shootmania lower the icons position by 20 // If game is shootmania lower the icons position by 20
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm' if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'sm') {
) {
$posY -= $shootManiaOffset; $posY -= $shootManiaOffset;
} }

View File

@ -13,6 +13,8 @@ use FML\Script\Features\Paging;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Manialinks\ManialinkPageAnswerListener;
@ -25,7 +27,9 @@ use ManiaControl\Players\Player;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AdminLists implements ManialinkPageAnswerListener, CallbackListener { class AdminLists implements ManialinkPageAnswerListener, CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -3,6 +3,8 @@
namespace ManiaControl\Admin; namespace ManiaControl\Admin;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -13,7 +15,9 @@ use ManiaControl\Players\Player;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AuthCommands implements CommandListener { class AuthCommands implements CommandListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -8,6 +8,8 @@ use ManiaControl\Callbacks\EchoListener;
use ManiaControl\Communication\CommunicationAnswer; use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener; use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods; use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -21,7 +23,9 @@ use ManiaControl\Settings\Setting;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AuthenticationManager implements CallbackListener, EchoListener, CommunicationListener { class AuthenticationManager implements CallbackListener, EchoListener, CommunicationListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -4,6 +4,8 @@ namespace ManiaControl\Bills;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\InvalidArgumentException; use Maniaplanet\DedicatedServer\InvalidArgumentException;
@ -16,7 +18,9 @@ use Maniaplanet\DedicatedServer\Structures\Bill;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class BillManager implements CallbackListener { class BillManager implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -3,6 +3,8 @@
namespace ManiaControl\Callbacks; namespace ManiaControl\Callbacks;
use ManiaControl\Callbacks\Models\BaseCallback; use ManiaControl\Callbacks\Models\BaseCallback;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -12,7 +14,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CallbackManager { class CallbackManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -3,6 +3,8 @@
namespace ManiaControl\Callbacks; namespace ManiaControl\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -12,7 +14,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class EchoManager implements CallbackListener, EchoListener { class EchoManager implements CallbackListener, EchoListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -2,6 +2,9 @@
namespace ManiaControl\Callbacks; namespace ManiaControl\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
/** /**
* Model Class for a Basic Listening * Model Class for a Basic Listening
* *
@ -9,7 +12,9 @@ namespace ManiaControl\Callbacks;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Listening { class Listening implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Public Properties * Public Properties
*/ */

View File

@ -2,6 +2,9 @@
namespace ManiaControl\Callbacks; namespace ManiaControl\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
/** /**
* Model Class for a Timer Listening * Model Class for a Timer Listening
* *
@ -9,7 +12,9 @@ namespace ManiaControl\Callbacks;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class TimerListening extends Listening { class TimerListening extends Listening implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Public Properties * Public Properties
*/ */
@ -31,11 +36,11 @@ class TimerListening extends Listening {
parent::__construct($listener, $method); parent::__construct($listener, $method);
$this->deltaTime = $milliSeconds / 1000.; $this->deltaTime = $milliSeconds / 1000.;
$this->oneTime = (bool)$oneTime; $this->oneTime = (bool) $oneTime;
if ($this->oneTime) { if ($this->oneTime) {
$this->lastTrigger = time(true); $this->lastTrigger = microtime(true); //TODO verify before here was time()
} }
$this->instantCall = (bool)$instantCall; $this->instantCall = (bool) $instantCall;
if (!$this->instantCall) { if (!$this->instantCall) {
$this->lastTrigger = microtime(true); $this->lastTrigger = microtime(true);
} }

View File

@ -2,6 +2,8 @@
namespace ManiaControl\Callbacks; namespace ManiaControl\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -11,7 +13,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class TimerManager { class TimerManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -8,6 +8,8 @@ use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Communication\CommunicationAnswer; use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener; use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods; use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException; use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
@ -18,7 +20,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Chat implements CallbackListener, CommunicationListener { class Chat implements CallbackListener, CommunicationListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -5,6 +5,8 @@ namespace ManiaControl\Commands;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Listening; use ManiaControl\Callbacks\Listening;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -14,7 +16,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CommandManager implements CallbackListener { class CommandManager implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */
@ -215,6 +219,6 @@ class CommandManager implements CallbackListener {
* @return bool * @return bool
*/ */
private function isCommandMessage(array $chatCallback) { private function isCommandMessage(array $chatCallback) {
return (bool)$chatCallback[1][3]; return (bool) $chatCallback[1][3];
} }
} }

View File

@ -4,7 +4,7 @@ namespace ManiaControl\Communication;
/** /**
* Class for Communicating with other ManiaControls * Class for Communicating with other ManiaControls
* to call @see ManiaControl\Communication\CommunicationManager\createCommunication * to call @see \ManiaControl\Communication\CommunicationManager::createCommunication()
* *
* @author ManiaControl Team <mail@maniacontrol.com> * @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team

View File

@ -1,9 +1,12 @@
<?php <?php
namespace ManiaControl\Communication; namespace ManiaControl\Communication;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Callbacks\Listening; use ManiaControl\Callbacks\Listening;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Settings\Setting; use ManiaControl\Settings\Setting;
@ -21,7 +24,9 @@ use React\Socket\Server;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CommunicationManager implements CallbackListener { class CommunicationManager implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/** Constants */ /** Constants */
const SETTING_SOCKET_ENABLED = "Activate Socket"; const SETTING_SOCKET_ENABLED = "Activate Socket";
const SETTING_SOCKET_PASSWORD = "Password for the Socket Connection"; const SETTING_SOCKET_PASSWORD = "Password for the Socket Connection";

View File

@ -4,6 +4,8 @@ namespace ManiaControl\Files;
use cURL\Event; use cURL\Event;
use cURL\Request; use cURL\Request;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -13,7 +15,8 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AsyncHttpRequest { class AsyncHttpRequest implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
@ -183,7 +186,7 @@ class AsyncHttpRequest {
* @return $this * @return $this
*/ */
public function setHeaders($headers) { public function setHeaders($headers) {
if(is_array($headers)){ if (is_array($headers)) {
$this->headers = $headers; $this->headers = $headers;
} }
return $this; return $this;

View File

@ -3,6 +3,8 @@
namespace ManiaControl\Files; namespace ManiaControl\Files;
use cURL\Request; use cURL\Request;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -12,7 +14,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class AsynchronousFileReader { class AsynchronousFileReader implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -3,6 +3,8 @@
namespace ManiaControl; namespace ManiaControl;
use ManiaControl\Files\FileUtil; use ManiaControl\Files\FileUtil;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Utils\Formatter; use ManiaControl\Utils\Formatter;
/** /**
@ -12,7 +14,8 @@ use ManiaControl\Utils\Formatter;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
abstract class Logger { abstract class Logger implements UsageInformationAble {
use UsageInformationTrait;
/** /**
* Setup the logging mechanism * Setup the logging mechanism

View File

@ -3,6 +3,8 @@
namespace ManiaControl\ManiaExchange; namespace ManiaControl\ManiaExchange;
use ManiaControl\Files\AsynchronousFileReader; use ManiaControl\Files\AsynchronousFileReader;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map; use ManiaControl\Maps\Map;
use ManiaControl\Maps\MapManager; use ManiaControl\Maps\MapManager;
@ -14,7 +16,9 @@ use ManiaControl\Maps\MapManager;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManiaExchangeManager { class ManiaExchangeManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
* @deprecated SEARCH Constants * @deprecated SEARCH Constants

View File

@ -1,7 +1,10 @@
<?php <?php
namespace ManiaControl\ManiaExchange; namespace ManiaControl\ManiaExchange;
use ManiaControl\Files\AsynchronousFileReader; use ManiaControl\Files\AsynchronousFileReader;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -12,7 +15,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManiaExchangeMapSearch { class ManiaExchangeMapSearch implements UsageInformationAble {
use UsageInformationTrait;
//Search orders (prior parameter) https://api.mania-exchange.com/documents/enums#orderings //Search orders (prior parameter) https://api.mania-exchange.com/documents/enums#orderings
const SEARCH_ORDER_NONE = -1; const SEARCH_ORDER_NONE = -1;
const SEARCH_ORDER_TRACK_NAME = 0; const SEARCH_ORDER_TRACK_NAME = 0;
@ -99,7 +104,7 @@ class ManiaExchangeMapSearch {
$this->url = 'https://' . $this->titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on'; $this->url = 'https://' . $this->titlePrefix . '.mania-exchange.com/tracksearch2/search?api=on';
if($key = $this->maniaControl->getSettingManager()->getSettingValue($this, ManiaExchangeManager::SETTING_MX_KEY)){ if ($key = $this->maniaControl->getSettingManager()->getSettingValue($this, ManiaExchangeManager::SETTING_MX_KEY)) {
$this->url .= "&key=" . $key; $this->url .= "&key=" . $key;
} }

View File

@ -5,6 +5,8 @@ namespace ManiaControl\Manialinks;
use FML\CustomUI; use FML\CustomUI;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\TimerListener; use ManiaControl\Callbacks\TimerListener;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
@ -16,7 +18,9 @@ use ManiaControl\Players\PlayerManager;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CustomUIManager implements CallbackListener, TimerListener { class CustomUIManager implements CallbackListener, TimerListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -7,6 +7,8 @@ use FML\Controls\Quad;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
@ -18,7 +20,9 @@ use ManiaControl\Players\PlayerManager;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class IconManager implements CallbackListener { class IconManager implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -8,6 +8,8 @@ use FML\Controls\Labels\Label_Text;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -23,7 +25,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener { class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -11,6 +11,8 @@ use FML\Controls\Quads\Quad_Bgs1InRace;
use FML\Controls\Quads\Quad_Icons64x64_1; use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Script\Features\Paging; use FML\Script\Features\Paging;
use FML\Script\Script; use FML\Script\Script;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -20,7 +22,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class StyleManager { class StyleManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
@ -162,8 +166,7 @@ class StyleManager {
$frame->setSize($width, $height)->setZ(45); //TODO place before scoreboards $frame->setSize($width, $height)->setZ(45); //TODO place before scoreboards
//TODO remove: (just temporary fix for tm bug) //TODO remove: (just temporary fix for tm bug)
if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'tm' if ($this->maniaControl->getMapManager()->getCurrentMap()->getGame() === 'tm') {
) {
$frame->setSize($width, $height)->setZ(32); $frame->setSize($width, $height)->setZ(32);
} }

View File

@ -4,6 +4,8 @@ namespace ManiaControl\Maps;
use ManiaControl\General\Dumpable; use ManiaControl\General\Dumpable;
use ManiaControl\General\DumpTrait; use ManiaControl\General\DumpTrait;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaExchange\MXMapInfo; use ManiaControl\ManiaExchange\MXMapInfo;
use ManiaControl\Utils\Formatter; use ManiaControl\Utils\Formatter;
@ -14,8 +16,8 @@ use ManiaControl\Utils\Formatter;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Map implements Dumpable { class Map implements Dumpable, UsageInformationAble {
use DumpTrait; use DumpTrait, UsageInformationTrait;
/* /*
* Public properties * Public properties

View File

@ -5,6 +5,8 @@ namespace ManiaControl\Maps;
use ManiaControl\Communication\CommunicationAnswer; use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener; use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods; use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException; use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
@ -15,7 +17,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\ChangeInProgressException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class MapActions implements CommunicationListener { class MapActions implements CommunicationListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -10,6 +10,8 @@ use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener; use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods; use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\Files\FileUtil; use ManiaControl\Files\FileUtil;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\ManiaExchange\ManiaExchangeList; use ManiaControl\ManiaExchange\ManiaExchangeList;
@ -33,7 +35,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnavailableFeatureException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class MapManager implements CallbackListener, CommunicationListener { class MapManager implements CallbackListener, CommunicationListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
@ -427,7 +431,7 @@ class MapManager implements CallbackListener, CommunicationListener {
return; return;
} }
throw $e; throw $e;
} catch(FileException $e){ } catch (FileException $e) {
$this->maniaControl->getChat()->sendError("Could not write file", $login); $this->maniaControl->getChat()->sendError("Could not write file", $login);
return; return;
} }

View File

@ -6,6 +6,8 @@ use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -20,7 +22,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\NotInListException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class MapQueue implements CallbackListener, CommandListener { class MapQueue implements CallbackListener, CommandListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -4,6 +4,8 @@ namespace ManiaControl\Players;
use ManiaControl\General\Dumpable; use ManiaControl\General\Dumpable;
use ManiaControl\General\DumpTrait; use ManiaControl\General\DumpTrait;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Utils\ClassUtil; use ManiaControl\Utils\ClassUtil;
use ManiaControl\Utils\Formatter; use ManiaControl\Utils\Formatter;
@ -16,8 +18,8 @@ use Maniaplanet\DedicatedServer\Structures\LadderStats;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Player implements Dumpable { class Player implements Dumpable, UsageInformationAble {
use DumpTrait; use DumpTrait, UsageInformationTrait;
/* /*
* Public Properties * Public Properties

View File

@ -12,6 +12,8 @@ use ManiaControl\Callbacks\EchoListener;
use ManiaControl\Communication\CommunicationAnswer; use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener; use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods; use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
@ -30,7 +32,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayerActions implements EchoListener, CommunicationListener { class PlayerActions implements EchoListener, CommunicationListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -3,6 +3,8 @@
namespace ManiaControl\Players; namespace ManiaControl\Players;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Utils\ClassUtil; use ManiaControl\Utils\ClassUtil;
@ -13,7 +15,9 @@ use ManiaControl\Utils\ClassUtil;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayerDataManager { class PlayerDataManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
@ -318,7 +322,7 @@ class PlayerDataManager {
private function getMetaDataId($className, $statName) { private function getMetaDataId($className, $statName) {
if (isset($this->metaData[$className . $statName])) { if (isset($this->metaData[$className . $statName])) {
$stat = $this->metaData[$className . $statName]; $stat = $this->metaData[$className . $statName];
return (int)$stat->dataId; return (int) $stat->dataId;
} }
return null; return null;
} }
@ -332,16 +336,16 @@ class PlayerDataManager {
*/ */
private function castSetting($type, $value) { private function castSetting($type, $value) {
if ($type === self::TYPE_INT) { if ($type === self::TYPE_INT) {
return (int)$value; return (int) $value;
} }
if ($type === self::TYPE_REAL) { if ($type === self::TYPE_REAL) {
return (float)$value; return (float) $value;
} }
if ($type === self::TYPE_BOOL) { if ($type === self::TYPE_BOOL) {
return (bool)$value; return (bool) $value;
} }
if ($type === self::TYPE_STRING) { if ($type === self::TYPE_STRING) {
return (string)$value; return (string) $value;
} }
if ($type === self::TYPE_ARRAY) { if ($type === self::TYPE_ARRAY) {
return explode(self::ARRAY_DELIMITER, $value); return explode(self::ARRAY_DELIMITER, $value);

View File

@ -10,6 +10,8 @@ use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Communication\CommunicationAnswer; use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener; use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods; use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Statistics\StatisticManager; use ManiaControl\Statistics\StatisticManager;
@ -23,7 +25,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class PlayerManager implements CallbackListener, TimerListener, CommunicationListener { class PlayerManager implements CallbackListener, TimerListener, CommunicationListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -6,11 +6,16 @@
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
namespace ManiaControl\Script; namespace ManiaControl\Script;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
class ModeScriptEventManager { class ModeScriptEventManager implements UsageInformationAble {
use UsageInformationTrait;
const API_VERSION = "2.0.0"; const API_VERSION = "2.0.0";
/** @var ManiaControl $maniaControl */ /** @var ManiaControl $maniaControl */
@ -49,19 +54,20 @@ class ModeScriptEventManager {
* @param string $responseId * @param string $responseId
* Triggers a Callback List Callback * Triggers a Callback List Callback
*/ */
public function getCallbacksList($responseId = "DefaultResponseId"){ public function getCallbacksList($responseId = "DefaultResponseId") {
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId)); $this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetCallbacksList', array($responseId));
} }
/** /**
* Sets the Api Version * Sets the Api Version
*
* @param string $version * @param string $version
*/ */
public function setApiVersion($version = self::API_VERSION){ public function setApiVersion($version = self::API_VERSION) {
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.SetApiVersion', array($version)); $this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.SetApiVersion', array($version));
} }
public function getAllApiVersions($responseId = "DefaultResponseId"){ public function getAllApiVersions($responseId = "DefaultResponseId") {
$this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId)); $this->maniaControl->getClient()->triggerModeScriptEvent('XmlRpc.GetAllApiVersions', array($responseId));
} }
} }

View File

@ -2,6 +2,8 @@
namespace ManiaControl\Script; namespace ManiaControl\Script;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -13,7 +15,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class ScriptManager { class ScriptManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -5,6 +5,8 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Files\FileUtil; use ManiaControl\Files\FileUtil;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -14,7 +16,9 @@ use ManiaControl\ManiaControl;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Directory implements CallbackListener { class Directory implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -5,6 +5,8 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Maps\Map; use ManiaControl\Maps\Map;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
@ -16,7 +18,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class RankingManager implements CallbackListener { class RankingManager implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Private properties * Private properties
*/ */

View File

@ -5,6 +5,8 @@ namespace ManiaControl\Server;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -19,7 +21,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Server implements CallbackListener, CommandListener { class Server implements CallbackListener, CommandListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -118,7 +118,7 @@ class VoteRatiosMenu implements CallbackListener, ConfiguratorMenu, TimerListene
} }
/** /**
* @see \ManiaControl\Configurators\ConfiguratorMenu::saveConfigData() * @see \ManiaControl\Configurator\ConfiguratorMenu::saveConfigData()
*/ */
public function saveConfigData(array $configData, Player $player) { public function saveConfigData(array $configData, Player $player) {
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_VOTE_RATIOS) if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_CHANGE_VOTE_RATIOS)

View File

@ -2,6 +2,8 @@
namespace ManiaControl\Settings; namespace ManiaControl\Settings;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Utils\ClassUtil; use ManiaControl\Utils\ClassUtil;
/** /**
@ -11,7 +13,9 @@ use ManiaControl\Utils\ClassUtil;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class Setting { class Setting implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */
@ -54,7 +58,7 @@ class Setting {
} else { } else {
// Created by Values // Created by Values
$this->class = ClassUtil::getClass($object); $this->class = ClassUtil::getClass($object);
$this->setting = (string)$settingName; $this->setting = (string) $settingName;
$this->type = self::getValueType($defaultValue); $this->type = self::getValueType($defaultValue);
if ($this->type === self::TYPE_SET) { if ($this->type === self::TYPE_SET) {
// Save Set and use first Value as Default // Save Set and use first Value as Default
@ -79,16 +83,16 @@ class Setting {
$type = self::getValueType($value); $type = self::getValueType($value);
} }
if ($type === self::TYPE_INT) { if ($type === self::TYPE_INT) {
return (int)$value; return (int) $value;
} }
if ($type === self::TYPE_REAL) { if ($type === self::TYPE_REAL) {
return (float)$value; return (float) $value;
} }
if ($type === self::TYPE_BOOL) { if ($type === self::TYPE_BOOL) {
return (bool)$value; return (bool) $value;
} }
if ($type === self::TYPE_STRING) { if ($type === self::TYPE_STRING) {
return (string)$value; return (string) $value;
} }
if ($type === self::TYPE_SET) { if ($type === self::TYPE_SET) {
return explode(self::VALUE_DELIMITER, $value); return explode(self::VALUE_DELIMITER, $value);

View File

@ -4,6 +4,8 @@ namespace ManiaControl\Settings;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\Callbacks; use ManiaControl\Callbacks\Callbacks;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Plugins\PluginManager; use ManiaControl\Plugins\PluginManager;
use ManiaControl\Utils\ClassUtil; use ManiaControl\Utils\ClassUtil;
@ -15,7 +17,9 @@ use ManiaControl\Utils\ClassUtil;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class SettingManager implements CallbackListener { class SettingManager implements CallbackListener, UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -2,6 +2,8 @@
namespace ManiaControl\Statistics; namespace ManiaControl\Statistics;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
@ -12,7 +14,9 @@ use ManiaControl\Players\Player;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class StatisticManager { class StatisticManager implements UsageInformationAble {
use UsageInformationTrait;
/* /*
* Constants * Constants
*/ */

View File

@ -2,6 +2,9 @@
namespace ManiaControl\Utils; namespace ManiaControl\Utils;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
/** /**
* Utility Class offering Methods to convert and use ManiaPlanet Colors * Utility Class offering Methods to convert and use ManiaPlanet Colors
* *
@ -9,7 +12,8 @@ namespace ManiaControl\Utils;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
abstract class ColorUtil { abstract class ColorUtil implements UsageInformationAble {
use UsageInformationTrait;
/** /**
* Convert the given float value to a color code from red to green * Convert the given float value to a color code from red to green
@ -47,9 +51,9 @@ abstract class ColorUtil {
$value = 1.; $value = 1.;
} }
$value *= 15.; $value *= 15.;
$value = (int)round($value); $value = (int) round($value);
if ($value < 10) { if ($value < 10) {
return (string)$value; return (string) $value;
} }
$codes = array(10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f'); $codes = array(10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f');
return $codes[$value]; return $codes[$value];

View File

@ -2,6 +2,9 @@
namespace ManiaControl\Utils; namespace ManiaControl\Utils;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
/** /**
* Command Line Helper Class * Command Line Helper Class
* *
@ -9,7 +12,8 @@ namespace ManiaControl\Utils;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
class CommandLineHelper { class CommandLineHelper implements UsageInformationAble {
use UsageInformationTrait;
/** /**
* Get the command line parameter value with the given name * Get the command line parameter value with the given name
@ -18,7 +22,7 @@ class CommandLineHelper {
* @return string * @return string
*/ */
public static function getParameter($paramName) { public static function getParameter($paramName) {
$paramName = (string)$paramName; $paramName = (string) $paramName;
$params = self::getAllParameters(); $params = self::getAllParameters();
foreach ($params as $param) { foreach ($params as $param) {
$parts = explode('=', $param, 2); $parts = explode('=', $param, 2);
@ -40,6 +44,6 @@ class CommandLineHelper {
*/ */
public static function getAllParameters() { public static function getAllParameters() {
global $argv; global $argv;
return (array)$argv; return (array) $argv;
} }
} }

View File

@ -2,6 +2,8 @@
namespace ManiaControl\Utils; namespace ManiaControl\Utils;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger; use ManiaControl\Logger;
/** /**
@ -11,7 +13,8 @@ use ManiaControl\Logger;
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/ */
abstract class Formatter { abstract class Formatter implements UsageInformationAble {
use UsageInformationTrait;
/** /**
* Return the given Text with Escaping around it * Return the given Text with Escaping around it
@ -31,7 +34,7 @@ abstract class Formatter {
*/ */
public static function formatTime($time) { public static function formatTime($time) {
// TODO: use gmdate() // TODO: use gmdate()
$time = (int)$time; $time = (int) $time;
$milliseconds = $time % 1000; $milliseconds = $time % 1000;
$seconds = floor($time / 1000); $seconds = floor($time / 1000);
$minutes = floor($seconds / 60); $minutes = floor($seconds / 60);
@ -66,12 +69,7 @@ abstract class Formatter {
return $short ? '0 sec.' : '0 seconds'; return $short ? '0 sec.' : '0 seconds';
} }
$calculateSeconds = array(12 * 30 * 24 * 60 * 60 => $year, $calculateSeconds = array(12 * 30 * 24 * 60 * 60 => $year, 30 * 24 * 60 * 60 => $month, 24 * 60 * 60 => $day, 60 * 60 => $hour, 60 => $minute, 1 => $second);
30 * 24 * 60 * 60 => $month,
24 * 60 * 60 => $day,
60 * 60 => $hour,
60 => $minute,
1 => $second);
foreach ($calculateSeconds as $secs => $str) { foreach ($calculateSeconds as $secs => $str) {
$d = $elapsedTime / $secs; $d = $elapsedTime / $secs;
@ -159,10 +157,35 @@ abstract class Formatter {
* @return string * @return string
*/ */
public static function mapCountry($country) { public static function mapCountry($country) {
$nations = array('Afghanistan' => 'AFG', 'Albania' => 'ALB', 'Algeria' => 'ALG', 'Andorra' => 'AND', 'Angola' => 'ANG', 'Argentina' => 'ARG', 'Armenia' => 'ARM', 'Aruba' => 'ARU', 'Australia' => 'AUS', 'Austria' => 'AUT', 'Azerbaijan' => 'AZE', 'Bahamas' => 'BAH', 'Bahrain' => 'BRN', 'Bangladesh' => 'BAN', 'Barbados' => 'BAR', 'Belarus' => 'BLR', 'Belgium' => 'BEL', 'Belize' => 'BIZ', 'Benin' => 'BEN', 'Bermuda' => 'BER', 'Bhutan' => 'BHU', 'Bolivia' => 'BOL', 'Bosnia&Herzegovina' => 'BIH', 'Botswana' => 'BOT', 'Brazil' => 'BRA', 'Brunei' => 'BRU', 'Bulgaria' => 'BUL', 'Burkina Faso' => 'BUR', 'Burundi' => 'BDI', 'Cambodia' => 'CAM', 'Cameroon' => 'CAR', // actually CMR $nations = array('Afghanistan' => 'AFG', 'Albania' => 'ALB', 'Algeria' => 'ALG', 'Andorra' => 'AND', 'Angola' => 'ANG', 'Argentina' => 'ARG', 'Armenia' => 'ARM', 'Aruba' => 'ARU',
'Canada' => 'CAN', 'Cape Verde' => 'CPV', 'Central African Republic' => 'CAF', 'Chad' => 'CHA', 'Chile' => 'CHI', 'China' => 'CHN', 'Chinese Taipei' => 'TPE', 'Colombia' => 'COL', 'Congo' => 'CGO', 'Costa Rica' => 'CRC', 'Croatia' => 'CRO', 'Cuba' => 'CUB', 'Cyprus' => 'CYP', 'Czech Republic' => 'CZE', 'Czech republic' => 'CZE', 'DR Congo' => 'COD', 'Denmark' => 'DEN', 'Djibouti' => 'DJI', 'Dominica' => 'DMA', 'Dominican Republic' => 'DOM', 'Ecuador' => 'ECU', 'Egypt' => 'EGY', 'El Salvador' => 'ESA', 'Eritrea' => 'ERI', 'Estonia' => 'EST', 'Ethiopia' => 'ETH', 'Fiji' => 'FIJ', 'Finland' => 'FIN', 'France' => 'FRA', 'Gabon' => 'GAB', 'Gambia' => 'GAM', 'Georgia' => 'GEO', 'Germany' => 'GER', 'Ghana' => 'GHA', 'Greece' => 'GRE', 'Grenada' => 'GRN', 'Guam' => 'GUM', 'Guatemala' => 'GUA', 'Guinea' => 'GUI', 'Guinea-Bissau' => 'GBS', 'Guyana' => 'GUY', 'Haiti' => 'HAI', 'Honduras' => 'HON', 'Hong Kong' => 'HKG', 'Hungary' => 'HUN', 'Iceland' => 'ISL', 'India' => 'IND', 'Indonesia' => 'INA', 'Iran' => 'IRI', 'Iraq' => 'IRQ', 'Ireland' => 'IRL', 'Israel' => 'ISR', 'Italy' => 'ITA', 'Ivory Coast' => 'CIV', 'Jamaica' => 'JAM', 'Japan' => 'JPN', 'Jordan' => 'JOR', 'Kazakhstan' => 'KAZ', 'Kenya' => 'KEN', 'Kiribati' => 'KIR', 'Korea' => 'KOR', 'Kuwait' => 'KUW', 'Kyrgyzstan' => 'KGZ', 'Laos' => 'LAO', 'Latvia' => 'LAT', 'Lebanon' => 'LIB', 'Lesotho' => 'LES', 'Liberia' => 'LBR', 'Libya' => 'LBA', 'Liechtenstein' => 'LIE', 'Lithuania' => 'LTU', 'Luxembourg' => 'LUX', 'Macedonia' => 'MKD', 'Malawi' => 'MAW', 'Malaysia' => 'MAS', 'Mali' => 'MLI', 'Malta' => 'MLT', 'Mauritania' => 'MTN', 'Mauritius' => 'MRI', 'Mexico' => 'MEX', 'Moldova' => 'MDA', 'Monaco' => 'MON', 'Mongolia' => 'MGL', 'Montenegro' => 'MNE', 'Morocco' => 'MAR', 'Mozambique' => 'MOZ', 'Myanmar' => 'MYA', 'Namibia' => 'NAM', 'Nauru' => 'NRU', 'Nepal' => 'NEP', 'Netherlands' => 'NED', 'New Zealand' => 'NZL', 'Nicaragua' => 'NCA', 'Niger' => 'NIG', 'Nigeria' => 'NGR', 'Norway' => 'NOR', 'Oman' => 'OMA', 'Other Countries' => 'OTH', 'Pakistan' => 'PAK', 'Palau' => 'PLW', 'Palestine' => 'PLE', 'Panama' => 'PAN', 'Paraguay' => 'PAR', 'Peru' => 'PER', 'Philippines' => 'PHI', 'Poland' => 'POL', 'Portugal' => 'POR', 'Puerto Rico' => 'PUR', 'Qatar' => 'QAT', 'Romania' => 'ROM', // actually ROU 'Australia' => 'AUS', 'Austria' => 'AUT', 'Azerbaijan' => 'AZE', 'Bahamas' => 'BAH', 'Bahrain' => 'BRN', 'Bangladesh' => 'BAN', 'Barbados' => 'BAR',
'Russia' => 'RUS', 'Rwanda' => 'RWA', 'Samoa' => 'SAM', 'San Marino' => 'SMR', 'Saudi Arabia' => 'KSA', 'Senegal' => 'SEN', 'Serbia' => 'SCG', // actually SRB 'Belarus' => 'BLR', 'Belgium' => 'BEL', 'Belize' => 'BIZ', 'Benin' => 'BEN', 'Bermuda' => 'BER', 'Bhutan' => 'BHU', 'Bolivia' => 'BOL',
'Sierra Leone' => 'SLE', 'Singapore' => 'SIN', 'Slovakia' => 'SVK', 'Slovenia' => 'SLO', 'Somalia' => 'SOM', 'South Africa' => 'RSA', 'Spain' => 'ESP', 'Sri Lanka' => 'SRI', 'Sudan' => 'SUD', 'Suriname' => 'SUR', 'Swaziland' => 'SWZ', 'Sweden' => 'SWE', 'Switzerland' => 'SUI', 'Syria' => 'SYR', 'Taiwan' => 'TWN', 'Tajikistan' => 'TJK', 'Tanzania' => 'TAN', 'Thailand' => 'THA', 'Togo' => 'TOG', 'Tonga' => 'TGA', 'Trinidad and Tobago' => 'TRI', 'Tunisia' => 'TUN', 'Turkey' => 'TUR', 'Turkmenistan' => 'TKM', 'Tuvalu' => 'TUV', 'Uganda' => 'UGA', 'Ukraine' => 'UKR', 'United Arab Emirates' => 'UAE', 'United Kingdom' => 'GBR', 'United States of America' => 'USA', 'Uruguay' => 'URU', 'Uzbekistan' => 'UZB', 'Vanuatu' => 'VAN', 'Venezuela' => 'VEN', 'Vietnam' => 'VIE', 'Yemen' => 'YEM', 'Zambia' => 'ZAM', 'Zimbabwe' => 'ZIM'); 'Bosnia&Herzegovina' => 'BIH', 'Botswana' => 'BOT', 'Brazil' => 'BRA', 'Brunei' => 'BRU', 'Bulgaria' => 'BUL', 'Burkina Faso' => 'BUR', 'Burundi' => 'BDI',
'Cambodia' => 'CAM', 'Cameroon' => 'CAR', // actually CMR
'Canada' => 'CAN', 'Cape Verde' => 'CPV', 'Central African Republic' => 'CAF', 'Chad' => 'CHA', 'Chile' => 'CHI', 'China' => 'CHN',
'Chinese Taipei' => 'TPE', 'Colombia' => 'COL', 'Congo' => 'CGO', 'Costa Rica' => 'CRC', 'Croatia' => 'CRO', 'Cuba' => 'CUB', 'Cyprus' => 'CYP',
'Czech Republic' => 'CZE', 'Czech republic' => 'CZE', 'DR Congo' => 'COD', 'Denmark' => 'DEN', 'Djibouti' => 'DJI', 'Dominica' => 'DMA',
'Dominican Republic' => 'DOM', 'Ecuador' => 'ECU', 'Egypt' => 'EGY', 'El Salvador' => 'ESA', 'Eritrea' => 'ERI', 'Estonia' => 'EST', 'Ethiopia' => 'ETH',
'Fiji' => 'FIJ', 'Finland' => 'FIN', 'France' => 'FRA', 'Gabon' => 'GAB', 'Gambia' => 'GAM', 'Georgia' => 'GEO', 'Germany' => 'GER', 'Ghana' => 'GHA',
'Greece' => 'GRE', 'Grenada' => 'GRN', 'Guam' => 'GUM', 'Guatemala' => 'GUA', 'Guinea' => 'GUI', 'Guinea-Bissau' => 'GBS', 'Guyana' => 'GUY',
'Haiti' => 'HAI', 'Honduras' => 'HON', 'Hong Kong' => 'HKG', 'Hungary' => 'HUN', 'Iceland' => 'ISL', 'India' => 'IND', 'Indonesia' => 'INA',
'Iran' => 'IRI', 'Iraq' => 'IRQ', 'Ireland' => 'IRL', 'Israel' => 'ISR', 'Italy' => 'ITA', 'Ivory Coast' => 'CIV', 'Jamaica' => 'JAM', 'Japan' => 'JPN',
'Jordan' => 'JOR', 'Kazakhstan' => 'KAZ', 'Kenya' => 'KEN', 'Kiribati' => 'KIR', 'Korea' => 'KOR', 'Kuwait' => 'KUW', 'Kyrgyzstan' => 'KGZ', 'Laos' => 'LAO',
'Latvia' => 'LAT', 'Lebanon' => 'LIB', 'Lesotho' => 'LES', 'Liberia' => 'LBR', 'Libya' => 'LBA', 'Liechtenstein' => 'LIE', 'Lithuania' => 'LTU',
'Luxembourg' => 'LUX', 'Macedonia' => 'MKD', 'Malawi' => 'MAW', 'Malaysia' => 'MAS', 'Mali' => 'MLI', 'Malta' => 'MLT', 'Mauritania' => 'MTN',
'Mauritius' => 'MRI', 'Mexico' => 'MEX', 'Moldova' => 'MDA', 'Monaco' => 'MON', 'Mongolia' => 'MGL', 'Montenegro' => 'MNE', 'Morocco' => 'MAR',
'Mozambique' => 'MOZ', 'Myanmar' => 'MYA', 'Namibia' => 'NAM', 'Nauru' => 'NRU', 'Nepal' => 'NEP', 'Netherlands' => 'NED', 'New Zealand' => 'NZL',
'Nicaragua' => 'NCA', 'Niger' => 'NIG', 'Nigeria' => 'NGR', 'Norway' => 'NOR', 'Oman' => 'OMA', 'Other Countries' => 'OTH', 'Pakistan' => 'PAK',
'Palau' => 'PLW', 'Palestine' => 'PLE', 'Panama' => 'PAN', 'Paraguay' => 'PAR', 'Peru' => 'PER', 'Philippines' => 'PHI', 'Poland' => 'POL',
'Portugal' => 'POR', 'Puerto Rico' => 'PUR', 'Qatar' => 'QAT', 'Romania' => 'ROM', // actually ROU
'Russia' => 'RUS', 'Rwanda' => 'RWA', 'Samoa' => 'SAM', 'San Marino' => 'SMR', 'Saudi Arabia' => 'KSA', 'Senegal' => 'SEN', 'Serbia' => 'SCG',
// actually SRB
'Sierra Leone' => 'SLE', 'Singapore' => 'SIN', 'Slovakia' => 'SVK', 'Slovenia' => 'SLO', 'Somalia' => 'SOM', 'South Africa' => 'RSA', 'Spain' => 'ESP',
'Sri Lanka' => 'SRI', 'Sudan' => 'SUD', 'Suriname' => 'SUR', 'Swaziland' => 'SWZ', 'Sweden' => 'SWE', 'Switzerland' => 'SUI', 'Syria' => 'SYR',
'Taiwan' => 'TWN', 'Tajikistan' => 'TJK', 'Tanzania' => 'TAN', 'Thailand' => 'THA', 'Togo' => 'TOG', 'Tonga' => 'TGA', 'Trinidad and Tobago' => 'TRI',
'Tunisia' => 'TUN', 'Turkey' => 'TUR', 'Turkmenistan' => 'TKM', 'Tuvalu' => 'TUV', 'Uganda' => 'UGA', 'Ukraine' => 'UKR', 'United Arab Emirates' => 'UAE',
'United Kingdom' => 'GBR', 'United States of America' => 'USA', 'Uruguay' => 'URU', 'Uzbekistan' => 'UZB', 'Vanuatu' => 'VAN', 'Venezuela' => 'VEN',
'Vietnam' => 'VIE', 'Yemen' => 'YEM', 'Zambia' => 'ZAM', 'Zimbabwe' => 'ZIM');
if (array_key_exists($country, $nations)) { if (array_key_exists($country, $nations)) {
return $nations[$country]; return $nations[$country];
} }

View File

@ -9,6 +9,7 @@ use ManiaControl\ManiaControl;
/** /**
* Reader Utility Class for efficient Web Requests * Reader Utility Class for efficient Web Requests
* *
* @see \ManiaControl\Files\AsyncHttpRequest For Asynchron Requests
* @author ManiaControl Team <mail@maniacontrol.com> * @author ManiaControl Team <mail@maniacontrol.com>
* @copyright 2014-2017 ManiaControl Team * @copyright 2014-2017 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3 * @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
@ -51,12 +52,12 @@ abstract class WebReader {
protected static function newRequest($url) { protected static function newRequest($url) {
$request = new Request($url); $request = new Request($url);
$options = $request->getOptions(); $options = $request->getOptions();
$options->set(CURLOPT_TIMEOUT, 5) // timeout $options->set(CURLOPT_TIMEOUT, 5)// timeout
->set(CURLOPT_HEADER, false) // don't display response header ->set(CURLOPT_HEADER, false)// don't display response header
->set(CURLOPT_CRLF, true) // linux line feed ->set(CURLOPT_CRLF, true)// linux line feed
->set(CURLOPT_ENCODING, '') // accept encoding ->set(CURLOPT_ENCODING, '')// accept encoding
->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION) // user-agent ->set(CURLOPT_USERAGENT, 'ManiaControl v' . ManiaControl::VERSION)// user-agent
->set(CURLOPT_RETURNTRANSFER, true) // return instead of output content ->set(CURLOPT_RETURNTRANSFER, true)// return instead of output content
->set(CURLOPT_AUTOREFERER, true); // follow redirects ->set(CURLOPT_AUTOREFERER, true); // follow redirects
return $request; return $request;
} }