From abf0609e2e4d5edcf1920f207bdc0637d3fbc121 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sun, 25 Nov 2018 21:11:55 -0600 Subject: [PATCH] fix only one administrator showing on admins page fix profanity determent not applying penalties. --- Plugins/ProfanityDeterment/Plugin.cs | 12 ++---------- SharedLibraryCore/Services/ClientService.cs | 1 + WebfrontCore/Controllers/ClientController.cs | 10 ++++++---- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Plugins/ProfanityDeterment/Plugin.cs b/Plugins/ProfanityDeterment/Plugin.cs index 5d9bdf6a5..1eb54ca50 100644 --- a/Plugins/ProfanityDeterment/Plugin.cs +++ b/Plugins/ProfanityDeterment/Plugin.cs @@ -86,22 +86,14 @@ namespace IW4MAdmin.Plugins.ProfanityDeterment var clientProfanity = ProfanityCounts[E.Origin.ClientId]; if (clientProfanity.Infringements >= Settings.Configuration().KickAfterInfringementCount) { - clientProfanity.Client.Kick(Settings.Configuration().ProfanityKickMessage, new EFClient() - { - ClientId = 1, - CurrentServer = E.Owner - }); + clientProfanity.Client.Kick(Settings.Configuration().ProfanityKickMessage, Utilities.IW4MAdminClient(E.Owner)); } else if (clientProfanity.Infringements < Settings.Configuration().KickAfterInfringementCount) { clientProfanity.Infringements++; - clientProfanity.Client.Warn(Settings.Configuration().ProfanityWarningMessage, new EFClient() - { - ClientId = 1, - CurrentServer = E.Owner - }); + clientProfanity.Client.Warn(Settings.Configuration().ProfanityWarningMessage, Utilities.IW4MAdminClient(E.Owner)); } } } diff --git a/SharedLibraryCore/Services/ClientService.cs b/SharedLibraryCore/Services/ClientService.cs index 89e87413d..59d0012a3 100644 --- a/SharedLibraryCore/Services/ClientService.cs +++ b/SharedLibraryCore/Services/ClientService.cs @@ -317,6 +317,7 @@ namespace SharedLibraryCore.Services where client.Active select new EFClient() { + AliasLinkId = client.AliasLinkId, CurrentAlias = client.CurrentAlias, ClientId = client.ClientId, Level = client.Level, diff --git a/WebfrontCore/Controllers/ClientController.cs b/WebfrontCore/Controllers/ClientController.cs index 56ae4ed8a..49985bf30 100644 --- a/WebfrontCore/Controllers/ClientController.cs +++ b/WebfrontCore/Controllers/ClientController.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Mvc; using SharedLibraryCore; -using SharedLibraryCore.Database; using SharedLibraryCore.Database.Models; using SharedLibraryCore.Dtos; using SharedLibraryCore.Services; @@ -8,7 +7,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using static SharedLibraryCore.Objects.Penalty; namespace WebfrontCore.Controllers { @@ -65,6 +63,7 @@ namespace WebfrontCore.Controllers .ReadGetClientPenaltiesAsync(client.ClientId, false); if (Authorized && client.Level > EFClient.Permission.Trusted) + { clientDto.Meta.Add(new ProfileMeta() { Key = Localization["WEBFRONT_CLIENT_META_MASKED"], @@ -72,6 +71,7 @@ namespace WebfrontCore.Controllers Sensitive = true, When = DateTime.MinValue }); + } if (Authorized) { @@ -120,15 +120,17 @@ namespace WebfrontCore.Controllers public async Task PrivilegedAsync() { var admins = (await Manager.GetClientService().GetPrivilegedClients()) - .OrderByDescending(a => a.Level) - .GroupBy(a => a.AliasLinkId).Select(a => a.First()); + .GroupBy(a => a.AliasLinkId).Select(_clients => _clients.OrderBy(_client => _client.LastConnection).LastOrDefault()) + .OrderByDescending(_client => _client.Level); var adminsDict = new Dictionary>(); foreach (var admin in admins) { if (!adminsDict.ContainsKey(admin.Level)) + { adminsDict.Add(admin.Level, new List()); + } adminsDict[admin.Level].Add(new ClientInfo() {