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

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

View File

@ -12,6 +12,8 @@ use ManiaControl\Callbacks\EchoListener;
use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkManager;
@ -30,7 +32,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014-2017 ManiaControl Team
* @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
*/

View File

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

View File

@ -10,6 +10,8 @@ use ManiaControl\Callbacks\TimerListener;
use ManiaControl\Communication\CommunicationAnswer;
use ManiaControl\Communication\CommunicationListener;
use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\General\UsageInformationAble;
use ManiaControl\General\UsageInformationTrait;
use ManiaControl\Logger;
use ManiaControl\ManiaControl;
use ManiaControl\Statistics\StatisticManager;
@ -23,7 +25,9 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014-2017 ManiaControl Team
* @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
*/