Added CommandArgument class to generate syntax for commands. changed Command constructor
tweaked help command /pubbans is working properly now plugins properties changed to expression
This commit is contained in:
parent
89381bcc7d
commit
a56f386644
@ -146,39 +146,39 @@ namespace IW4MAdmin
|
||||
|
||||
#region COMMANDS
|
||||
if ((ClientDatabase as ClientsDB).GetOwner() == null)
|
||||
Commands.Add(new COwner("owner", "claim ownership of the server", "o", Player.Permission.User, 0, false));
|
||||
Commands.Add(new COwner());
|
||||
|
||||
Commands.Add(new CQuit("quit", "quit IW4MAdmin", "q", Player.Permission.Owner, 0, false));
|
||||
Commands.Add(new CKick("kick", "kick a player by name. syntax: !kick <player> <reason>.", "k", Player.Permission.Trusted, 2, true));
|
||||
Commands.Add(new CSay("say", "broadcast message to all players. syntax: !say <message>.", "s", Player.Permission.Moderator, 1, false));
|
||||
Commands.Add(new CTempBan("tempban", "temporarily ban a player for for specified time (defaults to 1 hour). syntax: !tempban <player> <time>(m|h|d|w|y) <reason>.", "tb", Player.Permission.Moderator, 2, true));
|
||||
Commands.Add(new CBan("ban", "permanently ban a player from the server. syntax: !ban <player> <reason>", "b", Player.Permission.SeniorAdmin, 2, true));
|
||||
Commands.Add(new CWhoAmI("whoami", "give information about yourself. syntax: !whoami.", "who", Player.Permission.User, 0, false));
|
||||
Commands.Add(new CList("list", "list active clients. syntax: !list.", "l", Player.Permission.Moderator, 0, false));
|
||||
Commands.Add(new CHelp("help", "list all available commands. syntax: !help.", "h", Player.Permission.User, 0, false));
|
||||
Commands.Add(new CFastRestart("fastrestart", "fast restart current map. syntax: !fastrestart.", "fr", Player.Permission.Moderator, 0, false));
|
||||
Commands.Add(new CMapRotate("maprotate", "cycle to the next map in rotation. syntax: !maprotate.", "mr", Player.Permission.Administrator, 0, false));
|
||||
Commands.Add(new CSetLevel("setlevel", "set player to specified administration level. syntax: !setlevel <player> <level>.", "sl", Player.Permission.Owner, 2, true));
|
||||
Commands.Add(new CUsage("usage", "get current application memory usage. syntax: !usage.", "us", Player.Permission.Moderator, 0, false));
|
||||
Commands.Add(new CUptime("uptime", "get current application running time. syntax: !uptime.", "up", Player.Permission.Moderator, 0, false));
|
||||
Commands.Add(new CWarn("warn", "warn player for infringing rules. syntax: !warn <player> <reason>.", "w", Player.Permission.Trusted, 2, true));
|
||||
Commands.Add(new CWarnClear("warnclear", "remove all warning for a player. syntax: !warnclear <player>.", "wc", Player.Permission.Trusted, 1, true));
|
||||
Commands.Add(new CUnban("unban", "unban player by database id. syntax: !unban @<id>.", "ub", Player.Permission.SeniorAdmin, 1, true));
|
||||
Commands.Add(new CListAdmins("admins", "list currently connected admins. syntax: !admins.", "a", Player.Permission.User, 0, false));
|
||||
Commands.Add(new CLoadMap("map", "change to specified map. syntax: !map", "m", Player.Permission.Administrator, 1, false));
|
||||
Commands.Add(new CFindPlayer("find", "find player in database. syntax: !find <player>", "f", Player.Permission.SeniorAdmin, 1, false));
|
||||
Commands.Add(new CListRules("rules", "list server rules. syntax: !rules", "r", Player.Permission.User, 0, false));
|
||||
Commands.Add(new CPrivateMessage("privatemessage", "send message to other player. syntax: !pm <player> <message>", "pm", Player.Permission.User, 2, true));
|
||||
Commands.Add(new CFlag("flag", "flag a suspicious player and announce to admins on join. syntax !flag <player> <reason>:", "fp", Player.Permission.Moderator, 2, true));
|
||||
Commands.Add(new CReport("report", "report a player for suspicious behaivor. syntax !report <player> <reason>", "rep", Player.Permission.User, 2, true));
|
||||
Commands.Add(new CListReports("reports", "get most recent reports. syntax !reports", "reps", Player.Permission.Moderator, 0, false));
|
||||
Commands.Add(new CMask("mask", "hide your online presence from online admin list. syntax: !mask", "hide", Player.Permission.Administrator, 0, false));
|
||||
Commands.Add(new CListBanInfo("baninfo", "get information about a ban for a player. syntax: !baninfo <player>", "bi", Player.Permission.Moderator, 1, true));
|
||||
Commands.Add(new CListAlias("alias", "get past aliases and ips of a player. syntax: !alias <player>", "known", Player.Permission.Moderator, 1, true));
|
||||
Commands.Add(new CExecuteRCON("rcon", "send rcon command to server. syntax: !rcon <command>", "rcon", Player.Permission.Owner, 1, false));
|
||||
Commands.Add(new CFindAllPlayers("findall", "find a player by their aliase(s). syntax: !findall <player>", "fa", Player.Permission.Moderator, 1, false));
|
||||
Commands.Add(new CPlugins("plugins", "view all loaded plugins. syntax: !plugins", "p", Player.Permission.Administrator, 0, false));
|
||||
Commands.Add(new CIP("getexternalip", "view your external IP address. syntax: !ip", "ip", Player.Permission.User, 0, false));
|
||||
Commands.Add(new CQuit());
|
||||
Commands.Add(new CKick());
|
||||
Commands.Add(new CSay());
|
||||
Commands.Add(new CTempBan());
|
||||
Commands.Add(new CBan());
|
||||
Commands.Add(new CWhoAmI());
|
||||
Commands.Add(new CList());
|
||||
Commands.Add(new CHelp());
|
||||
Commands.Add(new CFastRestart());
|
||||
Commands.Add(new CMapRotate());
|
||||
Commands.Add(new CSetLevel());
|
||||
Commands.Add(new CUsage());
|
||||
Commands.Add(new CUptime());
|
||||
Commands.Add(new CWarn());
|
||||
Commands.Add(new CWarnClear());
|
||||
Commands.Add(new CUnban());
|
||||
Commands.Add(new CListAdmins());
|
||||
Commands.Add(new CLoadMap());
|
||||
Commands.Add(new CFindPlayer());
|
||||
Commands.Add(new CListRules());
|
||||
Commands.Add(new CPrivateMessage());
|
||||
Commands.Add(new CReload());
|
||||
Commands.Add(new CFlag());
|
||||
Commands.Add(new CReport());
|
||||
Commands.Add(new CListReports());
|
||||
Commands.Add(new CListBanInfo());
|
||||
Commands.Add(new CListAlias());
|
||||
Commands.Add(new CExecuteRCON());
|
||||
Commands.Add(new CFindAllPlayers());
|
||||
Commands.Add(new CPlugins());
|
||||
Commands.Add(new CIP());
|
||||
|
||||
foreach (Command C in SharedLibrary.Plugins.PluginImporter.ActiveCommands)
|
||||
Commands.Add(C);
|
||||
|
@ -28,9 +28,9 @@ namespace IW4MAdmin
|
||||
return ApplicationManager.GetInstance().GetClientDatabase().GetClientPenalties(P);
|
||||
}
|
||||
|
||||
public List<Penalty> AsChronoList(int offset, int count)
|
||||
public List<Penalty> AsChronoList(int offset, int count, Penalty.Type penaltyType = Penalty.Type.Any)
|
||||
{
|
||||
return ApplicationManager.GetInstance().GetClientDatabase().GetPenaltiesChronologically(offset, count);
|
||||
return ApplicationManager.GetInstance().GetClientDatabase().GetPenaltiesChronologically(offset, count, penaltyType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,8 @@ namespace IW4MAdmin
|
||||
|
||||
if (Args.Length < (C.RequiredArgumentCount))
|
||||
{
|
||||
await E.Origin.Tell($"Not enough arguments supplied! ^5({C.RequiredArgumentCount} ^7required)");
|
||||
await E.Origin.Tell($"Not enough arguments supplied!");
|
||||
await E.Origin.Tell(C.Syntax);
|
||||
throw new SharedLibrary.Exceptions.CommandException($"{E.Origin} did not supply enough arguments for \"{C.Name}\"");
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace IW4MAdmin
|
||||
return requestedPage.GetPage(queryset, headers);
|
||||
else
|
||||
{
|
||||
if (System.IO.File.Exists(path.Replace("/", "\\").Substring(1)))
|
||||
if (File.Exists(path.Replace("/", "\\").Substring(1)))
|
||||
{
|
||||
var f = File.ReadAllBytes(path.Replace("/", "\\").Substring(1));
|
||||
|
||||
@ -666,7 +666,11 @@ namespace IW4MAdmin
|
||||
HttpResponse resp = new HttpResponse()
|
||||
{
|
||||
contentType = GetContentType(),
|
||||
content = Newtonsoft.Json.JsonConvert.SerializeObject(((ApplicationManager.GetInstance().GetClientPenalties()) as PenaltyList).AsChronoList(Convert.ToInt32(querySet["from"]), 15), Newtonsoft.Json.Formatting.Indented, new Newtonsoft.Json.JsonConverter[] { new Newtonsoft.Json.Converters.StringEnumConverter() }),
|
||||
content = Newtonsoft.Json.JsonConvert
|
||||
.SerializeObject(((ApplicationManager.GetInstance().GetClientPenalties()) as PenaltyList)
|
||||
.AsChronoList(Convert.ToInt32(querySet["from"]), 50, Penalty.Type.Ban), Newtonsoft.Json.Formatting.Indented, new Newtonsoft.Json.JsonConverter[] {
|
||||
new Newtonsoft.Json.Converters.StringEnumConverter()
|
||||
}),
|
||||
additionalHeaders = new Dictionary<string, string>()
|
||||
};
|
||||
return resp;
|
||||
|
Binary file not shown.
@ -16,7 +16,7 @@ div#header #navContainer .navEntry a { padding: 1.2vw; width: 4vw; }
|
||||
div#header #navContainer .navEntry:hover { background-color: rgb(34, 34, 34); }
|
||||
|
||||
div#content { margin: 3em 10%; }
|
||||
div#content .serverContainer { background-color: #191919; margin-top 0; margin-bottom: 0; font-size: 1.25vw; padding-bottom: 100px; }
|
||||
div#content .serverContainer { background-color: #191919; margin-top: 0; margin-bottom: 0; font-size: 1.25vw; padding-bottom: 100px; }
|
||||
div#content hr { border-width: 0; height: 0.25em; background-color: #007ACC; }
|
||||
div#content .serverInfo { width: 100%; }
|
||||
div#content .serverInfo .tableCell { padding: 0 0.5em; }
|
||||
@ -37,11 +37,10 @@ div#content .penaltyName a:link, div#content .penaltyName a:visited, div#content
|
||||
div#content .penaltyName a:hover, div#content .playerInfo a:hover { color: rgb(255, 255, 255) !important; opacity: 0.75; }
|
||||
div#content .penaltyTime { text-align: left; width:8%; }
|
||||
div#content .penaltyOrigin {width: 12%;}
|
||||
div#content .penaltyRemaining { text-align: right; width: 10%:}
|
||||
div#content .penaltyRemaining { text-align: right; width: 10%; }
|
||||
div#content .playerPenalty .penaltyTime { opacity: 0.5; }
|
||||
div#content .penaltyType { width: 10%; }
|
||||
div#content .penaltyReason { width: 45%; }
|
||||
div#content .playerPenalty .tableCell { }
|
||||
div#content .penaltyHeader, div#content .contentHeader { width: calc(100% - 20px); background-color: #007ACC; font-size: 15pt; padding: 0.5em 10px; }
|
||||
div#content .alternate_1 { background-color: rgb(34, 34, 34); }
|
||||
|
||||
@ -86,7 +85,6 @@ div#consoleWrap select { width: 100%; }
|
||||
div#view { width: 100%; margin: 0 auto; }
|
||||
div#threadView { width: 80%; padding-right: 3em;}
|
||||
div#threadView hr { width: 100%; }
|
||||
div#recentView { }
|
||||
div#recentTitle { position: relative; top: -1em; }
|
||||
div#view .threadPreview { background-color: #181818; padding: 0 10px; width: calc(100% - 20px); }
|
||||
div#view .threadPreview .threadTitle { padding: 0 0.5em; width: 80%; }
|
||||
@ -153,8 +151,6 @@ div #userCover {
|
||||
margin-top: -1.5em;
|
||||
}
|
||||
|
||||
div #userInfoBox .table { }
|
||||
|
||||
div#userInfoBox { background-color: #181818; padding: 1em; padding-top: 2em; width: 65%; margin: 0 auto; }
|
||||
div#userInfoBox .fa { font-size: 3em; width: 65px; padding: 0.25em 0; }
|
||||
div.userInfoField .tableCell { vertical-align: middle; padding-right: 1em; padding-left: 0.25em; }
|
||||
@ -172,7 +168,7 @@ div#userAvatar { width: 20em; height: 20em; background-size: contain; margin-ri
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
background-size: 5%;
|
||||
opacity: : 0.5;
|
||||
opacity: 0.5;
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
@ -57,15 +57,9 @@ namespace EventAPI
|
||||
return resp;
|
||||
}
|
||||
|
||||
public string GetContentType()
|
||||
{
|
||||
return "application/json";
|
||||
}
|
||||
public string GetContentType() => "application/json";
|
||||
|
||||
public bool Visible()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public bool Visible() => false;
|
||||
}
|
||||
|
||||
class Events : IPlugin
|
||||
@ -77,23 +71,11 @@ namespace EventAPI
|
||||
int flaggedMessages;
|
||||
List<string> flaggedMessagesText;
|
||||
|
||||
public String Name
|
||||
{
|
||||
get { return "Event API Plugin"; }
|
||||
}
|
||||
public String Name => "Event API Plugin";
|
||||
|
||||
public float Version
|
||||
{
|
||||
get { return 1.0f; }
|
||||
}
|
||||
public float Version => 1.0f;
|
||||
|
||||
public string Author
|
||||
{
|
||||
get
|
||||
{
|
||||
return "RaidMax";
|
||||
}
|
||||
}
|
||||
public string Author => "RaidMax";
|
||||
|
||||
public async Task OnLoadAsync(IManager manager)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ namespace Plugin
|
||||
|
||||
public class CEnableFastRestart : Command
|
||||
{
|
||||
public CEnableFastRestart() : base("frenable", "enable fast restarting at the end of a map. syntax: !fre", "fre", Player.Permission.SeniorAdmin, 0, false) { }
|
||||
public CEnableFastRestart() : base("frenable", "enable fast restarting at the end of a map", "fre", Player.Permission.SeniorAdmin, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -27,7 +27,7 @@ namespace Plugin
|
||||
|
||||
public class CDisableFastRestart : Command
|
||||
{
|
||||
public CDisableFastRestart() : base("fredisable", "disable fast restarting at the end of a map. syntax: !frd", "frd", Player.Permission.SeniorAdmin, 0, false) { }
|
||||
public CDisableFastRestart() : base("fredisable", "disable fast restarting at the end of a map", "frd", Player.Permission.SeniorAdmin, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
|
@ -11,7 +11,15 @@ namespace StatsPlugin
|
||||
{
|
||||
public class CViewStats : Command
|
||||
{
|
||||
public CViewStats() : base("stats", "view your stats. syntax: !stats", "xlrstats", Player.Permission.User, 0, false) { }
|
||||
public CViewStats() : base("stats", "view your stats", "xlrstats", Player.Permission.User, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -54,7 +62,9 @@ namespace StatsPlugin
|
||||
|
||||
public class CViewTopStats : Command
|
||||
{
|
||||
public CViewTopStats() : base("topstats", "view the top 5 players on this server. syntax: !topstats", "ts", Player.Permission.User, 0, false) { }
|
||||
public CViewTopStats() :
|
||||
base("topstats", "view the top 5 players on this server", "ts", Player.Permission.User, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -75,7 +85,7 @@ namespace StatsPlugin
|
||||
|
||||
public class CResetStats : Command
|
||||
{
|
||||
public CResetStats() : base("resetstats", "reset your stats to factory-new. syntax: !resetstats", "rs", Player.Permission.User, 0, false) { }
|
||||
public CResetStats() : base("resetstats", "reset your stats to factory-new", "rs", Player.Permission.User, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -175,20 +185,11 @@ namespace StatsPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Basic Stats"; }
|
||||
}
|
||||
public string Name => "Basic Stats";
|
||||
|
||||
public float Version
|
||||
{
|
||||
get { return 1.1f; }
|
||||
}
|
||||
public float Version => 1.1f;
|
||||
|
||||
public string Author
|
||||
{
|
||||
get { return "RaidMax"; }
|
||||
}
|
||||
public string Author => "RaidMax";
|
||||
|
||||
public async Task OnLoadAsync(SharedLibrary.Interfaces.IManager manager)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace StatsPlugin
|
||||
{
|
||||
public class CEnableTrusted : Command
|
||||
{
|
||||
public CEnableTrusted() : base("enabletrusted", "enable trusted player group for the server. syntax: !enabletrusted", "et", Player.Permission.Owner, 0, false) { }
|
||||
public CEnableTrusted() : base("enabletrusted", "enable trusted player group for the server", "et", Player.Permission.Owner, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -28,7 +28,7 @@ namespace StatsPlugin
|
||||
|
||||
public class CDisableTrusted : Command
|
||||
{
|
||||
public CDisableTrusted() : base("disabletrusted", "disable trusted player group for the server. syntax: !disabletrusted", "dt", Player.Permission.Owner, 0, false) { }
|
||||
public CDisableTrusted() : base("disabletrusted", "disable trusted player group for the server", "dt", Player.Permission.Owner, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
|
@ -44,8 +44,8 @@ namespace IW4MAdmin.Plugins
|
||||
#region PLUGIN_INFO
|
||||
foreach (var command in S.Manager.GetCommands().OrderByDescending(c => c.Permission).ThenBy(c => c.Name))
|
||||
{
|
||||
//|Name|Description|Requires Target|Arg Count|Required Level|
|
||||
Console.WriteLine($"|{command.Name}|{command.Alias}|{command.Description.Split('.')[0]}|{command.RequiresTarget}|{command.RequiredArgumentCount}|{command.Permission}|");
|
||||
//|Name|Alias|Description|Requires Target|Syntax|Required Level|
|
||||
Console.WriteLine($"|{command.Name}|{command.Alias}|{command.Description}|{command.RequiresTarget}|{command.Syntax.Substring(8)}|{command.Permission}|");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using SharedLibrary.Network;
|
||||
using SharedLibrary.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
#if DEBUG
|
||||
namespace Votemap_Plugin
|
||||
{
|
||||
/// <summary>
|
||||
@ -15,7 +14,15 @@ namespace Votemap_Plugin
|
||||
/// </summary>
|
||||
public class VoteMap : Command
|
||||
{
|
||||
public VoteMap() : base("vote", "vote for the next map. syntax !v <mapname>", "v", Player.Permission.User, 1, false) { }
|
||||
public VoteMap() : base("vote", "vote for the next map", "v", Player.Permission.User, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "map",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Properties of Event E
|
||||
@ -56,7 +63,7 @@ namespace Votemap_Plugin
|
||||
|
||||
public class VoteCancel : Command
|
||||
{
|
||||
public VoteCancel() : base("votecancel", "cancel your vote for the next map. syntax !vc", "vc", Player.Permission.User, 0, false) { }
|
||||
public VoteCancel() : base("votecancel", "cancel your vote for the next map", "vc", Player.Permission.User, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -186,29 +193,11 @@ namespace Votemap_Plugin
|
||||
private static List<ServerVoting> serverVotingList;
|
||||
public static int minVotes = 3;
|
||||
|
||||
public string Author
|
||||
{
|
||||
get
|
||||
{
|
||||
return "RaidMax";
|
||||
}
|
||||
}
|
||||
public string Author => "RaidMax";
|
||||
|
||||
public float Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
public float Version => 1.0f;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Votemap Plugin";
|
||||
}
|
||||
}
|
||||
public string Name => "Votemap Plugin";
|
||||
|
||||
public async Task OnLoadAsync(IManager manager)
|
||||
{
|
||||
@ -227,7 +216,6 @@ namespace Votemap_Plugin
|
||||
/// <param name="S"></param>
|
||||
public async Task OnTickAsync(Server S)
|
||||
{
|
||||
return;
|
||||
var serverVotes = GetServerVotes(S.GetPort());
|
||||
|
||||
if (serverVotes != null)
|
||||
@ -258,7 +246,7 @@ namespace Votemap_Plugin
|
||||
|
||||
if (!serverVotes.voteInSession && serverVotes.votePassed && (DateTime.Now - serverVotes.voteTimeStart).TotalSeconds > 30)
|
||||
{
|
||||
await S.ExecuteCommandAsync("map " + serverVotes.GetTopVotedMap().map.Name);
|
||||
await S.LoadMap(serverVotes.GetTopVotedMap().map.Name);
|
||||
serverVotes.votePassed = false;
|
||||
return;
|
||||
}
|
||||
@ -286,7 +274,6 @@ namespace Votemap_Plugin
|
||||
|
||||
public async Task OnEventAsync(Event E, Server S)
|
||||
{
|
||||
return;
|
||||
if (E.Type == Event.GType.Start)
|
||||
{
|
||||
serverVotingList.Add(new ServerVoting(S.GetPort()));
|
||||
@ -312,5 +299,4 @@ namespace Votemap_Plugin
|
||||
return serverVotingList.Find(x => (x.ServerId == serverID));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
@ -60,29 +60,11 @@ namespace Welcome_Plugin
|
||||
}
|
||||
}
|
||||
|
||||
public string Author
|
||||
{
|
||||
get
|
||||
{
|
||||
return "RaidMax";
|
||||
}
|
||||
}
|
||||
public string Author => "RaidMax";
|
||||
|
||||
public float Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
public float Version => 1.0f;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Welcome Plugin";
|
||||
}
|
||||
}
|
||||
public string Name => "Welcome Plugin";
|
||||
|
||||
public async Task OnLoadAsync(IManager manager)
|
||||
{
|
||||
|
@ -1,21 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibrary
|
||||
{
|
||||
public class CommandArgument
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Required { get; set; }
|
||||
}
|
||||
|
||||
public abstract class Command
|
||||
{
|
||||
public Command(String N, String D, String A, Player.Permission P, int args, bool nT)
|
||||
{
|
||||
Name = N;
|
||||
Description = D;
|
||||
Alias = A;
|
||||
Permission = P;
|
||||
RequiredArgumentCount = args;
|
||||
RequiresTarget = nT;
|
||||
public Command(String commandName, String commandDescription, String commandAlias, Player.Permission requiredPermission, bool requiresTarget, CommandArgument[] param = null)
|
||||
{
|
||||
Name = commandName;
|
||||
Description = commandDescription;
|
||||
Alias = commandAlias;
|
||||
Permission = requiredPermission;
|
||||
RequiresTarget = requiresTarget;
|
||||
Arguments = param ?? new CommandArgument[0];
|
||||
}
|
||||
|
||||
//Execute the command
|
||||
@ -23,9 +27,11 @@ namespace SharedLibrary
|
||||
|
||||
public String Name { get; private set; }
|
||||
public String Description { get; private set; }
|
||||
public String Syntax => $"syntax: !{Alias} {String.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : "optional ")}{a.Name}>"))}";
|
||||
public String Alias { get; private set; }
|
||||
public int RequiredArgumentCount { get; private set; }
|
||||
public int RequiredArgumentCount => Arguments.Count(c => c.Required);
|
||||
public bool RequiresTarget { get; private set; }
|
||||
public Player.Permission Permission { get; private set; }
|
||||
public CommandArgument[] Arguments { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ namespace SharedLibrary.Commands
|
||||
{
|
||||
public class CQuit : Command
|
||||
{
|
||||
public CQuit(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CQuit() :
|
||||
base("quit", "quit IW4MAdmin", "q", Player.Permission.Owner, false)
|
||||
{ }
|
||||
|
||||
public override Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -20,7 +22,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class COwner : Command
|
||||
{
|
||||
public COwner(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public COwner() :
|
||||
base("owner", "claim ownership of the server", "o", Player.Permission.User, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -37,7 +41,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CWarn : Command
|
||||
{
|
||||
public CWarn(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CWarn() :
|
||||
base("warn", "warn player for infringing rules", "w", Player.Permission.Trusted, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "reason",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -51,7 +69,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CWarnClear : Command
|
||||
{
|
||||
public CWarnClear(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CWarnClear() :
|
||||
base("warnclear", "remove all warning for a player", "wc", Player.Permission.Trusted, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -64,7 +91,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CKick : Command
|
||||
{
|
||||
public CKick(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CKick() :
|
||||
base("kick", "kick a player by name", "k", Player.Permission.Trusted, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "reason",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -81,7 +122,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CSay : Command
|
||||
{
|
||||
public CSay(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CSay() :
|
||||
base("say", "broadcast message to all players", "s", Player.Permission.Moderator, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "message",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -91,7 +141,26 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CTempBan : Command
|
||||
{
|
||||
public CTempBan(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CTempBan() :
|
||||
base("tempban", "temporarily ban a player for specified time (defaults to 1 hour)", "tb", Player.Permission.Moderator, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "duration (m|d|w|y|)",
|
||||
Required = true,
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "reason",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -114,7 +183,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CBan : Command
|
||||
{
|
||||
public CBan(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CBan() :
|
||||
base("ban", "permanently ban a player from the server", "b", Player.Permission.SeniorAdmin, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "reason",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -138,7 +221,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CUnban : Command
|
||||
{
|
||||
public CUnban(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CUnban() :
|
||||
base("unban", "unban player by database id", "ub", Player.Permission.SeniorAdmin, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "databaseID",
|
||||
Required = true,
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -149,7 +241,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CWhoAmI : Command
|
||||
{
|
||||
public CWhoAmI(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CWhoAmI() :
|
||||
base("whoami", "give information about yourself.", "who", Player.Permission.User, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -160,7 +254,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CList : Command
|
||||
{
|
||||
public CList(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CList() :
|
||||
base("list", "list active clients", "l", Player.Permission.Moderator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -193,7 +289,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CHelp : Command
|
||||
{
|
||||
public CHelp(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CHelp() :
|
||||
base("help", "list all available commands", "h", Player.Permission.User, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "command",
|
||||
Required = false
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -204,9 +309,10 @@ namespace SharedLibrary.Commands
|
||||
bool found = false;
|
||||
foreach (Command C in E.Owner.Manager.GetCommands())
|
||||
{
|
||||
if (C.Name.Contains(cmd))
|
||||
if (C.Name == cmd.ToLower())
|
||||
{
|
||||
await E.Origin.Tell(" [^3" + C.Name + "^7] " + C.Description);
|
||||
await E.Origin.Tell("[^3" + C.Name + "^7] " + C.Description);
|
||||
await E.Origin.Tell(C.Syntax);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
@ -239,14 +345,16 @@ namespace SharedLibrary.Commands
|
||||
}
|
||||
}
|
||||
await E.Origin.Tell(helpResponse.ToString());
|
||||
await E.Origin.Tell("Type !help <cmd> to get command usage example");
|
||||
await E.Origin.Tell("Type !help <cmd> to get command usage syntax");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CFastRestart : Command
|
||||
{
|
||||
public CFastRestart(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CFastRestart() :
|
||||
base("fastrestart", "fast restart current map", "fr", Player.Permission.Moderator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -261,7 +369,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CMapRotate : Command
|
||||
{
|
||||
public CMapRotate(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CMapRotate() :
|
||||
base("maprotate", "cycle to the next map in rotation", "mr", Player.Permission.Administrator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -276,7 +386,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CSetLevel : Command
|
||||
{
|
||||
public CSetLevel(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CSetLevel() :
|
||||
base("setlevel", "set player to specified administration level", "sl", Player.Permission.Owner, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "level",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -318,7 +442,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CUsage : Command
|
||||
{
|
||||
public CUsage(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CUsage() :
|
||||
base("usage", "get current application memory usage", "us", Player.Permission.Moderator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -328,7 +454,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CUptime : Command
|
||||
{
|
||||
public CUptime(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CUptime() :
|
||||
base("uptime", "get current application running time", "up", Player.Permission.Moderator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -339,7 +467,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CListAdmins : Command
|
||||
{
|
||||
public CListAdmins(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CListAdmins() :
|
||||
base("admins", "list currently connected admins", "a", Player.Permission.User, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -359,7 +489,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CLoadMap : Command
|
||||
{
|
||||
public CLoadMap(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CLoadMap() :
|
||||
base("map", "change to specified map", "m", Player.Permission.Administrator, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "map",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -383,7 +522,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CFindPlayer : Command
|
||||
{
|
||||
public CFindPlayer(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CFindPlayer() :
|
||||
base("find", "find player in database", "f", Player.Permission.Administrator, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -405,7 +553,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CFindAllPlayers : Command
|
||||
{
|
||||
public CFindAllPlayers(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CFindAllPlayers() :
|
||||
base("findall", "find a player by their aliase(s)", "fa", Player.Permission.Administrator, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true,
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -451,7 +608,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CListRules : Command
|
||||
{
|
||||
public CListRules(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CListRules() :
|
||||
base("rules", "list server rules", "r", Player.Permission.User, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -478,7 +637,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CPrivateMessage : Command
|
||||
{
|
||||
public CPrivateMessage(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CPrivateMessage() :
|
||||
base("privatemessage", "send message to other player", "pm", Player.Permission.User, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "message",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -490,7 +663,8 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CReload : Command
|
||||
{
|
||||
public CReload(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CReload() :
|
||||
base("reload", "reload configuration files", "rl", Player.Permission.Owner, false) { }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -503,7 +677,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CFlag : Command
|
||||
{
|
||||
public CFlag(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CFlag() :
|
||||
base("flag", "flag a suspicious player and announce to admins on join", "fp", Player.Permission.Moderator, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "reason",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -535,7 +723,21 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CReport : Command
|
||||
{
|
||||
public CReport(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CReport() :
|
||||
base("report", "report a player for suspicious behavior", "rep", Player.Permission.User, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
},
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "reason",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -568,7 +770,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CListReports : Command
|
||||
{
|
||||
public CListReports(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CListReports() :
|
||||
base("reports", "get or clear recent reports", "reps", Player.Permission.Moderator, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "clear",
|
||||
Required = false
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -592,7 +803,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CMask : Command
|
||||
{
|
||||
public CMask(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CMask() :
|
||||
base("mask", "hide your online presence from online admin list", "hide", Player.Permission.Administrator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -613,7 +826,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CListBanInfo : Command
|
||||
{
|
||||
public CListBanInfo(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CListBanInfo() :
|
||||
base("baninfo", "get information about a ban for a player", "bi", Player.Permission.Moderator, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -640,7 +862,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CListAlias : Command
|
||||
{
|
||||
public CListAlias(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CListAlias() :
|
||||
base("alias", "get past aliases and ips of a player", "known", Player.Permission.Moderator, true, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "player",
|
||||
Required = true,
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -681,7 +912,16 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CExecuteRCON : Command
|
||||
{
|
||||
public CExecuteRCON(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CExecuteRCON() :
|
||||
base("rcon", "send rcon command to server", "rcon", Player.Permission.Owner, false, new CommandArgument[]
|
||||
{
|
||||
new CommandArgument()
|
||||
{
|
||||
Name = "command",
|
||||
Required = true
|
||||
}
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -695,7 +935,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CPlugins : Command
|
||||
{
|
||||
public CPlugins(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CPlugins() :
|
||||
base("plugins", "view all loaded plugins", "p", Player.Permission.Administrator, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -709,7 +951,9 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public class CIP : Command
|
||||
{
|
||||
public CIP(String N, String D, String U, Player.Permission P, int args, bool nT) : base(N, D, U, P, args, nT) { }
|
||||
public CIP() :
|
||||
base("getexternalip", "view your external IP address", "ip", Player.Permission.User, false)
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
@ -718,4 +962,3 @@ namespace SharedLibrary.Commands
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,10 +519,10 @@ namespace SharedLibrary
|
||||
return ClientPenalties;
|
||||
}
|
||||
|
||||
public List<Penalty> GetPenaltiesChronologically(int offset, int count)
|
||||
public List<Penalty> GetPenaltiesChronologically(int offset, int count, Penalty.Type penaltyType)
|
||||
{
|
||||
List<Penalty> ClientPenalties = new List<Penalty>();
|
||||
DataTable Result = GetDataTable($"SELECT * FROM BANS LIMIT {count} OFFSET (SELECT COUNT(*) FROM BANS)-{offset + 10}");
|
||||
DataTable Result = GetDataTable($"SELECT * FROM BANS {(penaltyType != Penalty.Type.Any ? $"WHERE `TYPE`={(int)penaltyType}" : "")} LIMIT {count} OFFSET (SELECT COUNT(*) FROM BANS {(penaltyType != Penalty.Type.Any ? $"WHERE `TYPE`={(int)penaltyType}" : "")})-{offset + count}");
|
||||
|
||||
foreach (DataRow Row in Result.Rows)
|
||||
{
|
||||
|
@ -28,7 +28,8 @@ namespace SharedLibrary
|
||||
Flag,
|
||||
Kick,
|
||||
TempBan,
|
||||
Ban
|
||||
Ban,
|
||||
Any,
|
||||
}
|
||||
|
||||
public String Reason { get; private set; }
|
||||
|
Loading…
Reference in New Issue
Block a user