Skip to content

Commit

Permalink
allow mappings to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen committed May 4, 2022
1 parent 7b3c1c7 commit 463d979
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/MapLocator/LauncherMeta/LauncherMetaDownloadOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
class LauncherMetaDownloadOptions
{
protected LauncherMetaFile $client;
protected LauncherMetaFile $client_mappings;
protected ?LauncherMetaFile $client_mappings = null;
protected LauncherMetaFile $server;
protected LauncherMetaFile $server_mappings;
protected ?LauncherMetaFile $server_mappings = null;

public function __construct($data)
{
$this->client = new LauncherMetaFile($data->client);
$this->client_mappings = new LauncherMetaFile($data->client_mappings);
if (isset($data->client_mappings)) {
$this->client_mappings = new LauncherMetaFile($data->client_mappings);
}
$this->server = new LauncherMetaFile($data->server);
$this->server_mappings = new LauncherMetaFile($data->server_mappings);
if (isset($data->server_mappings)) {
$this->server_mappings = new LauncherMetaFile($data->server_mappings);
}
}

/**
* @param string $type server or client
* @return LauncherMetaFile
* @return ?LauncherMetaFile
*/
public function getMappings(string $type): LauncherMetaFile
public function getMappings(string $type): ?LauncherMetaFile
{
return match ($type) {
"server", "server_mappings" => $this->server_mappings,
Expand Down

0 comments on commit 463d979

Please sign in to comment.