Merge remote-tracking branch 'origin/general-devel' into general-devel

This commit is contained in:
Cai 2025-05-11 12:01:28 +08:00
commit 167ca4ee01
22 changed files with 114 additions and 99 deletions

View file

@ -74,6 +74,7 @@ namespace TShockAPI.DB
Permissions.canchangepassword,
Permissions.canlogout,
Permissions.summonboss,
Permissions.spawnpets,
Permissions.worldupgrades,
Permissions.whisper,
Permissions.wormhole,

View file

@ -63,7 +63,7 @@ namespace TShockAPI
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
/// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary>
public static readonly string VersionCodename = "Stargazer";
public static readonly string VersionCodename = "Hopefully SSC works somewhat correctly now edition";
/// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary>
public static string SavePath = "tshock";
@ -428,8 +428,6 @@ namespace TShockAPI
Hooks.AccountHooks.AccountDelete += OnAccountDelete;
Hooks.AccountHooks.AccountCreate += OnAccountCreate;
On.Terraria.RemoteClient.Reset += RemoteClient_Reset;
GetDataHandlers.InitGetDataHandler();
Commands.InitCommands();
@ -449,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();
@ -498,17 +496,9 @@ namespace TShockAPI
}
}
private static void RemoteClient_Reset(On.Terraria.RemoteClient.orig_Reset orig, RemoteClient client)
private static void OnAchievementInitializerLoad(object sender, OTAPI.Hooks.Initializers.AchievementInitializerLoadEventArgs args)
{
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)
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 @@ namespace TShockAPI
}
SaveManager.Instance.Dispose();
IL.Terraria.Initializers.AchievementInitializer.Load -= OnAchievementInitializerLoad;
OTAPI.Hooks.Initializers.AchievementInitializerLoad -= OnAchievementInitializerLoad;
ModuleManager.Dispose();
@ -1469,8 +1459,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();

View file

@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<!--
@ -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)
-->
<Version>5.2.3</Version>
<Version>5.2.4</Version>
<AssemblyTitle>TShock for Terraria</AssemblyTitle>
<Company>Pryaxis &amp; TShock Contributors</Company>
<Product>TShockAPI</Product>
<Copyright>Copyright © Pryaxis &amp; TShock Contributors 2011-2023</Copyright>
<Copyright>Copyright © Pryaxis &amp; TShock Contributors 2011-2025</Copyright>
<!-- extras for nuget -->
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
@ -33,9 +33,9 @@
<ItemGroup>
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="GetText.NET" Version="1.7.14" />
<PackageReference Include="MySql.Data" Version="8.4.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.11" />
<PackageReference Include="GetText.NET" Version="8.0.5" />
<PackageReference Include="MySql.Data" Version="9.1.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
</ItemGroup>
<ItemGroup>