diff --git a/Application/Application.csproj b/Application/Application.csproj index 35cff8ac3..96ae5c360 100644 --- a/Application/Application.csproj +++ b/Application/Application.csproj @@ -6,7 +6,7 @@ 2.2.2 false RaidMax.IW4MAdmin.Application - 2.2.5.3 + 2.2.5.4 RaidMax Forever None IW4MAdmin @@ -31,8 +31,8 @@ true true - 2.2.5.3 - 2.2.5.3 + 2.2.5.4 + 2.2.5.4 diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index f0a54ccc9..b2afb6acb 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -978,10 +978,10 @@ namespace IW4MAdmin override public void InitializeTokens() { - Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", (Server s) => Task.Run(() => (object)Manager.GetClientService().GetTotalClientsAsync()))); - Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", (Server s) => Task.Run(() => (object)Application.Program.Version.ToString()))); - Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("NEXTMAP", (Server s) => Task.Run(() => (object)SharedLibraryCore.Commands.CNextMap.GetNextMap(s)))); - Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("ADMINS", (Server s) => Task.Run(() => (object)SharedLibraryCore.Commands.CListAdmins.OnlineAdmins(s)))); + Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("TOTALPLAYERS", (Server s) => Task.Run(async () => (await Manager.GetClientService().GetTotalClientsAsync()).ToString()))); + Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("VERSION", (Server s) => Task.FromResult(Application.Program.Version.ToString()))); + Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("NEXTMAP", (Server s) => SharedLibraryCore.Commands.CNextMap.GetNextMap(s))); + Manager.GetMessageTokens().Add(new SharedLibraryCore.Helpers.MessageToken("ADMINS", (Server s) => Task.FromResult(SharedLibraryCore.Commands.CListAdmins.OnlineAdmins(s)))); } } } diff --git a/Plugins/AutomessageFeed/Configuration.cs b/Plugins/AutomessageFeed/Configuration.cs index 252189f74..50719b2c3 100644 --- a/Plugins/AutomessageFeed/Configuration.cs +++ b/Plugins/AutomessageFeed/Configuration.cs @@ -14,7 +14,11 @@ namespace AutomessageFeed public IBaseConfiguration Generate() { EnableFeed = Utilities.PromptBool(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_PROMPT_ENABLE"]); - FeedUrl = Utilities.PromptString(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_URL"]); + + if (EnableFeed) + { + FeedUrl = Utilities.PromptString(Utilities.CurrentLocalization.LocalizationIndex["PLUGINS_AUTOMESSAGEFEED_URL"]); + } return this; } diff --git a/Plugins/AutomessageFeed/Plugin.cs b/Plugins/AutomessageFeed/Plugin.cs index ad6cca07a..e5835b731 100644 --- a/Plugins/AutomessageFeed/Plugin.cs +++ b/Plugins/AutomessageFeed/Plugin.cs @@ -23,7 +23,7 @@ namespace AutomessageFeed private Configuration _configuration; private int _currentFeedItem; - private async Task GetNextFeedItem(Server server) + private async Task GetNextFeedItem(Server server) { var items = new List(); diff --git a/Plugins/Stats/Plugin.cs b/Plugins/Stats/Plugin.cs index a7f940b08..c9bf5727a 100644 --- a/Plugins/Stats/Plugin.cs +++ b/Plugins/Stats/Plugin.cs @@ -291,7 +291,7 @@ namespace IW4MAdmin.Plugins.Stats MetaService.AddMeta(getMessages); - async Task totalKills(Server server) + async Task totalKills(Server server) { using (var ctx = new DatabaseContext(disableTracking: true)) { @@ -300,7 +300,7 @@ namespace IW4MAdmin.Plugins.Stats } } - async Task totalPlayTime(Server server) + async Task totalPlayTime(Server server) { using (var ctx = new DatabaseContext(disableTracking: true)) { @@ -309,14 +309,14 @@ namespace IW4MAdmin.Plugins.Stats } } - async Task topStats(Server s) + async Task topStats(Server s) { - return String.Join(Environment.NewLine, await Commands.TopStats.GetTopStats(s)); + return string.Join(Environment.NewLine, await Commands.TopStats.GetTopStats(s)); } - async Task mostPlayed(Server s) + async Task mostPlayed(Server s) { - return String.Join(Environment.NewLine, await Commands.MostPlayed.GetMostPlayed(s)); + return string.Join(Environment.NewLine, await Commands.MostPlayed.GetMostPlayed(s)); } manager.GetMessageTokens().Add(new MessageToken("TOTALKILLS", totalKills)); diff --git a/SharedLibraryCore/Dtos/PlayerInfo.cs b/SharedLibraryCore/Dtos/PlayerInfo.cs index dad64350b..0c11dab35 100644 --- a/SharedLibraryCore/Dtos/PlayerInfo.cs +++ b/SharedLibraryCore/Dtos/PlayerInfo.cs @@ -17,6 +17,7 @@ namespace SharedLibraryCore.Dtos public List Aliases { get; set; } public List IPs { get; set; } public bool HasActivePenalty { get; set; } + public string ActivePenaltyType { get; set; } public int ConnectionCount { get; set; } public string LastSeen { get; set; } public string FirstSeen { get; set; } diff --git a/SharedLibraryCore/Helpers/MessageToken.cs b/SharedLibraryCore/Helpers/MessageToken.cs index a0754737a..3239aac88 100644 --- a/SharedLibraryCore/Helpers/MessageToken.cs +++ b/SharedLibraryCore/Helpers/MessageToken.cs @@ -7,18 +7,19 @@ namespace SharedLibraryCore.Helpers public class MessageToken { public string Name { get; private set; } - private readonly Func> _asyncValue; + private readonly Func> _asyncValue; - public MessageToken(string Name, Func> Value) + public MessageToken(string Name, Func> Value) { this.Name = Name; _asyncValue = Value; } - public Task ProcessAsync(Server server) + public async Task ProcessAsync(Server server) { - return _asyncValue(server); + string result = await _asyncValue(server); + return result; } } } diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index f4380aa73..a24e1b005 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -195,7 +195,7 @@ namespace SharedLibraryCore if (found != null) { - str = str.Replace(Match, (await found.ProcessAsync(server)).ToString()); + str = str.Replace(Match, await found.ProcessAsync(server)); } } diff --git a/WebfrontCore/Controllers/ClientController.cs b/WebfrontCore/Controllers/ClientController.cs index e7ab06ace..8f9365e6c 100644 --- a/WebfrontCore/Controllers/ClientController.cs +++ b/WebfrontCore/Controllers/ClientController.cs @@ -53,6 +53,7 @@ namespace WebfrontCore.Controllers .OrderBy(i => i) .ToList(), HasActivePenalty = activePenalties.Count > 0, + ActivePenaltyType = activePenalties.Count > 0 ? activePenalties.First().Type.ToString() : null, Online = Manager.GetActiveClients().FirstOrDefault(c => c.ClientId == client.ClientId) != null, TimeOnline = (DateTime.UtcNow - client.LastConnection).TimeSpanText(), LinkedAccounts = client.LinkedAccounts