Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -264,7 +264,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
||||
$maplist = 'maplist.txt';
|
||||
}
|
||||
|
||||
$maplist = 'MatchSettings/' . $maplist;
|
||||
$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $maplist;
|
||||
try {
|
||||
$this->maniaControl->client->saveMatchSettings($maplist);
|
||||
|
||||
@ -299,7 +299,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
||||
$maplist = 'maplist.txt';
|
||||
}
|
||||
|
||||
$maplist = 'MatchSettings/' . $maplist;
|
||||
$maplist = 'MatchSettings' . DIRECTORY_SEPARATOR . $maplist;
|
||||
try {
|
||||
$this->maniaControl->client->loadMatchSettings($maplist);
|
||||
|
||||
@ -472,7 +472,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
||||
* @param Map $b
|
||||
* @return mixed
|
||||
*/
|
||||
private function sortByKarma($a, $b) {
|
||||
private function sortByKarma(Map $a, Map $b) {
|
||||
return ($a->karma - $b->karma);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ use FML\Controls\Labels\Label_Text;
|
||||
use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
||||
use FML\ManiaLink;
|
||||
use FML\Script\Features\Paging;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
@ -397,21 +398,33 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
$description = 'Switch Directly to Map: $<' . $map->name . '$>';
|
||||
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
|
||||
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
|
||||
// Switch Map Voting
|
||||
$switchLabel = new Label_Button();
|
||||
$mapFrame->add($switchLabel);
|
||||
$switchLabel->setX($width / 2 - 10);
|
||||
$switchLabel->setZ(0.2);
|
||||
$switchLabel->setSize(3, 3);
|
||||
$switchLabel->setTextSize(2);
|
||||
$switchLabel->setText('»');
|
||||
$switchLabel->setTextColor('0f0');
|
||||
|
||||
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
|
||||
|
||||
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
|
||||
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
|
||||
}
|
||||
if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
|
||||
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||
// Switch Map Voting for Admins
|
||||
$switchQuad = new Quad_UIConstruction_Buttons();
|
||||
$mapFrame->add($switchQuad);
|
||||
$switchQuad->setX($width / 2 - 20);
|
||||
$switchQuad->setZ(0.2);
|
||||
$switchQuad->setSubStyle($switchQuad::SUBSTYLE_Validate_Step2);
|
||||
$switchQuad->setSize(3.8, 3.8);
|
||||
$switchQuad->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
|
||||
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
|
||||
$switchQuad->addTooltipLabelFeature($descriptionLabel, $description);
|
||||
} else {
|
||||
// Switch Map Voting for Player
|
||||
$switchLabel = new Label_Button();
|
||||
$mapFrame->add($switchLabel);
|
||||
$switchLabel->setX($width / 2 - 10);
|
||||
$switchLabel->setZ(0.2);
|
||||
$switchLabel->setSize(3, 3);
|
||||
$switchLabel->setTextSize(2);
|
||||
$switchLabel->setText('»');
|
||||
$switchLabel->setTextColor('0f0');
|
||||
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
|
||||
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
|
||||
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
|
||||
}
|
||||
}
|
||||
|
||||
// Display Karma bar
|
||||
|
@ -252,9 +252,9 @@ class MapManager implements CallbackListener {
|
||||
|
||||
// Download the file
|
||||
$self->maniaControl->fileReader->loadFile($mapInfo->downloadurl, function ($file, $error) use (&$self, &$login, &$mapInfo, &$update) {
|
||||
if (!$file) {
|
||||
if (!$file || $error) {
|
||||
// Download error
|
||||
$self->maniaControl->chat->sendError('Download failed!', $login);
|
||||
$self->maniaControl->chat->sendError("Download failed: '{$error}'!", $login);
|
||||
return;
|
||||
}
|
||||
$self->processMapFile($file, $mapInfo, $login, $update);
|
||||
@ -284,9 +284,9 @@ class MapManager implements CallbackListener {
|
||||
$fileName = FileUtil::getClearedFileName($fileName);
|
||||
|
||||
$downloadFolderName = $this->maniaControl->settingManager->getSetting($this, 'MapDownloadDirectory', 'MX');
|
||||
$relativeMapFileName = $downloadFolderName . '/' . $fileName;
|
||||
$relativeMapFileName = $downloadFolderName . DIRECTORY_SEPARATOR . $fileName;
|
||||
$mapDir = $this->maniaControl->client->getMapsDirectory();
|
||||
$downloadDirectory = $mapDir . '/' . $downloadFolderName . '/';
|
||||
$downloadDirectory = $mapDir . DIRECTORY_SEPARATOR . $downloadFolderName . DIRECTORY_SEPARATOR;
|
||||
$fullMapFileName = $downloadDirectory . $fileName;
|
||||
|
||||
// Check if it can get written locally
|
||||
|
@ -82,20 +82,19 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Clears the map-queue via admin command clearmap queue
|
||||
*
|
||||
* @param array $chat
|
||||
* @param \ManiaControl\Players\Player $admin
|
||||
* @internal param \ManiaControl\Players\Player $player
|
||||
* @param array $chatCallback
|
||||
* @param Player $admin
|
||||
*/
|
||||
public function command_ClearMapQueue(array $chat, Player $admin) {
|
||||
public function command_ClearMapQueue(array $chatCallback, Player $admin) {
|
||||
$this->clearMapQueue($admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the Map Queue
|
||||
* Clear the Map Queue
|
||||
*
|
||||
* @param $admin
|
||||
* @param Player $admin
|
||||
*/
|
||||
public function clearMapQueue($admin) {
|
||||
public function clearMapQueue(Player $admin) {
|
||||
if (!$this->maniaControl->authenticationManager->checkPermission($admin, self::SETTING_PERMISSION_CLEAR_MAPQUEUE)) {
|
||||
$this->maniaControl->authenticationManager->sendNotAllowed($admin);
|
||||
return;
|
||||
@ -121,11 +120,11 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Handles the mapqueue/jukebox command
|
||||
*
|
||||
* @param array $chat
|
||||
* @param array $chatCallback
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_MapQueue(array $chat, Player $player) {
|
||||
$chatCommands = explode(' ', $chat[1][2]);
|
||||
public function command_MapQueue(array $chatCallback, Player $player) {
|
||||
$chatCommands = explode(' ', $chatCallback[1][2]);
|
||||
|
||||
if (isset($chatCommands[1])) {
|
||||
if ($chatCommands[1] == ' ' || $chatCommands[1] == 'list') {
|
||||
@ -143,9 +142,9 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Shows current mapqueue in the chat
|
||||
*
|
||||
* @param $player
|
||||
* @param Player $player
|
||||
*/
|
||||
public function showMapQueue($player) {
|
||||
public function showMapQueue(Player $player) {
|
||||
if (count($this->queuedMaps) == 0) {
|
||||
$this->maniaControl->chat->sendError('$fa0There are no maps in the jukebox!', $player->login);
|
||||
return;
|
||||
@ -164,9 +163,9 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Shows current mapqueue in a manialink
|
||||
*
|
||||
* @param $player
|
||||
* @param Player $player
|
||||
*/
|
||||
public function showMapQueueManialink($player) {
|
||||
public function showMapQueueManialink(Player $player) {
|
||||
if (count($this->queuedMaps) == 0) {
|
||||
$this->maniaControl->chat->sendError('$fa0There are no maps in the jukebox!', $player->login);
|
||||
return;
|
||||
@ -192,10 +191,10 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Adds map as first map in queue (for /replay)
|
||||
*
|
||||
* @param $player
|
||||
* @param $map
|
||||
* @param Player $player
|
||||
* @param Map $map
|
||||
*/
|
||||
public function addFirstMapToMapQueue($player, $map) {
|
||||
public function addFirstMapToMapQueue(Player $player, Map $map) {
|
||||
if ($map) {
|
||||
if (array_key_exists($map->uid, $this->queuedMaps)) {
|
||||
unset($this->queuedMaps[$map->uid]);
|
||||
@ -208,8 +207,8 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Adds a Map to the map-queue
|
||||
*
|
||||
* @param $login
|
||||
* @param $uid
|
||||
* @param string $login
|
||||
* @param string $uid
|
||||
*/
|
||||
public function addMapToMapQueue($login, $uid) {
|
||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||
@ -270,9 +269,8 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Revmoes a Map from the Map queue
|
||||
*
|
||||
* @param \ManiaControl\Players\Player $player
|
||||
* @param $uid
|
||||
* @internal param $login
|
||||
* @param Player $player
|
||||
* @param string $uid
|
||||
*/
|
||||
public function removeFromMapQueue(Player $player, $uid) {
|
||||
if (!isset($this->queuedMaps[$uid])) {
|
||||
@ -360,7 +358,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
/**
|
||||
* Returns the next Map if the next map is a queuedmap or null if it's not
|
||||
*
|
||||
* @return null
|
||||
* @return Map
|
||||
*/
|
||||
public function getNextMap() {
|
||||
return $this->nextMap;
|
||||
|
Reference in New Issue
Block a user