diff --git a/Application/ApplicationManager.cs b/Application/ApplicationManager.cs index 26344f593..fd9a4033a 100644 --- a/Application/ApplicationManager.cs +++ b/Application/ApplicationManager.cs @@ -492,13 +492,17 @@ namespace IW4MAdmin.Application // this is because I want to store the command prefix in IW4MAdminSettings, but can't easily // inject it to all the places that need it - cmdConfig.CommandPrefix = _appConfig.CommandPrefix; - cmdConfig.BroadcastCommandPrefix = _appConfig.BroadcastCommandPrefix; + cmdConfig.CommandPrefix = _appConfig?.CommandPrefix ?? "!"; + cmdConfig.BroadcastCommandPrefix = _appConfig?.BroadcastCommandPrefix ?? "@"; foreach (var cmd in commandsToAddToConfig) { + if (cmdConfig.Commands.ContainsKey(cmd.CommandConfigNameForType())) + { + continue; + } cmdConfig.Commands.Add(cmd.CommandConfigNameForType(), - new CommandProperties() + new CommandProperties { Name = cmd.Name, Alias = cmd.Alias, diff --git a/SharedLibraryCore/Command.cs b/SharedLibraryCore/Command.cs index bdbce0220..a81ddf750 100644 --- a/SharedLibraryCore/Command.cs +++ b/SharedLibraryCore/Command.cs @@ -62,7 +62,7 @@ namespace SharedLibraryCore /// /// Helper property to provide the syntax of the command /// - public string Syntax => $"{_translationLookup["COMMAND_HELP_SYNTAX"]} {_config.CommandPrefix}{Alias} {string.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : _translationLookup["COMMAND_HELP_OPTIONAL"] + " ")}{a.Name}>"))}"; + public string Syntax => $"{_translationLookup["COMMAND_HELP_SYNTAX"]} {_config.CommandPrefix ?? "!"}{Alias} {string.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : _translationLookup["COMMAND_HELP_OPTIONAL"] + " ")}{a.Name}>"))}"; /// /// Alternate name for this command to be executed by diff --git a/WebfrontCore/Controllers/Client/ClientController.cs b/WebfrontCore/Controllers/Client/ClientController.cs index 48d36345f..ce9d63230 100644 --- a/WebfrontCore/Controllers/Client/ClientController.cs +++ b/WebfrontCore/Controllers/Client/ClientController.cs @@ -114,7 +114,7 @@ namespace WebfrontCore.Controllers ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"]; ViewBag.Description = $"Client information for {strippedName}"; ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}"; - ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics; + ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true; return View("Profile/Index", clientDto); } diff --git a/WebfrontCore/ViewComponents/TopPlayersViewComponent.cs b/WebfrontCore/ViewComponents/TopPlayersViewComponent.cs index c9e719a3c..81591967f 100644 --- a/WebfrontCore/ViewComponents/TopPlayersViewComponent.cs +++ b/WebfrontCore/ViewComponents/TopPlayersViewComponent.cs @@ -1,7 +1,6 @@ using System.Linq; using System.Threading.Tasks; using IW4MAdmin.Plugins.Stats; -using IW4MAdmin.Plugins.Stats.Config; using IW4MAdmin.Plugins.Stats.Helpers; using Microsoft.AspNetCore.Mvc; using SharedLibraryCore.Interfaces; @@ -33,11 +32,11 @@ namespace WebfrontCore.ViewComponents } - ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics; + ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true; return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml", - _configurationHandler.Configuration().EnableAdvancedMetrics + ViewBag.UseNewStats ? await Plugin.Manager.GetNewTopStats(offset, count, serverId) : await Plugin.Manager.GetTopStats(offset, count, serverId)); } } -} \ No newline at end of file +}