Merge branch 'develop' of https://github.com/sp-tarkov/server-csharp into develop
This commit is contained in:
@@ -9,10 +9,9 @@ public static class OnLoadOrder
|
||||
public const int PostDBModLoader = 4000;
|
||||
public const int TraderRegistration = 5000;
|
||||
public const int HandbookCallbacks = 6000;
|
||||
public const int HttpCallbacks = 7000;
|
||||
public const int SaveCallbacks = 8000;
|
||||
public const int TraderCallbacks = 9000;
|
||||
public const int PresetCallbacks = 10000;
|
||||
public const int RagfairCallbacks = 11000;
|
||||
public const int PostSptModLoader = 12000;
|
||||
public const int SaveCallbacks = 7000;
|
||||
public const int TraderCallbacks = 8000;
|
||||
public const int PresetCallbacks = 9000;
|
||||
public const int RagfairCallbacks = 10000;
|
||||
public const int PostSptModLoader = 11000;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Models.External;
|
||||
using SPTarkov.Server.Core.Models.Utils;
|
||||
using SPTarkov.Server.Core.Utils;
|
||||
|
||||
namespace SPTarkov.Server.Core.Loaders;
|
||||
|
||||
[Injectable(InjectionType.Singleton)]
|
||||
public class OnWebAppBuildModLoader(
|
||||
ISptLogger<OnWebAppBuildModLoader> _logger,
|
||||
IEnumerable<IOnWebAppBuildModAsync> _onWebAppBuildMods
|
||||
)
|
||||
{
|
||||
public async Task OnLoad()
|
||||
{
|
||||
if (ProgramStatics.MODS())
|
||||
{
|
||||
_logger.Info("Loading OnWebAppBuildMods...");
|
||||
foreach (var onWebAppBuildMod in _onWebAppBuildMods)
|
||||
{
|
||||
await onWebAppBuildMod.OnWebAppBuildAsync();
|
||||
}
|
||||
|
||||
_logger.Info("Finished loading OnWebAppBuildMods...");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -1,4 +1,4 @@
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.DI;
|
||||
using SPTarkov.Server.Core.Models.External;
|
||||
using SPTarkov.Server.Core.Models.Utils;
|
||||
@@ -6,9 +6,6 @@ using SPTarkov.Server.Core.Utils;
|
||||
|
||||
namespace SPTarkov.Server.Core.Loaders;
|
||||
|
||||
[Obsolete(
|
||||
"This mod loader is obsolete and will be removed in 4.1.0. See documentation in IPreSptLoadModAsync for more information."
|
||||
)]
|
||||
[Injectable(InjectionType.Singleton, TypePriority = OnLoadOrder.PreSptModLoader)]
|
||||
public class PreSptModLoader(
|
||||
ISptLogger<PreSptModLoader> _logger,
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace SPTarkov.Server.Core.Models.External;
|
||||
|
||||
/// <summary>
|
||||
/// This class now runs the Kestrel server is being configured/built, making it the perfect spot to change server configurations.
|
||||
/// </summary>
|
||||
public interface IOnWebAppBuildModAsync
|
||||
{
|
||||
Task OnWebAppBuildAsync();
|
||||
}
|
||||
@@ -1,22 +1,8 @@
|
||||
namespace SPTarkov.Server.Core.Models.External;
|
||||
namespace SPTarkov.Server.Core.Models.External;
|
||||
|
||||
/// <summary>
|
||||
/// This interface used to be used in TS to load mods before SPT components loading.
|
||||
/// This class is now deprecated and should not be used, see code example below for replacement.
|
||||
/// Interface used to make changes before any of the SPT server logic runs. After the Watermark print, but before the Database loads
|
||||
/// </summary>
|
||||
/// <code>
|
||||
/// [Injectable(TypePriority = OnLoadOrder.Watermark + 1)]
|
||||
/// public class MyMod : IOnLoad
|
||||
/// {
|
||||
/// // ... implementation
|
||||
/// }
|
||||
/// </code>
|
||||
/// <remarks>
|
||||
/// <b>DEPRECATED, see code example above for replacement!</b>
|
||||
/// </remarks>
|
||||
[Obsolete(
|
||||
"This interface is obsolete and will be removed in 4.1.0, please use IOnLoad instead with the desired Injectable(TypePriority). See class documentation for examples."
|
||||
)]
|
||||
public interface IPreSptLoadModAsync
|
||||
{
|
||||
Task PreSptLoadAsync();
|
||||
|
||||
@@ -121,6 +121,8 @@ public static class Program
|
||||
builder.WebHost.ConfigureKestrel(
|
||||
(_, options) =>
|
||||
{
|
||||
// This method is not expected to be async so we need to wait for the Task instead of using await keyword
|
||||
options.ApplicationServices.GetService<OnWebAppBuildModLoader>()!.OnLoad().Wait();
|
||||
var httpConfig = options
|
||||
.ApplicationServices.GetService<ConfigServer>()
|
||||
?.GetConfig<HttpConfig>()!;
|
||||
|
||||
Reference in New Issue
Block a user