diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs index 4059d37a..627cf21e 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Matching/MatchController.cs @@ -1,5 +1,6 @@ #nullable enable using System.Text.Json; +using LBPUnion.ProjectLighthouse.Configuration; using LBPUnion.ProjectLighthouse.Database; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Helpers; @@ -42,6 +43,9 @@ public class MatchController : ControllerBase UserEntity? user = await this.database.UserFromGameToken(token); if (user == null) return this.Forbid(); + // Do not allow matchmaking if it has been disabled + if (!ServerConfiguration.Instance.Matchmaking.MatchmakingEnabled) return this.Forbid(); + #region Parse match data // Example POST /match: [UpdateMyPlayerData,["Player":"FireGamer9872"]] diff --git a/ProjectLighthouse/Configuration/ConfigurationCategories/MatchmakingConfiguration.cs b/ProjectLighthouse/Configuration/ConfigurationCategories/MatchmakingConfiguration.cs new file mode 100644 index 00000000..4e9debac --- /dev/null +++ b/ProjectLighthouse/Configuration/ConfigurationCategories/MatchmakingConfiguration.cs @@ -0,0 +1,6 @@ +namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; + +public class MatchmakingConfiguration +{ + public bool MatchmakingEnabled { get; set; } = true; +} \ No newline at end of file diff --git a/ProjectLighthouse/Configuration/ServerConfiguration.cs b/ProjectLighthouse/Configuration/ServerConfiguration.cs index d51d4ca2..7258804e 100644 --- a/ProjectLighthouse/Configuration/ServerConfiguration.cs +++ b/ProjectLighthouse/Configuration/ServerConfiguration.cs @@ -11,7 +11,7 @@ public class ServerConfiguration : ConfigurationBase // This is so Lighthouse can properly identify outdated configurations and update them with newer settings accordingly. // If you are modifying anything here, this value MUST be incremented. // Thanks for listening~ - public override int ConfigVersion { get; set; } = 24; + public override int ConfigVersion { get; set; } = 25; public override string ConfigName { get; set; } = "lighthouse.yml"; public string WebsiteListenUrl { get; set; } = "http://localhost:10060"; @@ -35,6 +35,7 @@ public class ServerConfiguration : ConfigurationBase public AuthenticationConfiguration Authentication { get; set; } = new(); public CaptchaConfiguration Captcha { get; set; } = new(); public DigestKeyConfiguration DigestKey { get; set; } = new(); + public MatchmakingConfiguration Matchmaking { get; set; } = new(); public GoogleAnalyticsConfiguration GoogleAnalytics { get; set; } = new(); public MailConfiguration Mail { get; set; } = new(); public UserGeneratedContentLimitConfiguration UserGeneratedContentLimits { get; set; } = new();