Command Logs
This commit is contained in:
@@ -8,6 +8,8 @@ using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Common;
|
||||
using ReallifeGamemode.Server.Log;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ReallifeGamemode.Database.Entities.Logs;
|
||||
using ReallifeGamemode.Server.Core.Extensions;
|
||||
|
||||
namespace ReallifeGamemode.Server.Core.Commands
|
||||
{
|
||||
@@ -33,6 +35,18 @@ namespace ReallifeGamemode.Server.Core.Commands
|
||||
|
||||
logger.LogInformation("Player '{Name}' executed command '{command}'", player.Name, command);
|
||||
|
||||
using var dbContext = Main.GetDbContext();
|
||||
|
||||
var commandLogEntry = new CommandLogEntry()
|
||||
{
|
||||
Command = "/" + string.Join(' ', args),
|
||||
Time = DateTime.Now,
|
||||
User = player.GetUser(dbContext)
|
||||
};
|
||||
|
||||
dbContext.CommandLogs.Add(commandLogEntry);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
if (legacyCommands.Contains(command))
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user