added, fixed & improved PHPDoc & Type Hints
This commit is contained in:
parent
7469d97712
commit
212517d290
@ -72,6 +72,7 @@ else {
|
|||||||
* Log and echo the given text
|
* Log and echo the given text
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
|
* @param bool $eol
|
||||||
*/
|
*/
|
||||||
function logMessage($message, $eol = true) {
|
function logMessage($message, $eol = true) {
|
||||||
$date = date("d.M y H:i:s");
|
$date = date("d.M y H:i:s");
|
||||||
|
@ -227,7 +227,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Reopen the widget on Map Begin, MapListChanged, etc.
|
* Reopen the widget on Map Begin, MapListChanged, etc.
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function updateWidget(Player $player) {
|
public function updateWidget(Player $player) {
|
||||||
foreach($this->adminListShown as $login => $shown) {
|
foreach($this->adminListShown as $login => $shown) {
|
||||||
|
@ -28,9 +28,9 @@ class AuthCommands implements CommandListener {
|
|||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
// Register for commands
|
// Register for commands
|
||||||
$this->maniaControl->commandManager->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin',true, 'Adds player to adminlist as SuperAdmin.');
|
$this->maniaControl->commandManager->registerCommandListener('addsuperadmin', $this, 'command_AddSuperAdmin',true, 'Add Player to the AdminList as SuperAdmin.');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('addadmin', $this, 'command_AddAdmin',true, 'Adds player to adminlist as Admin.');
|
$this->maniaControl->commandManager->registerCommandListener('addadmin', $this, 'command_AddAdmin',true, 'Add Player to the AdminList as Admin.');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator',true, 'Add player to adminlist as Moderator.');
|
$this->maniaControl->commandManager->registerCommandListener('addmod', $this, 'command_AddModerator',true, 'Add Player to the AdminList as Moderator.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@ class BillData {
|
|||||||
public $function = null;
|
public $function = null;
|
||||||
public $pay = false;
|
public $pay = false;
|
||||||
public $player = null;
|
public $player = null;
|
||||||
public $receiverLogin = false;
|
public $receiverLogin = null;
|
||||||
public $amount = 0;
|
public $amount = 0;
|
||||||
public $creationTime = -1;
|
public $creationTime = -1;
|
||||||
|
|
||||||
@ -26,10 +26,10 @@ class BillData {
|
|||||||
* @param mixed $function
|
* @param mixed $function
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param int $amount
|
* @param int $amount
|
||||||
* @param string $pay
|
* @param bool $pay
|
||||||
* @param string $receiverLogin
|
* @param string $receiverLogin
|
||||||
*/
|
*/
|
||||||
public function __construct($function, $player, $amount, $pay = false, $receiverLogin = false) {
|
public function __construct($function, Player $player, $amount, $pay = false, $receiverLogin = null) {
|
||||||
$this->function = $function;
|
$this->function = $function;
|
||||||
$this->player = $player;
|
$this->player = $player;
|
||||||
$this->amount = $amount;
|
$this->amount = $amount;
|
||||||
|
@ -5,6 +5,13 @@ namespace ManiaControl\Callbacks;
|
|||||||
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class managing & converting LibXmlRpc Callbacks
|
||||||
|
*
|
||||||
|
* @author ManiaControl Team
|
||||||
|
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
|
||||||
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
||||||
|
*/
|
||||||
class LibXmlRpcCallbackManager implements CallbackListener {
|
class LibXmlRpcCallbackManager implements CallbackListener {
|
||||||
/*
|
/*
|
||||||
* Private Properties
|
* Private Properties
|
||||||
@ -15,6 +22,7 @@ class LibXmlRpcCallbackManager implements CallbackListener {
|
|||||||
* Create a new LibXmlRpc Callbacks Instance
|
* Create a new LibXmlRpc Callbacks Instance
|
||||||
*
|
*
|
||||||
* @param ManiaControl $maniaControl
|
* @param ManiaControl $maniaControl
|
||||||
|
* @param CallbackManager $callbackManager
|
||||||
*/
|
*/
|
||||||
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
|
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
@ -24,10 +32,10 @@ class LibXmlRpcCallbackManager implements CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Handle Script Callbacks
|
* Handle Script Callbacks
|
||||||
*
|
*
|
||||||
* @param $name
|
* @param string $name
|
||||||
* @param $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
public function handleScriptCallbacks($name, $data) {
|
public function handleScriptCallbacks($name, array $data) {
|
||||||
switch($name) {
|
switch($name) {
|
||||||
case 'LibXmlRpc_BeginMatch':
|
case 'LibXmlRpc_BeginMatch':
|
||||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMATCH, $data[0]);
|
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMATCH, $data[0]);
|
||||||
@ -76,9 +84,9 @@ class LibXmlRpcCallbackManager implements CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Triggers the Ranking of a Player
|
* Triggers the Ranking of a Player
|
||||||
*
|
*
|
||||||
* @param $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
private function triggerPlayerRanking($data) {
|
private function triggerPlayerRanking(array $data) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($data[1]);
|
$player = $this->maniaControl->playerManager->getPlayer($data[1]);
|
||||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::PLAYERRANKING, $player, $data[0], $data[6], $data[5]);
|
$this->maniaControl->callbackManager->triggerCallback(Callbacks::PLAYERRANKING, $player, $data[0], $data[6], $data[5]);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ class ShootManiaCallbacks implements CallbackListener {
|
|||||||
* Create a new ShootMania Callbacks Instance
|
* Create a new ShootMania Callbacks Instance
|
||||||
*
|
*
|
||||||
* @param ManiaControl $maniaControl
|
* @param ManiaControl $maniaControl
|
||||||
|
* @param CallbackManager $callbackManager
|
||||||
*/
|
*/
|
||||||
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
|
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
@ -55,11 +55,12 @@ class TimerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a Timing Listening, note < 10ms it can get inaccurate
|
* Register a Timer Listening, note < 10ms it can get inaccurate
|
||||||
*
|
*
|
||||||
* @param TimerListener $listener
|
* @param TimerListener $listener
|
||||||
* @param $method
|
* @param string $method
|
||||||
* @param $time
|
* @param float $time
|
||||||
|
* @param bool $oneTime
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function registerTimerListening(TimerListener $listener, $method, $time, $oneTime = false) {
|
public function registerTimerListening(TimerListener $listener, $method, $time, $oneTime = false) {
|
||||||
|
@ -131,14 +131,14 @@ class Chat {
|
|||||||
/**
|
/**
|
||||||
* Send the Exception Information to the Chat
|
* Send the Exception Information to the Chat
|
||||||
*
|
*
|
||||||
* @param Exception $exception
|
* @param \Exception $exception
|
||||||
* @param string $login
|
* @param string $login
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function sendException(\Exception $exception, $login = null) {
|
public function sendException(\Exception $exception, $login = null) {
|
||||||
$message = "Exception occurred: '{$exception->getMessage()}' ({$exception->getCode()})";
|
$message = "Exception occurred: '{$exception->getMessage()}' ({$exception->getCode()})";
|
||||||
$this->maniaControl->errorHandler->triggerDebugNotice($message);
|
$this->maniaControl->errorHandler->triggerDebugNotice($message);
|
||||||
$this->sendError($message, $login);
|
return $this->sendError($message, $login);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,6 +103,7 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
* Handle Config Admin Command
|
* Handle Config Admin Command
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function handleConfigCommand(array $callback, Player $player) {
|
public function handleConfigCommand(array $callback, Player $player) {
|
||||||
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_OPEN_CONFIGURATOR)) {
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_OPEN_CONFIGURATOR)) {
|
||||||
@ -123,11 +124,12 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reopens the Menu
|
* Reopen the Menu
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param Player $player
|
||||||
|
* @param int $menuId
|
||||||
*/
|
*/
|
||||||
public function reopenMenu($player, $menuId = 0) {
|
public function reopenMenu(Player $player, $menuId = 0) {
|
||||||
$this->showMenu($player, $menuId);
|
$this->showMenu($player, $menuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,10 +242,10 @@ class Configurator implements CallbackListener, CommandListener, ManialinkPageAn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build menu manialink if necessary
|
* Build Menu ManiaLink if necessary
|
||||||
*
|
*
|
||||||
* @param int $menuIdShown
|
* @param int $menuIdShown
|
||||||
* @internal param bool $forceBuild
|
* @param Player $player
|
||||||
* @return \FML\ManiaLink
|
* @return \FML\ManiaLink
|
||||||
*/
|
*/
|
||||||
private function buildManialink($menuIdShown = 0, Player $player) {
|
private function buildManialink($menuIdShown = 0, Player $player) {
|
||||||
|
@ -399,7 +399,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
*
|
*
|
||||||
* @param array $newSettings
|
* @param array $newSettings
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
private function applyNewScriptSettings(array $newSettings, Player $player) {
|
||||||
if (!$newSettings) {
|
if (!$newSettings) {
|
||||||
|
@ -43,9 +43,9 @@ class ErrorHandler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ManiaControl ExceptionHandler
|
* ManiaControl ExceptionHandler
|
||||||
* ManiaControl Shuts down after exception
|
|
||||||
*
|
*
|
||||||
* @param \Exception $ex
|
* @param \Exception $ex
|
||||||
|
* @param bool $shutdown
|
||||||
*/
|
*/
|
||||||
public function exceptionHandler(\Exception $ex, $shutdown = true) {
|
public function exceptionHandler(\Exception $ex, $shutdown = true) {
|
||||||
// Log exception
|
// Log exception
|
||||||
|
@ -55,8 +55,9 @@ class AsynchronousFileReader {
|
|||||||
* Load a remote file
|
* Load a remote file
|
||||||
*
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
* @param $function
|
* @param callable $function
|
||||||
* @param string $contentType
|
* @param string $contentType
|
||||||
|
* @param int $keepAlive
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function loadFile($url, $function, $contentType = 'UTF-8', $keepAlive = 0) {
|
public function loadFile($url, $function, $contentType = 'UTF-8', $keepAlive = 0) {
|
||||||
@ -118,10 +119,10 @@ class AsynchronousFileReader {
|
|||||||
/**
|
/**
|
||||||
* Send Data via POST Method
|
* Send Data via POST Method
|
||||||
*
|
*
|
||||||
* @param $url
|
* @param string $url
|
||||||
* @param $function
|
* @param callable $function
|
||||||
* @param $content
|
* @param string $content
|
||||||
* @param string $compression
|
* @param bool $compression
|
||||||
* @param string $contentType
|
* @param string $contentType
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -167,6 +167,7 @@ class ManiaControl implements CommandListener, TimerListener {
|
|||||||
* Print a message to console and log
|
* Print a message to console and log
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
|
* @param bool $stripCodes
|
||||||
*/
|
*/
|
||||||
public function log($message, $stripCodes = false) {
|
public function log($message, $stripCodes = false) {
|
||||||
if ($stripCodes) {
|
if ($stripCodes) {
|
||||||
|
@ -312,6 +312,11 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle ManialinkPageAnswer Callback
|
||||||
|
*
|
||||||
|
* @param array $callback
|
||||||
|
*/
|
||||||
public function handleManialinkPageAnswer(array $callback) {
|
public function handleManialinkPageAnswer(array $callback) {
|
||||||
$actionId = $callback[1][2];
|
$actionId = $callback[1][2];
|
||||||
|
|
||||||
@ -357,7 +362,12 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function showMapListAuthor($author, $player) {
|
/**
|
||||||
|
* Show the Player a List of Maps from the given Author
|
||||||
|
* @param string $author
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
private function showMapListAuthor($author, Player $player) {
|
||||||
$maps = $this->maniaControl->mapManager->getMaps();
|
$maps = $this->maniaControl->mapManager->getMaps();
|
||||||
$mapList = array();
|
$mapList = array();
|
||||||
/** @var Map $map */
|
/** @var Map $map */
|
||||||
@ -375,7 +385,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
$this->maniaControl->mapManager->mapList->showMapList($player, $mapList);
|
$this->maniaControl->mapManager->mapList->showMapList($player, $mapList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function showMapListKarma($best, $player) {
|
/**
|
||||||
|
* Show a Karma based MapList
|
||||||
|
*
|
||||||
|
* @param bool $best
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
private function showMapListKarma($best, Player $player) {
|
||||||
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
|
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
|
||||||
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);
|
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);
|
||||||
if($karmaPlugin) {
|
if($karmaPlugin) {
|
||||||
@ -418,15 +434,28 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper Function to sort Maps by Karma
|
||||||
|
*
|
||||||
|
* @param Map $a
|
||||||
|
* @param Map $b
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
private function sortByKarma($a, $b) {
|
private function sortByKarma($a, $b) {
|
||||||
return $a->karma - $b->karma;
|
return ($a->karma - $b->karma);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function showMapListDate($newest, $player) {
|
/**
|
||||||
|
* Show a Date based MapList
|
||||||
|
*
|
||||||
|
* @param bool $newest
|
||||||
|
* @param Player $player
|
||||||
|
*/
|
||||||
|
private function showMapListDate($newest, Player $player) {
|
||||||
$maps = $this->maniaControl->mapManager->getMaps();
|
$maps = $this->maniaControl->mapManager->getMaps();
|
||||||
|
|
||||||
usort($maps, function($a, $b) {
|
usort($maps, function($a, $b) {
|
||||||
return $a->index - $b->index;
|
return ($a->index - $b->index);
|
||||||
});
|
});
|
||||||
|
|
||||||
if($newest) {
|
if($newest) {
|
||||||
|
@ -170,14 +170,17 @@ class MapManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the Timestamp of a map
|
* Update the Timestamp of a Map
|
||||||
*
|
*
|
||||||
* @param $map
|
* @param string $uid
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function updateMapTimestamp($uid) {
|
private function updateMapTimestamp($uid) {
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
$mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET mxid = 0, changed = NOW() WHERE 'uid' = ?";
|
$mapQuery = "UPDATE `" . self::TABLE_MAPS . "` SET
|
||||||
|
mxid = 0,
|
||||||
|
changed = NOW()
|
||||||
|
WHERE 'uid' = ?";
|
||||||
|
|
||||||
$mapStatement = $mysqli->prepare($mapQuery);
|
$mapStatement = $mysqli->prepare($mapQuery);
|
||||||
if ($mysqli->error) {
|
if ($mysqli->error) {
|
||||||
@ -196,17 +199,16 @@ class MapManager implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a Map from Mania Exchange
|
* Update a Map from Mania Exchange
|
||||||
*
|
*
|
||||||
* @param Player $admin
|
* @param Player $admin
|
||||||
* @param $mxId
|
* @param string $uid
|
||||||
* @param $uid
|
|
||||||
*/
|
*/
|
||||||
public function updateMap(Player $admin, $uid) {
|
public function updateMap(Player $admin, $uid) {
|
||||||
$this->updateMapTimestamp($uid);
|
$this->updateMapTimestamp($uid);
|
||||||
|
|
||||||
if (!isset($uid) || !isset($this->maps[$uid])) {
|
if (!isset($uid) || !isset($this->maps[$uid])) {
|
||||||
trigger_error("Error while updating Map, unkown UID: " . $uid);
|
trigger_error("Error while updating Map, unknown UID: " . $uid);
|
||||||
$this->maniaControl->chat->sendError("Error while updating Map.", $admin->login);
|
$this->maniaControl->chat->sendError("Error while updating Map.", $admin->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -560,6 +562,8 @@ class MapManager implements CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Get all Maps
|
* Get all Maps
|
||||||
*
|
*
|
||||||
|
* @param int $offset
|
||||||
|
* @param int $length
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getMaps($offset = null, $length = null) {
|
public function getMaps($offset = null, $length = null) {
|
||||||
|
@ -203,7 +203,6 @@ class PlayerActions {
|
|||||||
*
|
*
|
||||||
* @param string $adminLogin
|
* @param string $adminLogin
|
||||||
* @param string $targetLogin
|
* @param string $targetLogin
|
||||||
* @param int $spectatorState
|
|
||||||
*/
|
*/
|
||||||
public function unMutePlayer($adminLogin, $targetLogin) {
|
public function unMutePlayer($adminLogin, $targetLogin) {
|
||||||
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||||
@ -236,7 +235,6 @@ class PlayerActions {
|
|||||||
*
|
*
|
||||||
* @param string $adminLogin
|
* @param string $adminLogin
|
||||||
* @param string $targetLogin
|
* @param string $targetLogin
|
||||||
* @param int $spectatorState
|
|
||||||
*/
|
*/
|
||||||
public function mutePlayer($adminLogin, $targetLogin) {
|
public function mutePlayer($adminLogin, $targetLogin) {
|
||||||
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
|
||||||
|
@ -167,8 +167,8 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
|||||||
* @param array $chatCallback
|
* @param array $chatCallback
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function command_Warn(array $chat, Player $player) {
|
public function command_Warn(array $chatCallback, Player $player) {
|
||||||
$params = explode(' ', $chat[1][2], 3);
|
$params = explode(' ', $chatCallback[1][2], 3);
|
||||||
if (count($params) <= 1) {
|
if (count($params) <= 1) {
|
||||||
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
|
||||||
return;
|
return;
|
||||||
|
@ -116,16 +116,16 @@ class PlayerDataManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the Player Data
|
* Gets the Player Data
|
||||||
*
|
*
|
||||||
* @param $object
|
* @param mixed $object
|
||||||
* @param $dataName
|
* @param string $dataName
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param $serverIndex
|
* @param int $serverIndex
|
||||||
* @return mixed|null
|
* @return mixed|null
|
||||||
*/
|
*/
|
||||||
public function getPlayerData($object, $statName, Player $player, $serverIndex = -1) {
|
public function getPlayerData($object, $dataName, Player $player, $serverIndex = -1) {
|
||||||
$className = $this->getClassName($object);
|
$className = $this->getClassName($object);
|
||||||
|
|
||||||
$meta = $this->metaData[$className . $statName];
|
$meta = $this->metaData[$className . $dataName];
|
||||||
|
|
||||||
//Check if data is already in the ram
|
//Check if data is already in the ram
|
||||||
if (isset($this->storedData[$player->index])) {
|
if (isset($this->storedData[$player->index])) {
|
||||||
@ -152,7 +152,7 @@ class PlayerDataManager {
|
|||||||
}
|
}
|
||||||
$dataStatement->store_result();
|
$dataStatement->store_result();
|
||||||
if ($dataStatement->num_rows <= 0) {
|
if ($dataStatement->num_rows <= 0) {
|
||||||
$this->setPlayerData($object, $statName, $player, $meta->defaultValue, $serverIndex);
|
$this->setPlayerData($object, $dataName, $player, $meta->defaultValue, $serverIndex);
|
||||||
return $meta->default;
|
return $meta->default;
|
||||||
}
|
}
|
||||||
$dataStatement->bind_result($value);
|
$dataStatement->bind_result($value);
|
||||||
@ -172,11 +172,11 @@ class PlayerDataManager {
|
|||||||
/**
|
/**
|
||||||
* Set a PlayerData to a specific defined statMetaData
|
* Set a PlayerData to a specific defined statMetaData
|
||||||
*
|
*
|
||||||
* @param $object
|
* @param mixed $object
|
||||||
* @param $statName
|
* @param string $dataName
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param $value
|
* @param mixed $value
|
||||||
* @param $serverIndex (let it empty if its global)
|
* @param int $serverIndex (let it empty if its global)
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setPlayerData($object, $dataName, Player $player, $value, $serverIndex = -1) {
|
public function setPlayerData($object, $dataName, Player $player, $value, $serverIndex = -1) {
|
||||||
@ -225,7 +225,8 @@ class PlayerDataManager {
|
|||||||
/**
|
/**
|
||||||
* Return the Id of the MetaData
|
* Return the Id of the MetaData
|
||||||
*
|
*
|
||||||
* @param $statName
|
* @param string $className
|
||||||
|
* @param string $statName
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function getMetaDataId($className, $statName) {
|
private function getMetaDataId($className, $statName) {
|
||||||
|
@ -14,6 +14,7 @@ use ManiaControl\Formatter;
|
|||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
use ManiaControl\Statistics\StatisticManager;
|
use ManiaControl\Statistics\StatisticManager;
|
||||||
|
use Maniaplanet\DedicatedServer\Structures\Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player Detailed Page
|
* Player Detailed Page
|
||||||
@ -48,8 +49,14 @@ class PlayerDetailed {
|
|||||||
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show a Frame with detailed Information about the Target Player
|
||||||
|
*
|
||||||
|
* @param Player $player
|
||||||
|
* @param string $targetLogin
|
||||||
|
*/
|
||||||
public function showPlayerDetailed(Player $player, $targetLogin) {
|
public function showPlayerDetailed(Player $player, $targetLogin) {
|
||||||
|
/** @var Player $target */
|
||||||
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
$target = $this->maniaControl->playerManager->getPlayer($targetLogin);
|
||||||
|
|
||||||
//Create ManiaLink
|
//Create ManiaLink
|
||||||
@ -209,7 +216,13 @@ class PlayerDetailed {
|
|||||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'PlayerDetailed');
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'PlayerDetailed');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function statisticsFrame($player) {
|
/**
|
||||||
|
* Build a Frame with Statistics about the given Player
|
||||||
|
*
|
||||||
|
* @param Player $player
|
||||||
|
* @return Frame
|
||||||
|
*/
|
||||||
|
public function statisticsFrame(Player $player) {
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
|
|
||||||
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
|
$playerStats = $this->maniaControl->statisticManager->getAllPlayerStats($player);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Players;
|
namespace ManiaControl\Players;
|
||||||
|
|
||||||
|
use Maniaplanet\DedicatedServer\Structures\Player;
|
||||||
use MCTeam\CustomVotesPlugin;
|
use MCTeam\CustomVotesPlugin;
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
@ -412,10 +413,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
|||||||
/**
|
/**
|
||||||
* Extra window with special actions on players like warn,kick, ban, authorization levels...
|
* Extra window with special actions on players like warn,kick, ban, authorization levels...
|
||||||
*
|
*
|
||||||
* @param $login
|
* @param Player $admin
|
||||||
|
* @param string $login
|
||||||
* @return Frame
|
* @return Frame
|
||||||
*/
|
*/
|
||||||
public function showAdvancedPlayerWidget($admin, $login) {
|
public function showAdvancedPlayerWidget(Player $admin, $login) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||||
|
@ -306,7 +306,7 @@ class PlayerManager implements CallbackListener, TimerListener {
|
|||||||
*
|
*
|
||||||
* @param string $login
|
* @param string $login
|
||||||
* @param bool $connectedPlayersOnly
|
* @param bool $connectedPlayersOnly
|
||||||
* @return Player|null
|
* @return Player
|
||||||
*/
|
*/
|
||||||
public function getPlayer($login, $connectedPlayersOnly = false) {
|
public function getPlayer($login, $connectedPlayersOnly = false) {
|
||||||
if (!isset($this->players[$login])) {
|
if (!isset($this->players[$login])) {
|
||||||
@ -390,10 +390,10 @@ class PlayerManager implements CallbackListener, TimerListener {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get's a Player out of the database
|
* Get a Player from the Database
|
||||||
*
|
*
|
||||||
* @param $playerIndex
|
* @param string $playerLogin
|
||||||
* @return Player $player
|
* @return Player
|
||||||
*/
|
*/
|
||||||
private function getPlayerFromDatabaseByLogin($playerLogin) {
|
private function getPlayerFromDatabaseByLogin($playerLogin) {
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
@ -58,6 +58,7 @@ class PluginInstallMenu implements CallbackListener, ConfiguratorMenu, Manialink
|
|||||||
* @param float $width
|
* @param float $width
|
||||||
* @param float $height
|
* @param float $height
|
||||||
* @param Script $script
|
* @param Script $script
|
||||||
|
* @param Player $player
|
||||||
* @return \FML\Controls\Frame
|
* @return \FML\Controls\Frame
|
||||||
*/
|
*/
|
||||||
public function getMenu($width, $height, Script $script, Player $player) {
|
public function getMenu($width, $height, Script $script, Player $player) {
|
||||||
|
@ -396,7 +396,7 @@ class PluginManager {
|
|||||||
/**
|
/**
|
||||||
* Get the Class of the Object
|
* Get the Class of the Object
|
||||||
*
|
*
|
||||||
* @param mixed $pluginClass
|
* @param mixed $object
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function getClass($object) {
|
private static function getClass($object) {
|
||||||
|
@ -190,9 +190,10 @@ class ServerCommands implements CallbackListener, CommandListener, ManialinkPage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Breaks the current game
|
* Pause the current game
|
||||||
*
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function setPause(array $callback, Player $player) {
|
public function setPause(array $callback, Player $player) {
|
||||||
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SET_PAUSE)) {
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_SET_PAUSE)) {
|
||||||
|
@ -441,6 +441,7 @@ class SettingManager implements CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Get all Setting Classes
|
* Get all Setting Classes
|
||||||
*
|
*
|
||||||
|
* @param bool $hidePluginClasses
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getSettingClasses($hidePluginClasses = false) {
|
public function getSettingClasses($hidePluginClasses = false) {
|
||||||
|
@ -113,9 +113,10 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the PlayerList Widget to the Player
|
* Show the StatsList Widget to the Player
|
||||||
*
|
*
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
|
* @param string $order
|
||||||
*/
|
*/
|
||||||
public function showStatsList(Player $player, $order = PlayerManager::STAT_SERVERTIME) {
|
public function showStatsList(Player $player, $order = PlayerManager::STAT_SERVERTIME) {
|
||||||
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||||
|
@ -122,9 +122,10 @@ class StatisticCollector implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle Player Shoots
|
* Handle Player Shots
|
||||||
*
|
*
|
||||||
* @param $login
|
* @param string $login
|
||||||
|
* @param int $weaponNumber
|
||||||
*/
|
*/
|
||||||
private function handleOnShoot($login, $weaponNumber) {
|
private function handleOnShoot($login, $weaponNumber) {
|
||||||
if (!isset($this->onShootArray[$login])) {
|
if (!isset($this->onShootArray[$login])) {
|
||||||
@ -165,9 +166,10 @@ class StatisticCollector implements CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the Weapon stat
|
* Get the Weapon stat
|
||||||
*
|
*
|
||||||
* @param $weaponNumber
|
* @param int $weaponNumber
|
||||||
|
* @param bool $shot
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function getWeaponStat($weaponNumber, $shot = true) {
|
private function getWeaponStat($weaponNumber, $shot = true) {
|
||||||
|
@ -41,7 +41,7 @@ class PluginUpdateData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the Plugin Update Data is newer than the given Plugin Versin
|
* Check if the Plugin Update Data is newer than the given Plugin Version
|
||||||
*
|
*
|
||||||
* @param float $version
|
* @param float $version
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@ -322,6 +322,7 @@ class PluginUpdateManager implements CallbackListener, CommandListener, TimerLis
|
|||||||
*
|
*
|
||||||
* @param PluginUpdateData $pluginUpdateData
|
* @param PluginUpdateData $pluginUpdateData
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
|
* @param bool $update
|
||||||
*/
|
*/
|
||||||
private function installPlugin(PluginUpdateData $pluginUpdateData, Player $player = null, $update = false) {
|
private function installPlugin(PluginUpdateData $pluginUpdateData, Player $player = null, $update = false) {
|
||||||
$self = $this;
|
$self = $this;
|
||||||
|
@ -453,6 +453,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
|
|||||||
* Check if ManiaControl is running the Nightly Update Channel
|
* Check if ManiaControl is running the Nightly Update Channel
|
||||||
*
|
*
|
||||||
* @param string $updateChannel
|
* @param string $updateChannel
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isNightlyUpdateChannel($updateChannel = null) {
|
public function isNightlyUpdateChannel($updateChannel = null) {
|
||||||
if (!$updateChannel) {
|
if (!$updateChannel) {
|
||||||
|
@ -70,7 +70,6 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \ManiaControl\Plugins\Plugin::load()
|
* @see \ManiaControl\Plugins\Plugin::load()
|
||||||
*/
|
*/
|
||||||
@ -153,9 +152,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle ManiaControl OnStartup
|
* Display the Widget
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
public function displayWidget() {
|
public function displayWidget() {
|
||||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_DONATE_WIDGET_ACTIVATED)) {
|
||||||
@ -323,12 +320,15 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a Player Donate
|
* Handle a Player Donation
|
||||||
*
|
*
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @param $value
|
* @param int $amount
|
||||||
|
* @param string $receiver
|
||||||
|
* @param string $receiverName
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function handleDonation(Player $player, $amount, $receiver = '', $receiverName = false) {
|
private function handleDonation(Player $player, $amount, $receiver = '', $receiverName = null) {
|
||||||
|
|
||||||
if (!$receiverName) {
|
if (!$receiverName) {
|
||||||
$serverName = $this->maniaControl->client->getServerName();
|
$serverName = $this->maniaControl->client->getServerName();
|
||||||
|
@ -149,9 +149,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Widgets onLoad
|
* Display the Widgets
|
||||||
*
|
|
||||||
* @param array $callback
|
|
||||||
*/
|
*/
|
||||||
private function displayWidgets() {
|
private function displayWidgets() {
|
||||||
// Display Map Widget
|
// Display Map Widget
|
||||||
@ -168,11 +166,11 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Map Widget
|
* Display the Map Widget
|
||||||
*
|
*
|
||||||
* @param String $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
public function displayMapWidget($login = false) {
|
public function displayMapWidget($login = null) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_POSX);
|
$pos_x = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_POSY);
|
$pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MAP_WIDGET_WIDTH);
|
||||||
@ -280,11 +278,11 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Server Info Widget
|
* Display the Server Info Widget
|
||||||
*
|
*
|
||||||
* @param String $login
|
* @param string $login
|
||||||
*/
|
*/
|
||||||
public function displayServerInfoWidget($login = false) {
|
public function displayServerInfoWidget($login = null) {
|
||||||
$pos_x = $this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX);
|
$pos_x = $this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_POSX);
|
||||||
$pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_POSY);
|
$pos_y = $this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_POSY);
|
||||||
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_WIDTH);
|
$width = $this->maniaControl->settingManager->getSetting($this, self::SETTING_SERVERINFO_WIDGET_WIDTH);
|
||||||
|
Loading…
Reference in New Issue
Block a user