From 91c578815cbee3f0b4565100284192c6ce56fe24 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 11:19:16 +1000 Subject: [PATCH 01/19] Update net6 refs to net9 --- .github/workflows/ci-otapi3.yml | 12 ++++++------ .vscode/launch.json | 6 +++--- .vscode/tasks.json | 2 +- Dockerfile | 2 +- README.md | 4 ++-- README_cn.md | 4 ++-- TShockAPI/TShockAPI.csproj | 2 +- TShockInstaller/TShockInstaller.csproj | 2 +- TShockLauncher.Tests/TShockLauncher.Tests.csproj | 2 +- TShockLauncher/TShockLauncher.csproj | 8 ++++---- TShockPluginManager/Nuget.cs | 2 +- TShockPluginManager/TShockPluginManager.csproj | 2 +- appveyor.yml | 2 +- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-otapi3.yml b/.github/workflows/ci-otapi3.yml index f5599ffc..a0a4a07b 100644 --- a/.github/workflows/ci-otapi3.yml +++ b/.github/workflows/ci-otapi3.yml @@ -39,27 +39,27 @@ jobs: - name: Produce installer run: | cd TShockInstaller - dotnet publish -r ${{ matrix.arch }} -f net6.0 -c Release -p:PublishSingleFile=true --self-contained true + dotnet publish -r ${{ matrix.arch }} -f net9.0 -c Release -p:PublishSingleFile=true --self-contained true - name: Produce build run: | cd TShockLauncher - dotnet publish -r ${{ matrix.arch }} -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false + dotnet publish -r ${{ matrix.arch }} -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false - name: Chmod scripts if: ${{ matrix.arch != 'win-x64' }} run: | - chmod +x TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/TShock.Server + chmod +x TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/TShock.Server - name: Copy installer run: | - cp TShockInstaller/bin/Release/net6.0/${{ matrix.arch }}/publish/* TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/ + cp TShockInstaller/bin/Release/net9.0/${{ matrix.arch }}/publish/* TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/ # preserve file perms: https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files - name: Tarball artifact (non-Windows) if: ${{ matrix.arch != 'win-x64' }} run: | - cd TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/ + cd TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/ tar -cvf ../../../../../../TShock-Beta-${{ matrix.arch }}-Release.tar * - name: Upload artifact (non-Windows) @@ -74,4 +74,4 @@ jobs: if: ${{ matrix.arch == 'win-x64' }} with: name: TShock-Beta-${{ matrix.arch }}-Release - path: TShockLauncher/bin/Release/net6.0/${{ matrix.arch }}/publish/ + path: TShockLauncher/bin/Release/net9.0/${{ matrix.arch }}/publish/ diff --git a/.vscode/launch.json b/.vscode/launch.json index a4795b3a..78bc651f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,12 +9,12 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.Run.dll", + "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.Run.dll", "windows": { - "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.dll", + "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.dll", }, "args": [], - "cwd": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/", + "cwd": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/", "console": "integratedTerminal", "stopAtEntry": false }, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e8db5b18..a9081116 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -35,7 +35,7 @@ { "label": "Remote Publish", "options": { - "cwd": "TShockLauncher/bin/Debug/net6.0/linux-arm64" + "cwd": "TShockLauncher/bin/Debug/net9.0/linux-arm64" }, "command": "C:\\Program Files\\PuTTY\\pscp.exe", "type": "process", diff --git a/Dockerfile b/Dockerfile index 87024fb9..f9071c0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN \ *) echo "Error: Unsupported platform ${TARGETPLATFORM}" && exit 1 \ ;; \ esac && \ - dotnet publish -o output/ -r "${ARCH}" -v m -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false + dotnet publish -o output/ -r "${ARCH}" -v m -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false # Runtime image FROM --platform=${TARGETPLATFORM} mcr.microsoft.com/dotnet/runtime:6.0 AS runner diff --git a/README.md b/README.md index 0369df53..bf738a07 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ If you want to run the `TShockLauncher` (which runs a server), run: To produce a packaged release (suitable for distribution), run: 1. `cd TShockLauncher` -1. `dotnet publish -r win-x64 -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false` +1. `dotnet publish -r win-x64 -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false` -Note that in this example, you'd be building for `win-x64`. You can build for `win-x64`, `osx-x64`, `linux-x64`, `linux-arm64`, `linux-arm`. Your release will be in the `TShockLauncher/bin/Release/net6.0/` folder under the architecture you specified. +Note that in this example, you'd be building for `win-x64`. You can build for `win-x64`, `osx-x64`, `linux-x64`, `linux-arm64`, `linux-arm`. Your release will be in the `TShockLauncher/bin/Release/net9.0/` folder under the architecture you specified. ### Working with Terraria diff --git a/README_cn.md b/README_cn.md index 65c5eba6..a31c9345 100644 --- a/README_cn.md +++ b/README_cn.md @@ -30,9 +30,9 @@ TShock是为泰拉瑞亚服务器和社区开发的一个工具箱。这个工 如果要生成打包后的发行版,运行: 1. `cd TShockLauncher` -1. `dotnet publish -r win-x64 -f net6.0 -c Release -p:PublishSingleFile=true --self-contained false` +1. `dotnet publish -r win-x64 -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false` -注意在这个例子中你将会生成`win-x64`架构的版本。你也可以生成`win-x64`、`osx-x64`、`linux-x64`、`linux-arm64`、`linux-arm`的版本。你可以在`TShockLauncher/bin/Release/net6.0/`文件夹下对应架构的文件夹里找到生成后的发行版。 +注意在这个例子中你将会生成`win-x64`架构的版本。你也可以生成`win-x64`、`osx-x64`、`linux-x64`、`linux-arm64`、`linux-arm`的版本。你可以在`TShockLauncher/bin/Release/net9.0/`文件夹下对应架构的文件夹里找到生成后的发行版。 ### 跟泰拉瑞亚本体代码交互 diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 9da8cd08..30389bb4 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -3,7 +3,7 @@ Library - net6.0 + net9.0 true True @@ -37,15 +37,15 @@ - + PreserveNewest true - + PreserveNewest true - + PreserveNewest true diff --git a/TShockPluginManager/Nuget.cs b/TShockPluginManager/Nuget.cs index 9fdefb6b..4e22209b 100644 --- a/TShockPluginManager/Nuget.cs +++ b/TShockPluginManager/Nuget.cs @@ -53,7 +53,7 @@ namespace TShockPluginManager public Nugetter() { FrameworkReducer = new FrameworkReducer(); - NuGetFramework = NuGetFramework.ParseFolder("net6.0"); + NuGetFramework = NuGetFramework.ParseFolder("net9.0"); Settings = NuGet.Configuration.Settings.LoadDefaultSettings(root: null); PathContext = NuGetPathContext.Create(Settings); PackageSourceProvider = new PackageSourceProvider(Settings); diff --git a/TShockPluginManager/TShockPluginManager.csproj b/TShockPluginManager/TShockPluginManager.csproj index 1d53f320..10dad2f9 100644 --- a/TShockPluginManager/TShockPluginManager.csproj +++ b/TShockPluginManager/TShockPluginManager.csproj @@ -1,7 +1,7 @@ - net6.0 + net9.0 enable enable diff --git a/appveyor.yml b/appveyor.yml index a96c0049..7b71d778 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,5 +9,5 @@ build_script: dotnet test artifacts: -- path: ./TShockLauncher/bin/Debug/net6.0 +- path: ./TShockLauncher/bin/Debug/net9.0 name: TShockAVDebug From d404b5a64c3aa404d24b3a3ee2c00859c188b890 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 11:20:51 +1000 Subject: [PATCH 02/19] Update to OTAPI 3.2.4 --- TShockLauncher/TShockLauncher.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockLauncher/TShockLauncher.csproj b/TShockLauncher/TShockLauncher.csproj index 64d835ba..80cd8bd5 100644 --- a/TShockLauncher/TShockLauncher.csproj +++ b/TShockLauncher/TShockLauncher.csproj @@ -32,11 +32,11 @@ - + - + PreserveNewest true From b08801e9a774fd3f2486a0c8aaeba89d6888d471 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:13:50 +1000 Subject: [PATCH 03/19] Update vscode launch profile --- .vscode/launch.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 78bc651f..43386a5d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,10 +9,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.Run.dll", - "windows": { - "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.dll", - }, + "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.Server.dll", "args": [], "cwd": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/", "console": "integratedTerminal", From d9de3c1fc00c443b6ca7b3bc0456ad3009d56763 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:14:04 +1000 Subject: [PATCH 04/19] Update installer runtime urls for net9 --- TShockInstaller/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockInstaller/Program.cs b/TShockInstaller/Program.cs index 03606b51..09ad8bf6 100644 --- a/TShockInstaller/Program.cs +++ b/TShockInstaller/Program.cs @@ -27,11 +27,11 @@ if (arch is null) string? url = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-osx-{arch}.tar.gz"; + url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/9.0.0/dotnet-runtime-9.0.0-osx-{arch}.tar.gz"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-win-{arch}.zip"; + url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/9.0.0/dotnet-runtime-9.0.0-win-{arch}.zip"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-linux-{arch}.tar.gz"; + url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/9.0.0/dotnet-runtime-9.0.0-linux-{arch}.tar.gz"; if(url is null) { From 6a3e8c3d5df5db0cd8a0683100453f930a39d36c Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:32:24 +1000 Subject: [PATCH 05/19] Improve launcher assembly resolution This addresses dev instances unable to resolve binaries, and types being requested by the plugin manager before the resolver is attached --- TShockLauncher/Program.cs | 23 +++++++++++------------ TShockLauncher/TShockLauncher.csproj | 8 +++++++- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/TShockLauncher/Program.cs b/TShockLauncher/Program.cs index 4a139370..84ddedc1 100644 --- a/TShockLauncher/Program.cs +++ b/TShockLauncher/Program.cs @@ -27,22 +27,12 @@ along with this program. If not, see . */ using System.Reflection; -using TShockPluginManager; - -if (args.Length > 0 && args[0].ToLower() == "plugins") -{ - var items = args.ToList(); - items.RemoveAt(0); - await NugetCLI.Main(items); - return; -} - Dictionary _cache = new Dictionary(); System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += Default_Resolving; -Start(); +await StartAsync(); /// /// Resolves a module from the ./bin folder, either with a .dll by preference or .exe @@ -53,6 +43,7 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse if (_cache.TryGetValue(arg2.Name, out Assembly? asm) && asm is not null) return asm; var loc = Path.Combine(AppContext.BaseDirectory, "bin", arg2.Name + ".dll"); + if (File.Exists(loc)) asm = arg1.LoadFromAssemblyPath(loc); @@ -70,7 +61,15 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse /// Initiates the TSAPI server. /// /// This method exists so that the resolver can attach before TSAPI needs its dependencies. -void Start() +async Task StartAsync() { + if (args.Length > 0 && args[0].ToLower() == "plugins") + { + var items = args.ToList(); + items.RemoveAt(0); + await TShockPluginManager.NugetCLI.Main(items); + return; + } + TerrariaApi.Server.Program.Main(args); } diff --git a/TShockLauncher/TShockLauncher.csproj b/TShockLauncher/TShockLauncher.csproj index 80cd8bd5..0e1c5b76 100644 --- a/TShockLauncher/TShockLauncher.csproj +++ b/TShockLauncher/TShockLauncher.csproj @@ -91,7 +91,13 @@ - + + + + + + + From 337f15c0efc40a7ea906e6a13d93f476fcc5c6b0 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:35:38 +1000 Subject: [PATCH 06/19] Remote reset patch and MM dep This is addressed in https://github.com/SignatureBeef/Open-Terraria-API/tree/24d30d37b3eb1f606c6616a357c91aa23626420a --- TShockAPI/TShock.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index bcd72aa3..054e31df 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -428,8 +428,6 @@ namespace TShockAPI Hooks.AccountHooks.AccountDelete += OnAccountDelete; Hooks.AccountHooks.AccountCreate += OnAccountCreate; - On.Terraria.RemoteClient.Reset += RemoteClient_Reset; - GetDataHandlers.InitGetDataHandler(); Commands.InitCommands(); @@ -498,12 +496,6 @@ namespace TShockAPI } } - private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client) - { - client.ClientUUID = null; - orig(client); - } - private static void OnAchievementInitializerLoad(ILContext il) { // Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions) From 90f1d49887d5338e0b87f80b0872e10530334df4 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:39:14 +1000 Subject: [PATCH 07/19] Replace AchievementInitializer MM IL with static hook --- TShockAPI/TShock.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 054e31df..2be5cfe7 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -447,7 +447,7 @@ namespace TShockAPI // Initialize the AchievementManager, which is normally only done on clients. Game._achievements = new AchievementManager(); - IL.Terraria.Initializers.AchievementInitializer.Load += OnAchievementInitializerLoad; + OTAPI.Hooks.Initializers.AchievementInitializerLoad += OnAchievementInitializerLoad; // Actually call AchievementInitializer.Load, which is also normally only done on clients. AchievementInitializer.Load(); @@ -496,11 +496,9 @@ namespace TShockAPI } } - private static void OnAchievementInitializerLoad(ILContext il) + private static void OnAchievementInitializerLoad(object sender, OTAPI.Hooks.Initializers.AchievementInitializerLoadEventArgs args) { - // Modify AchievementInitializer.Load to remove the Main.netMode == 2 check (occupies the first 4 IL instructions) - for (var i = 0; i < 4; i++) - il.Body.Instructions.RemoveAt(0); + args.ShouldLoad = true; } protected void CrashReporter_HeapshotRequesting(object sender, EventArgs e) @@ -524,7 +522,7 @@ namespace TShockAPI } SaveManager.Instance.Dispose(); - IL.Terraria.Initializers.AchievementInitializer.Load -= OnAchievementInitializerLoad; + OTAPI.Hooks.Initializers.AchievementInitializerLoad -= OnAchievementInitializerLoad; ModuleManager.Dispose(); From 756f3138dd4ed642eadba5d8db296009dcc28f6b Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:43:05 +1000 Subject: [PATCH 08/19] Update workflows actions to @v4 and net9 --- .github/workflows/ci-otapi3-nuget.yml | 6 +++--- .github/workflows/ci-otapi3.yml | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-otapi3-nuget.yml b/.github/workflows/ci-otapi3-nuget.yml index 04b03a95..7834ccf0 100644 --- a/.github/workflows/ci-otapi3-nuget.yml +++ b/.github/workflows/ci-otapi3-nuget.yml @@ -11,13 +11,13 @@ jobs: environment: release steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - name: Setup .NET - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.400 + dotnet-version: 9.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/ci-otapi3.yml b/.github/workflows/ci-otapi3.yml index a0a4a07b..f7e50037 100644 --- a/.github/workflows/ci-otapi3.yml +++ b/.github/workflows/ci-otapi3.yml @@ -7,13 +7,13 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.100' + dotnet-version: 9.0.x - name: Run tests run: dotnet test @@ -25,13 +25,13 @@ jobs: arch: ["win-x64", "osx-x64", "linux-x64", "linux-arm64", "linux-arm"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: 'recursive' - - uses: actions/setup-dotnet@v3 + - uses: actions/setup-dotnet@v4 with: - dotnet-version: '6.0.100' + dotnet-version: 9.0.x - name: Install msgfmt run: sudo apt-get install -y gettext @@ -63,14 +63,14 @@ jobs: tar -cvf ../../../../../../TShock-Beta-${{ matrix.arch }}-Release.tar * - name: Upload artifact (non-Windows) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ matrix.arch != 'win-x64' }} with: name: TShock-Beta-${{ matrix.arch }}-Release path: TShock-Beta-${{ matrix.arch }}-Release.tar - name: Upload artifact (Windows) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ matrix.arch == 'win-x64' }} with: name: TShock-Beta-${{ matrix.arch }}-Release From 9b6a245c2c07d6d98eb5d6364534b8094a9f1dc2 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 14:44:50 +1000 Subject: [PATCH 09/19] Update dockerfile to use dotnet/sdk:9.0 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f9071c0b..4640b168 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # TARGETPLATFORM and BUILDPLATFORM are automatically filled in by Docker buildx. # They should not be set in the global scope manually. -FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:6.0 AS builder +FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:9.0 AS builder # Copy build context WORKDIR /TShock From 0c4c7db52e5ec77a09c924b5d71ba4526a5e4f60 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 19:56:38 +1000 Subject: [PATCH 10/19] Update nuget packages --- TShockAPI/TShockAPI.csproj | 6 +++--- TShockLauncher.Tests/GroupTests.cs | 6 +++--- TShockLauncher.Tests/ServerInitTests.cs | 2 +- TShockLauncher.Tests/TShockLauncher.Tests.csproj | 13 ++++++++----- TShockLauncher/TShockLauncher.csproj | 6 +++--- TShockPluginManager/TShockPluginManager.csproj | 10 +++++----- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 30389bb4..41bc03ff 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -33,9 +33,9 @@ - - - + + + diff --git a/TShockLauncher.Tests/GroupTests.cs b/TShockLauncher.Tests/GroupTests.cs index 5eff651f..01a058ca 100644 --- a/TShockLauncher.Tests/GroupTests.cs +++ b/TShockLauncher.Tests/GroupTests.cs @@ -21,17 +21,17 @@ public class GroupTests groups.AddPermissions("test", new() { "abc" }); var hasperm = groups.GetGroupByName("test").Permissions.Contains("abc"); - Assert.IsTrue(hasperm); + Assert.That(hasperm, Is.True); groups.DeletePermissions("test", new() { "abc" }); hasperm = groups.GetGroupByName("test").Permissions.Contains("abc"); - Assert.IsFalse(hasperm); + Assert.That(hasperm, Is.False); groups.DeleteGroup("test"); var g = groups.GetGroupByName("test"); - Assert.IsNull(g); + Assert.That(g, Is.Null); } } diff --git a/TShockLauncher.Tests/ServerInitTests.cs b/TShockLauncher.Tests/ServerInitTests.cs index dc5f6731..e0926c66 100644 --- a/TShockLauncher.Tests/ServerInitTests.cs +++ b/TShockLauncher.Tests/ServerInitTests.cs @@ -27,7 +27,7 @@ public class ServerInitTests On.Terraria.Main.DedServ -= cb; - Assert.IsTrue(hit); + Assert.That(hit, Is.True); } } diff --git a/TShockLauncher.Tests/TShockLauncher.Tests.csproj b/TShockLauncher.Tests/TShockLauncher.Tests.csproj index e58ca178..9be3968a 100644 --- a/TShockLauncher.Tests/TShockLauncher.Tests.csproj +++ b/TShockLauncher.Tests/TShockLauncher.Tests.csproj @@ -7,11 +7,14 @@ - - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/TShockLauncher/TShockLauncher.csproj b/TShockLauncher/TShockLauncher.csproj index 0e1c5b76..875e6287 100644 --- a/TShockLauncher/TShockLauncher.csproj +++ b/TShockLauncher/TShockLauncher.csproj @@ -30,10 +30,10 @@ - - + + - + diff --git a/TShockPluginManager/TShockPluginManager.csproj b/TShockPluginManager/TShockPluginManager.csproj index 10dad2f9..7ad2429f 100644 --- a/TShockPluginManager/TShockPluginManager.csproj +++ b/TShockPluginManager/TShockPluginManager.csproj @@ -7,12 +7,12 @@ - - - + + + - - + + From 7ffb431550f6deb8b5d0b3000a9234740f170c67 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 11 Jan 2025 20:00:23 +1000 Subject: [PATCH 11/19] Update server init test to static hook --- TShockLauncher.Tests/ServerInitTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockLauncher.Tests/ServerInitTests.cs b/TShockLauncher.Tests/ServerInitTests.cs index e0926c66..2ab72bd1 100644 --- a/TShockLauncher.Tests/ServerInitTests.cs +++ b/TShockLauncher.Tests/ServerInitTests.cs @@ -14,18 +14,19 @@ public class ServerInitTests public void EnsureBoots() { var are = new AutoResetEvent(false); - On.Terraria.Main.hook_DedServ cb = (On.Terraria.Main.orig_DedServ orig, Terraria.Main instance) => + HookEvents.HookDelegate cb = (instance, args) => { + args.ContinueExecution = false; are.Set(); Debug.WriteLine("Server init process successful"); }; - On.Terraria.Main.DedServ += cb; + HookEvents.Terraria.Main.DedServ += cb; - new Thread(() => TerrariaApi.Server.Program.Main(new string[] { })).Start(); + new Thread(() => TerrariaApi.Server.Program.Main([])).Start(); var hit = are.WaitOne(TimeSpan.FromSeconds(10)); - On.Terraria.Main.DedServ -= cb; + HookEvents.Terraria.Main.DedServ -= cb; Assert.That(hit, Is.True); } From 608111cfb9643fa9425ddb3e19eea9cf8349f912 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 26 Jan 2025 21:16:04 +1000 Subject: [PATCH 12/19] Update TerrariaServerAPI --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 8a3fffd7..2c82f673 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 8a3fffd71db401736ea80619122c70c449c10ff3 +Subproject commit 2c82f6739e4c76e9e01c5fe7feadd91d9f6fd0ec From d2030991c4b0d249f987adaeac786c2e785e7b39 Mon Sep 17 00:00:00 2001 From: Luke Date: Wed, 29 Jan 2025 07:19:13 +1000 Subject: [PATCH 13/19] Update Dockerfile Co-authored-by: Arthri <41360489+Arthri@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4640b168..d1dcd97e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ RUN \ dotnet publish -o output/ -r "${ARCH}" -v m -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false # Runtime image -FROM --platform=${TARGETPLATFORM} mcr.microsoft.com/dotnet/runtime:6.0 AS runner +FROM --platform=${TARGETPLATFORM} mcr.microsoft.com/dotnet/runtime:9.0 AS runner WORKDIR /server COPY --from=builder /TShock/TShockLauncher/output ./ From 17e37dd8bd39194d77d794be39bcc7a3fd28f2e2 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 2 Feb 2025 16:36:28 +1000 Subject: [PATCH 14/19] Utilise conditional docker base image windows is no longer part of the 9.0 manifest --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d1dcd97e..f489d46c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,11 @@ RUN \ dotnet publish -o output/ -r "${ARCH}" -v m -f net9.0 -c Release -p:PublishSingleFile=true --self-contained false # Runtime image -FROM --platform=${TARGETPLATFORM} mcr.microsoft.com/dotnet/runtime:9.0 AS runner +FROM mcr.microsoft.com/dotnet/runtime:9.0 AS linux_base +FROM mcr.microsoft.com/dotnet/runtime:9.0-nanoserver-ltsc2022 AS windows_base + +FROM ${TARGETOS}_base AS final + WORKDIR /server COPY --from=builder /TShock/TShockLauncher/output ./ From 76b6f56a8fe44962112e9a2be801ad0fa7a7c0ba Mon Sep 17 00:00:00 2001 From: Sakura Akeno Isayeki Date: Tue, 6 May 2025 11:51:59 +0200 Subject: [PATCH 15/19] feat: Add spawning pets perm to default group Add permission for users to spawn pets for default usergroup. --- TShockAPI/DB/GroupManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs index 4a9f8afb..44f0c994 100644 --- a/TShockAPI/DB/GroupManager.cs +++ b/TShockAPI/DB/GroupManager.cs @@ -74,6 +74,7 @@ namespace TShockAPI.DB Permissions.canchangepassword, Permissions.canlogout, Permissions.summonboss, + Permissions.spawnpets, Permissions.worldupgrades, Permissions.whisper, Permissions.wormhole, From bd2aafe01a99e1a682074ec5989647735e88a433 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 7 May 2025 15:25:49 +0200 Subject: [PATCH 16/19] Fix console title not updating and world not saving when the last player disconnects --- TShockAPI/TShock.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index bd2a113e..e2dd3aa1 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1469,8 +1469,8 @@ namespace TShockAPI Hooks.PlayerHooks.OnPlayerLogout(tsplr); } - // The last player will leave after this hook is executed. - if (Utils.GetActivePlayerCount() == 1) + // If this is the last player online, update the console title and save the world if needed + if (Utils.GetActivePlayerCount() == 0) { if (Config.Settings.SaveWorldOnLastPlayerExit) SaveManager.Instance.SaveWorld(); From e12950b50e5a2fb557df57a75a3989cffc576f2e Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Thu, 8 May 2025 09:00:49 +0900 Subject: [PATCH 17/19] Add workflow for notifying discord for wiki changes --- .github/workflows/wiki-notify.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/wiki-notify.yml diff --git a/.github/workflows/wiki-notify.yml b/.github/workflows/wiki-notify.yml new file mode 100644 index 00000000..835c5b40 --- /dev/null +++ b/.github/workflows/wiki-notify.yml @@ -0,0 +1,13 @@ +name: Wiki Changed Discord Notification + +on: + gollum + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - uses: 'oznu/gh-wiki-edit-discord-notification@dfc866fd048f04c239ad113eef3c6c73504d333e' + with: + discord-webhook-url: ${{ secrets.DISCORD_WEBHOOK_WIKI_EDIT }} + ignore-collaborators: false From 952a6685b10e61a61264f452cdfd8330667448e0 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Fri, 9 May 2025 16:28:53 +0900 Subject: [PATCH 18/19] Version tick: 5.2.4 --- TShockAPI/TShock.cs | 2 +- TShockAPI/TShockAPI.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e2dd3aa1..0771bbfe 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -63,7 +63,7 @@ namespace TShockAPI /// VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info. public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version; /// VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions. - public static readonly string VersionCodename = "Stargazer"; + public static readonly string VersionCodename = "Hopefully SSC works somewhat correctly now edition"; /// SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins). public static string SavePath = "tshock"; diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index a01bb022..eb7894b7 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -18,11 +18,11 @@ Also, be sure to release on github with the exact assembly version tag as below so that the update manager works correctly (via the Github releases api and mimic) --> - 5.2.3 + 5.2.4 TShock for Terraria Pryaxis & TShock Contributors TShockAPI - Copyright © Pryaxis & TShock Contributors 2011-2023 + Copyright © Pryaxis & TShock Contributors 2011-2025 True GPL-3.0-or-later From fbb25f79f5ed3a9f65da6b7e01e1e0ce8ca7524c Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 9 May 2025 22:41:20 +1000 Subject: [PATCH 19/19] Update TSAPI submodule --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index 2c82f673..29dc46f4 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit 2c82f6739e4c76e9e01c5fe7feadd91d9f6fd0ec +Subproject commit 29dc46f4e1c7b41f9e88e41187dd8d5b208e257a