Skip to content

Commit

Permalink
feat: Don't install mods that are client only (if marked properly)
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimple committed May 8, 2023
1 parent 67e8896 commit 7bfd5c8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 7.0.x

- name: Build
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 7.0.x

- name: Restore dependencies
run: dotnet restore
Expand Down
7 changes: 7 additions & 0 deletions cf-mc-server/Dependencies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ private static async Task DownloadMinecraftLibraries(ApiClient cfApiClient, stri
foreach (var file in manifest.Files)
{
var mod = await cfApiClient.GetModFileAsync(file.ProjectId, file.FileId);

if (mod.Data.GameVersions.Contains("Client") && !mod.Data.GameVersions.Contains("Server"))
{
AnsiConsole.MarkupLineInterpolated($"[darkorange]The file {mod.Data.DisplayName} is marked as client only, and will not be installed, as it might break the server[/]");
continue;
}

var modDlUrl = mod.Data.DownloadUrl;
if (string.IsNullOrWhiteSpace(modDlUrl))
{
Expand Down
2 changes: 1 addition & 1 deletion cf-mc-server/cf-mc-server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>cf-mc-server</AssemblyName>
<PublishSingleFile>true</PublishSingleFile>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down

0 comments on commit 7bfd5c8

Please sign in to comment.