cleanup and enhance penalty handling

This commit is contained in:
RaidMax
2021-10-31 11:57:32 -05:00
parent f3bead8eb5
commit bbcbc4c042
6 changed files with 71 additions and 77 deletions

View File

@ -83,6 +83,7 @@ namespace SharedLibraryCore.Commands
var found = await Manager.GetClientService().Get(dbID);
if (found != null)
{
found = Manager.FindActiveClient(found);
E.Target = found;
E.Target.CurrentServer = E.Owner;
E.Data = String.Join(" ", Args.Skip(1));

View File

@ -7,7 +7,6 @@ using System.Threading;
using System.Collections;
using System;
using System.Collections.Concurrent;
using Microsoft.Extensions.Logging;
namespace SharedLibraryCore.Interfaces
{
@ -23,6 +22,7 @@ namespace SharedLibraryCore.Interfaces
IList<IManagerCommand> GetCommands();
IList<Helpers.MessageToken> GetMessageTokens();
IList<EFClient> GetActiveClients();
EFClient FindActiveClient(EFClient client);
IConfigurationHandler<ApplicationConfiguration> GetApplicationSettings();
ClientService GetClientService();
PenaltyService GetPenaltyService();

View File

@ -683,6 +683,17 @@ namespace SharedLibraryCore.Database.Models
set => SetAdditionalProperty(EFMeta.ClientTag, value);
}
[NotMapped]
public int TemporalClientNumber
{
get
{
var temporalClientId = GetAdditionalProperty<string>("ConnectionClientId");
var parsedClientId = string.IsNullOrEmpty(temporalClientId) ? (int?) null : int.Parse(temporalClientId);
return parsedClientId ?? ClientNumber;
}
}
[NotMapped]
private readonly SemaphoreSlim _processingEvent;

View File

@ -218,9 +218,9 @@ namespace SharedLibraryCore
/// <summary>
/// Temporarily ban a player ( default 1 hour ) from the server
/// </summary>
/// <param name="Reason">Reason for banning the player</param>
/// <param name="reason">Reason for banning the player</param>
/// <param name="Target">The player to ban</param>
abstract public Task TempBan(String Reason, TimeSpan length, EFClient Target, EFClient Origin);
abstract public Task TempBan(String reason, TimeSpan length, EFClient Target, EFClient Origin);
/// <summary>
/// Perm ban a player from the server
@ -236,9 +236,9 @@ namespace SharedLibraryCore
/// Unban a player by npID / GUID
/// </summary>
/// <param name="npID">npID of the player</param>
/// <param name="Target">I don't remember what this is for</param>
/// <param name="targetClient">I don't remember what this is for</param>
/// <returns></returns>
abstract public Task Unban(string reason, EFClient Target, EFClient Origin);
abstract public Task Unban(string reason, EFClient targetClient, EFClient originClient);
/// <summary>
/// Change the current searver map