diff --git a/.github/workflows/ci-otapi3-nuget.yml b/.github/workflows/ci-otapi3-nuget.yml index 04b03a951..7834ccf01 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 f5599ffcf..f7e500370 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 @@ -39,39 +39,39 @@ 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) - 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 - 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 a4795b3ae..43386a5d1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,12 +9,9 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.Run.dll", - "windows": { - "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net6.0/TShock.dll", - }, + "program": "${workspaceFolder}/TShockLauncher/bin/Debug/net9.0/TShock.Server.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 e8db5b188..a90811166 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 87024fb9e..4640b1689 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 @@ -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 0369df531..bf738a077 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 65c5eba61..a31c9345e 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/TShock.cs b/TShockAPI/TShock.cs index bcd72aa36..2be5cfe7c 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -428,8 +428,6 @@ public override void Initialize() Hooks.AccountHooks.AccountDelete += OnAccountDelete; Hooks.AccountHooks.AccountCreate += OnAccountCreate; - On.Terraria.RemoteClient.Reset += RemoteClient_Reset; - GetDataHandlers.InitGetDataHandler(); Commands.InitCommands(); @@ -449,7 +447,7 @@ public override void Initialize() // 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(); @@ -498,17 +496,9 @@ void SafeError(string message) } } - private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client) - { - client.ClientUUID = null; - orig(client); - } - - 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) @@ -532,7 +522,7 @@ protected override void Dispose(bool disposing) } SaveManager.Instance.Dispose(); - IL.Terraria.Initializers.AchievementInitializer.Load -= OnAchievementInitializerLoad; + OTAPI.Hooks.Initializers.AchievementInitializerLoad -= OnAchievementInitializerLoad; ModuleManager.Dispose(); diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 9da8cd085..41bc03ff8 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -3,7 +3,7 @@ Library - net6.0 + net9.0 true True @@ -30,22 +30,22 @@ - - - - + + + + - - + + PreserveNewest true - + PreserveNewest true - + PreserveNewest true @@ -91,7 +91,13 @@ - + + + + + + + diff --git a/TShockPluginManager/Nuget.cs b/TShockPluginManager/Nuget.cs index 9fdefb6b1..4e22209be 100644 --- a/TShockPluginManager/Nuget.cs +++ b/TShockPluginManager/Nuget.cs @@ -53,7 +53,7 @@ public class Nugetter 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 1d53f320b..7ad2429f1 100644 --- a/TShockPluginManager/TShockPluginManager.csproj +++ b/TShockPluginManager/TShockPluginManager.csproj @@ -1,18 +1,18 @@ - net6.0 + net9.0 enable enable - - - + + + - - + + diff --git a/appveyor.yml b/appveyor.yml index a96c0049f..7b71d778a 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