added, fixed & improved PHPDoc & Type Hints
This commit is contained in:
@ -312,6 +312,11 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle ManialinkPageAnswer Callback
|
||||
*
|
||||
* @param array $callback
|
||||
*/
|
||||
public function handleManialinkPageAnswer(array $callback) {
|
||||
$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();
|
||||
$mapList = array();
|
||||
/** @var Map $map */
|
||||
@ -375,7 +385,13 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
||||
$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 */
|
||||
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);
|
||||
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) {
|
||||
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();
|
||||
|
||||
usort($maps, function($a, $b) {
|
||||
return $a->index - $b->index;
|
||||
return ($a->index - $b->index);
|
||||
});
|
||||
|
||||
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
|
||||
*/
|
||||
private function updateMapTimestamp($uid) {
|
||||
$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);
|
||||
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 $mxId
|
||||
* @param $uid
|
||||
* @param string $uid
|
||||
*/
|
||||
public function updateMap(Player $admin, $uid) {
|
||||
$this->updateMapTimestamp($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);
|
||||
return;
|
||||
}
|
||||
@ -560,6 +562,8 @@ class MapManager implements CallbackListener {
|
||||
/**
|
||||
* Get all Maps
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int $length
|
||||
* @return array
|
||||
*/
|
||||
public function getMaps($offset = null, $length = null) {
|
||||
|
Reference in New Issue
Block a user