Re added mask command
Prune confirms completion Findall display previous name confirmation message sent after kick tempban/ban confirmation wording changes players page is now paginated
This commit is contained in:
parent
cdeb7e8eaf
commit
9a85b9c4c2
@ -53,6 +53,7 @@ namespace IW4MAdmin
|
||||
|
||||
try
|
||||
{
|
||||
request.Path = String.IsNullOrEmpty(request.Path) ? "/" : request.Path;
|
||||
SharedLibrary.HttpResponse requestedPage = WebService.GetPage(request.Path, querySet, request.Headers);
|
||||
|
||||
bool binaryContent = requestedPage.BinaryContent != null;
|
||||
@ -87,7 +88,6 @@ namespace IW4MAdmin
|
||||
ApplicationManager.GetInstance().Logger.WriteWarning("Request parameter data format was incorrect");
|
||||
ApplicationManager.GetInstance().Logger.WriteDebug($"Request Path {request.Path}");
|
||||
ApplicationManager.GetInstance().Logger.WriteDebug($"Request Query String {request.QueryString}");
|
||||
|
||||
response.OnResponse(new HttpResponseHead()
|
||||
{
|
||||
Status = "400 Bad Request",
|
||||
|
@ -179,6 +179,7 @@ namespace IW4MAdmin
|
||||
Commands.Add(new CFindAllPlayers());
|
||||
Commands.Add(new CPlugins());
|
||||
Commands.Add(new CIP());
|
||||
Commands.Add(new CMask());
|
||||
|
||||
foreach (Command C in SharedLibrary.Plugins.PluginImporter.ActiveCommands)
|
||||
Commands.Add(C);
|
||||
|
@ -776,7 +776,13 @@ namespace IW4MAdmin
|
||||
|
||||
else if (querySet["recent"] != null)
|
||||
{
|
||||
matchedPlayers = ApplicationManager.GetInstance().GetClientDatabase().GetRecentPlayers();
|
||||
int offset = 0;
|
||||
if (querySet["offset"] != null)
|
||||
offset = Int32.Parse(querySet["offset"]);
|
||||
if (offset < 0)
|
||||
throw new FormatException("Invalid offset");
|
||||
|
||||
matchedPlayers = ApplicationManager.GetInstance().GetClientDatabase().GetRecentPlayers(15, offset);
|
||||
recent = true;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -6,6 +6,8 @@ CHANGELOG:
|
||||
-If multiple matches are found when finding a player, a list of matches is shown
|
||||
-"special" characters are allowed in names and messages
|
||||
-prune command demotes inactive admins (defaults to 30 days if no days are specified)
|
||||
-confirmation message sent after kick
|
||||
-paginated players page
|
||||
|
||||
Version 1.5
|
||||
CHANGELOG:
|
||||
|
@ -65,13 +65,24 @@
|
||||
}).done(function (data) { $(".loader").fadeOut(); });
|
||||
}
|
||||
|
||||
function getRecentPlayers(offset) {
|
||||
$("#playersTable").html("");
|
||||
$(".loader").fadeIn();
|
||||
|
||||
$.getJSON("/getplayer?recent=1&offset=" + offset, function (result) {
|
||||
$.each(result, function (i, player) {
|
||||
printPlayer(player, i);
|
||||
});
|
||||
}).done(function (data) { $(".loader").fadeOut(); });
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
if (parseGet('id') != "undefined")
|
||||
getPlayer('id', parseGet('id'));
|
||||
else if (parseGet('name') != "undefined")
|
||||
getPlayer('name', parseGet('name'));
|
||||
else {
|
||||
getPlayer('recent', '1');
|
||||
getRecentPlayers(0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -99,6 +110,11 @@
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<div id="paginationButtons" class="table">
|
||||
<div id="previousPage" class="tableCell"><a href=# onclick="getRecentPlayers(getPrevPage())"><<</a></div>
|
||||
<div id="nextPage" class="tableCell"><a href=# onclick="getRecentPlayers(getNextPage())">>></a></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('.searchButton').click(function () {
|
||||
if ($('.search').val().length > 0)
|
||||
|
@ -112,23 +112,28 @@ namespace StatsPlugin
|
||||
})
|
||||
{ }
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
int inactiveDays = 30;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
inactiveDays = Int32.Parse(E.Data);
|
||||
if (inactiveDays < 1)
|
||||
throw new FormatException();
|
||||
if (E.Data.Length > 0)
|
||||
{
|
||||
inactiveDays = Int32.Parse(E.Data);
|
||||
if (inactiveDays < 1)
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
|
||||
catch (FormatException)
|
||||
{
|
||||
await E.Origin.Tell("Invalid number of inactive days");
|
||||
await E.Origin.Tell("Invalid number of inactive days");
|
||||
return;
|
||||
}
|
||||
|
||||
E.Owner.Manager.GetClientDatabase().PruneAdmins(inactiveDays);
|
||||
await E.Origin.Tell("Pruned inactive privileged users");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ ___
|
||||
|findall|fa|find a player by their aliase(s)|False|!fa \<player\>|Administrator|
|
||||
|map|m|change to specified map|False|!m \<map\>|Administrator|
|
||||
|maprotate|mr|cycle to the next map in rotation|False|!mr |Administrator|
|
||||
|mask|hide|hide your online presence from online admin list|False|!hide |Administrator|
|
||||
|plugins|p|view all loaded plugins|False|!p |Administrator|
|
||||
|alias|known|get past aliases and ips of a player|True|!known \<player\>|Moderator|
|
||||
|baninfo|bi|get information about a ban for a player|True|!bi \<player\>|Moderator|
|
||||
|
@ -114,6 +114,7 @@ namespace SharedLibrary.Commands
|
||||
{
|
||||
await E.Owner.ExecuteEvent(new Event(Event.GType.Kick, E.Data, E.Origin, E.Target, E.Owner));
|
||||
await E.Target.Kick(E.Target.lastOffense, E.Origin);
|
||||
await E.Origin.Tell($"^5{E.Target} ^7has been kicked");
|
||||
}
|
||||
else
|
||||
await E.Origin.Tell($"You do not have the required privileges to kick {E.Target.Name}");
|
||||
@ -174,7 +175,7 @@ namespace SharedLibrary.Commands
|
||||
if (E.Origin.Level > E.Target.Level)
|
||||
{
|
||||
await E.Target.TempBan(Message, length, E.Origin);
|
||||
await E.Origin.Tell($"Successfully temp banned ^5{E.Target.Name} ^7for ^5{length.TimeSpanText()}");
|
||||
await E.Origin.Tell($"^5{E.Target} ^7has been temporarily banned for ^5{length.TimeSpanText()}");
|
||||
}
|
||||
else
|
||||
await E.Origin.Tell("You cannot temp ban " + E.Target.Name);
|
||||
@ -212,7 +213,7 @@ namespace SharedLibrary.Commands
|
||||
{
|
||||
await E.Owner.ExecuteEvent(new Event(Event.GType.Ban, E.Data, E.Origin, E.Target, E.Owner));
|
||||
await E.Target.Ban(Message, E.Origin);
|
||||
await E.Origin.Tell(String.Format("Sucessfully banned ^5{0} ^7({1})", E.Target.Name, E.Target.NetworkID));
|
||||
await E.Origin.Tell($"^5{E.Target} ^7has been permanently banned");
|
||||
}
|
||||
else
|
||||
await E.Origin.Tell("You cannot ban " + E.Target.Name);
|
||||
@ -235,7 +236,7 @@ namespace SharedLibrary.Commands
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
await E.Owner.Unban(E.Target);
|
||||
await E.Origin.Tell($"Successfully unbanned {E.Target.Name}::{E.Target.NetworkID}");
|
||||
await E.Origin.Tell($"Successfully unbanned {E.Target}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -568,9 +569,9 @@ namespace SharedLibrary.Commands
|
||||
{
|
||||
E.Data = E.Data.Trim();
|
||||
|
||||
if (E.Data.Length < 4)
|
||||
if (E.Data.Length < 3)
|
||||
{
|
||||
await E.Origin.Tell("You must enter at least 4 letters");
|
||||
await E.Origin.Tell("You must enter at least 3 characters");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -587,14 +588,16 @@ namespace SharedLibrary.Commands
|
||||
if (P == null)
|
||||
continue;
|
||||
|
||||
String lookingFor = String.Empty;
|
||||
String lookingFor = null;
|
||||
|
||||
foreach (String S in P.Names)
|
||||
{
|
||||
if (S.Contains(E.Data))
|
||||
if (S.ToLower().Contains(E.Data.ToLower()))
|
||||
lookingFor = S;
|
||||
}
|
||||
|
||||
lookingFor = lookingFor ?? P.Names.First();
|
||||
|
||||
Player Current = E.Owner.Manager.GetClientDatabase().GetPlayer(P.Number);
|
||||
|
||||
if (Current != null && Current.Name != lookingFor)
|
||||
@ -763,7 +766,7 @@ namespace SharedLibrary.Commands
|
||||
E.Data = E.Data.RemoveWords(1);
|
||||
E.Owner.Reports.Add(new Report(E.Target, E.Origin, E.Data));
|
||||
|
||||
await E.Origin.Tell($"Successfully reported {E.Target.Name}");
|
||||
await E.Origin.Tell($"Thank you for your report, and administrator has been notified");
|
||||
await E.Owner.ExecuteEvent(new Event(Event.GType.Report, E.Data, E.Origin, E.Target, E.Owner));
|
||||
await E.Owner.ToAdmins(String.Format("^5{0}^7->^1{1}^7: {2}", E.Origin.Name, E.Target.Name, E.Data));
|
||||
}
|
||||
@ -840,12 +843,6 @@ namespace SharedLibrary.Commands
|
||||
|
||||
public override async Task ExecuteAsync(Event E)
|
||||
{
|
||||
if (E.Target == null)
|
||||
{
|
||||
await E.Origin.Tell("No bans for that player.");
|
||||
return;
|
||||
}
|
||||
|
||||
var B = E.Owner.Manager.GetClientPenalties().FindPenalties(E.Target);
|
||||
var BannedPenalty = B.Find(b => b.BType > Penalty.Type.Kick && b.Expires > DateTime.Now);
|
||||
|
||||
@ -880,7 +877,7 @@ namespace SharedLibrary.Commands
|
||||
|
||||
if (E.Target.Alias == null)
|
||||
{
|
||||
await E.Target.Tell("Could not find alias info for that player.");
|
||||
await E.Target.Tell("Could not find alias info for that player");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -962,4 +959,3 @@ namespace SharedLibrary.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,12 +292,10 @@ namespace SharedLibrary
|
||||
}
|
||||
|
||||
|
||||
public List<Player> GetRecentPlayers()
|
||||
public List<Player> GetRecentPlayers(int count = 15, int offset = 0)
|
||||
{
|
||||
List<Player> returnssss = new List<Player>();
|
||||
//String Query = String.Format($"SELECT * FROM CLIENTS LIMIT 15 OFFSET (SELECT COUNT(*) FROM CLIENTS)-15");
|
||||
String Query = "SELECT * FROM CLIENTS ORDER BY LastConnection DESC LIMIT 25";
|
||||
DataTable Result = GetDataTable(Query);
|
||||
var Result = GetDataTable($"SELECT * FROM CLIENTS LIMIT {count} OFFSET (SELECT COUNT(*) FROM CLIENTS)-{offset + count}");
|
||||
|
||||
if (Result != null && Result.Rows.Count > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user