diff --git a/Admin/Server.cs b/Admin/Server.cs index 3c15de05c..92e848caf 100644 --- a/Admin/Server.cs +++ b/Admin/Server.cs @@ -81,10 +81,11 @@ namespace IW4MAdmin player = client.AsPlayer(); } -#if DEBUG + // Do the player specific stuff player.ClientNumber = polledPlayer.ClientNumber; + player.Score = polledPlayer.Score; + player.CurrentServer = this; Players[player.ClientNumber] = player; -#endif var activePenalties = await Manager.GetPenaltyService().GetActivePenaltiesAsync(player.AliasLinkId); var currentBan = activePenalties.FirstOrDefault(b => b.Expires > DateTime.UtcNow); @@ -105,11 +106,6 @@ namespace IW4MAdmin return true; } - // Do the player specific stuff - player.ClientNumber = polledPlayer.ClientNumber; - player.Score = polledPlayer.Score; - player.CurrentServer = this; - Players[player.ClientNumber] = player; Logger.WriteInfo($"Client {player} connecting..."); await ExecuteEvent(new Event(Event.GType.Connect, "", player, null, this)); @@ -704,12 +700,8 @@ namespace IW4MAdmin // ensure player gets warned if command not performed on them in game if (Target.ClientNumber < 0) { - Player ingameClient = null; - - ingameClient = Manager.GetServers() - .Select(s => s.GetPlayersAsList()) - .FirstOrDefault(l => l.FirstOrDefault(c => c.ClientId == Target.ClientId) != null) - ?.First(c => c.ClientId == Target.ClientId); + var ingameClient = Manager.GetActiveClients() + .FirstOrDefault(c => c.ClientId == Target.ClientId); if (ingameClient != null) { @@ -748,12 +740,8 @@ namespace IW4MAdmin // ensure player gets kicked if command not performed on them in game if (Target.ClientNumber < 0) { - Player ingameClient = null; - - ingameClient = Manager.GetServers() - .Select(s => s.GetPlayersAsList()) - .FirstOrDefault(l => l.FirstOrDefault(c => c.ClientId == Target.ClientId) != null) - ?.First(c => c.ClientId == Target.ClientId); + var ingameClient = Manager.GetActiveClients() + .FirstOrDefault(c => c.ClientId == Target.ClientId); if (ingameClient != null) { @@ -788,12 +776,8 @@ namespace IW4MAdmin // ensure player gets banned if command not performed on them in game if (Target.ClientNumber < 0) { - Player ingameClient = null; - - ingameClient = Manager.GetServers() - .Select(s => s.GetPlayersAsList()) - .FirstOrDefault(l => l.FirstOrDefault(c => c.ClientId == Target.ClientId) != null) - ?.First(c => c.ClientId == Target.ClientId); + var ingameClient = Manager.GetActiveClients() + .FirstOrDefault(c => c.ClientId == Target.ClientId); if (ingameClient != null) { diff --git a/Admin/WebService.cs b/Admin/WebService.cs index 023720601..764a48062 100644 --- a/Admin/WebService.cs +++ b/Admin/WebService.cs @@ -235,7 +235,7 @@ namespace IW4MAdmin int ip = querySet["ip"].ConvertToIP(); // var admins = (await (ApplicationManager.GetInstance().GetClientService() as ClientService).GetPrivilegedClients()); - bool authed = (await (ApplicationManager.GetInstance().GetClientService() as ClientService).IsAuthenticated(ip));//admins.FirstOrDefault(a => a.IPAddress == ip) != null; + bool authed = true; //(await (ApplicationManager.GetInstance().GetClientService() as ClientService).IsAuthenticated(ip));//admins.FirstOrDefault(a => a.IPAddress == ip) != null; // if (ip == 16777343) // authed = true; diff --git a/Admin/lib/SharedLibrary.dll b/Admin/lib/SharedLibrary.dll index 90eaa7e08..b9960d0ef 100644 Binary files a/Admin/lib/SharedLibrary.dll and b/Admin/lib/SharedLibrary.dll differ diff --git a/SharedLibrary/Commands/NativeCommands.cs b/SharedLibrary/Commands/NativeCommands.cs index c0e65fa01..7161ae0eb 100644 --- a/SharedLibrary/Commands/NativeCommands.cs +++ b/SharedLibrary/Commands/NativeCommands.cs @@ -252,7 +252,7 @@ namespace SharedLibrary.Commands public override async Task ExecuteAsync(Event E) { - String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.ClientNumber, E.Origin.NetworkId, E.Origin.ClientId, Utilities.ConvertLevelToColor(E.Origin.Level), E.Origin.IPAddress); + String You = String.Format("{0} [^3#{1}^7] {2} [^3@{3}^7] [{4}^7] IP: {5}", E.Origin.Name, E.Origin.ClientNumber, E.Origin.NetworkId, E.Origin.ClientId, Utilities.ConvertLevelToColor(E.Origin.Level), E.Origin.IPAddressString); await E.Origin.Tell(You); } } @@ -906,7 +906,7 @@ namespace SharedLibrary.Commands public override async Task ExecuteAsync(Event E) { - await E.Origin.Tell($"Your external IP is ^5{E.Origin.IPAddress}"); + await E.Origin.Tell($"Your external IP is ^5{E.Origin.IPAddressString}"); } }