diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs index 6f62070a..32eca77e 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs @@ -1,6 +1,7 @@ using SPTarkov.DI.Annotations; using SPTarkov.Server.Core.Controllers; using SPTarkov.Server.Core.DI; +using SPTarkov.Server.Core.Exceptions.Profile; using SPTarkov.Server.Core.Models.Common; using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Eft.Common.Request; @@ -42,6 +43,11 @@ public class GameCallbacks( /// public ValueTask GameStart(string url, EmptyRequestData _, MongoId sessionID) { + if (saveServer.IsProfileInvalidOrUnloadable(sessionID)) + { + throw new ProfileIncompatibleException("This profile cannot be loaded due to it being invalid or unloadable!"); + } + var startTimestampSec = timeUtil.GetTimeStamp(); gameController.GameStart(url, sessionID, startTimestampSec); return new ValueTask(httpResponseUtil.GetBody(new GameStartResponse { UtcTime = startTimestampSec })); diff --git a/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs b/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs index b85fbe78..8237e877 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/GameController.cs @@ -1,4 +1,5 @@ using SPTarkov.DI.Annotations; +using SPTarkov.Server.Core.Exceptions.Profile; using SPTarkov.Server.Core.Extensions; using SPTarkov.Server.Core.Helpers; using SPTarkov.Server.Core.Models.Common; diff --git a/Libraries/SPTarkov.Server.Core/Exceptions/Profile/ProfileIncompatibleException.cs b/Libraries/SPTarkov.Server.Core/Exceptions/Profile/ProfileIncompatibleException.cs new file mode 100644 index 00000000..d347ea64 --- /dev/null +++ b/Libraries/SPTarkov.Server.Core/Exceptions/Profile/ProfileIncompatibleException.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SPTarkov.Server.Core.Exceptions.Profile; + +public class ProfileIncompatibleException : Exception +{ + public ProfileIncompatibleException(string message) + : base(message) { } + + public ProfileIncompatibleException(string message, Exception innerException) + : base(message, innerException) { } + + public override string? StackTrace + { + get { return null; } + } +}