1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

Added login plugin

This commit is contained in:
RaidMax
2018-04-13 23:51:38 -05:00
parent b9c11d48c2
commit 4725f8b6f8
13 changed files with 256 additions and 23 deletions

View File

@ -937,7 +937,7 @@ namespace SharedLibraryCore.Commands
public class CPruneAdmins : Command
{
public CPruneAdmins() : base("prune", "demote any admins that have not connected recently (defaults to 30 days)", "p", Player.Permission.Owner, false, new CommandArgument[]
public CPruneAdmins() : base("prune", "demote any admins that have not connected recently (defaults to 30 days)", "pa", Player.Permission.Owner, false, new CommandArgument[]
{
new CommandArgument()
{
@ -1070,4 +1070,35 @@ namespace SharedLibraryCore.Commands
}
}
}
public class CPing : Command
{
public CPing() : base("ping", "get client's ping", "pi", Player.Permission.User, false, new CommandArgument[]
{
new CommandArgument()
{
Name = "client",
Required = false
}
}){}
public override async Task ExecuteAsync(GameEvent E)
{
if (E.Message.IsBroadcastCommand())
{
if (E.Target == null)
await E.Owner.Broadcast($"{E.Origin.Name}'s ping is ^5{E.Origin.Ping}^7ms");
else
await E.Owner.Broadcast($"{E.Target.Name}'s ping is ^5{E.Origin.Ping}^7ms");
}
else
{
if (E.Target == null)
await E.Origin.Tell($"Your ping is ^5{E.Origin.Ping}^7ms");
else
await E.Origin.Tell($"{E.Target.Name}'s ping is ^5{E.Origin.Ping}^7ms");
}
}
}
}

View File

@ -31,6 +31,7 @@ namespace SharedLibraryCore
//FROM PLAYER
Report,
Flag,
Command,
// FROM GAME
Script,
@ -57,5 +58,6 @@ namespace SharedLibraryCore
public Player Target;
public Server Owner;
public Boolean Remote = false;
public object Extra { get; set; }
}
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Exceptions
{
public class AuthorizationException : Exception
{
public AuthorizationException(string message) : base (message) { }
}
}

View File

@ -133,10 +133,6 @@ namespace SharedLibraryCore.Services
{
using (var context = new DatabaseContext())
{
/*context.Configuration.LazyLoadingEnabled = false;
context.Configuration.ProxyCreationEnabled = false;
context.Configuration.AutoDetectChangesEnabled = false;*/
if (victim)
{
var now = DateTime.UtcNow;
@ -162,7 +158,7 @@ namespace SharedLibraryCore.Services
PunisherId = penalty.PunisherId,
Offense = penalty.Offense,
Type = penalty.Type.ToString(),
TimeRemaining = now > penalty.Expires ? "" : penalty.Expires.ToString()
TimeRemaining = now > penalty.Expires ? "" : penalty.Expires.ToString()
},
When = penalty.When,
Sensitive = penalty.Type == Objects.Penalty.PenaltyType.Flag