From 7bfd5c879097b45602ecb5a1bcd7c0809e22bf73 Mon Sep 17 00:00:00 2001 From: NoLifeKing Date: Mon, 8 May 2023 20:02:43 +0200 Subject: [PATCH] feat: Don't install mods that are client only (if marked properly) --- .github/workflows/app-release.yml | 2 +- .github/workflows/dotnet-ci.yml | 2 +- cf-mc-server/Dependencies.cs | 7 +++++++ cf-mc-server/cf-mc-server.csproj | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/app-release.yml b/.github/workflows/app-release.yml index 48bc26e..028efea 100644 --- a/.github/workflows/app-release.yml +++ b/.github/workflows/app-release.yml @@ -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 diff --git a/.github/workflows/dotnet-ci.yml b/.github/workflows/dotnet-ci.yml index 9d778b4..5b6a793 100644 --- a/.github/workflows/dotnet-ci.yml +++ b/.github/workflows/dotnet-ci.yml @@ -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 diff --git a/cf-mc-server/Dependencies.cs b/cf-mc-server/Dependencies.cs index 1d21e52..e468a33 100644 --- a/cf-mc-server/Dependencies.cs +++ b/cf-mc-server/Dependencies.cs @@ -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)) { diff --git a/cf-mc-server/cf-mc-server.csproj b/cf-mc-server/cf-mc-server.csproj index ee75693..5772967 100644 --- a/cf-mc-server/cf-mc-server.csproj +++ b/cf-mc-server/cf-mc-server.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 cf-mc-server true MIT