mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
Moved plugins to a seperate folder
Uncapped the search result limit for !find
This commit is contained in:
@ -171,7 +171,7 @@ namespace SharedLibrary.Commands
|
||||
else
|
||||
playerList.AppendFormat("[^3{0}^7]{3}[^3{1}^7] {2}", Utilities.levelToColor(P.Level), P.ClientID, P.Name, SharedLibrary.Utilities.getSpaces(Player.Permission.SeniorAdmin.ToString().Length - P.Level.ToString().Length));
|
||||
|
||||
if (count == 2 || E.Owner.getPlayers().Count == 1)
|
||||
if (count == 2 || E.Owner.GetPlayersAsList().Count == 1)
|
||||
{
|
||||
await E.Origin.Tell(playerList.ToString());
|
||||
count = 0;
|
||||
@ -293,7 +293,7 @@ namespace SharedLibrary.Commands
|
||||
// todo: manager DB
|
||||
foreach (var server in E.Owner.Manager.GetServers())
|
||||
{
|
||||
foreach (var player in server.getPlayers())
|
||||
foreach (var player in server.GetPlayersAsList())
|
||||
{
|
||||
if (player != null && player.NetworkID == E.Target.NetworkID)
|
||||
{
|
||||
@ -624,7 +624,6 @@ namespace SharedLibrary.Commands
|
||||
var B = E.Owner.Manager.GetClientPenalties().FindPenalties(E.Target);
|
||||
var BannedPenalty = B.Find(b => b.BType == Penalty.Type.Ban);
|
||||
|
||||
|
||||
if (BannedPenalty == null)
|
||||
{
|
||||
await E.Origin.Tell("No active ban was found for that player.");
|
||||
|
@ -384,7 +384,7 @@ namespace SharedLibrary
|
||||
var Con = GetNewConnection();
|
||||
SQLiteCommand cmd = new SQLiteCommand(Con)
|
||||
{
|
||||
CommandText = "SELECT * FROM CLIENTS WHERE Name LIKE @Name LIMIT 32"
|
||||
CommandText = "SELECT * FROM CLIENTS WHERE Name LIKE @Name"
|
||||
};
|
||||
cmd.Parameters.AddWithValue("@Name", '%' + name + '%');
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace SharedLibrary
|
||||
events = new Queue<Event>();
|
||||
Reports = new List<Report>();
|
||||
playerHistory = new Queue<PlayerHistory>();
|
||||
chatHistory = new List<Chat>();
|
||||
ChatHistory = new List<Chat>();
|
||||
lastWebChat = DateTime.Now;
|
||||
nextMessage = 0;
|
||||
initMacros();
|
||||
@ -96,24 +96,13 @@ namespace SharedLibrary
|
||||
return Port;
|
||||
}
|
||||
|
||||
//Returns number of active clients on server -- *INT*
|
||||
public int getNumPlayers()
|
||||
{
|
||||
return ClientNum;
|
||||
}
|
||||
|
||||
//Returns list of all current players
|
||||
public List<Player> getPlayers()
|
||||
public List<Player> GetPlayersAsList()
|
||||
{
|
||||
return Players.FindAll(x => x != null);
|
||||
}
|
||||
|
||||
|
||||
public int pID()
|
||||
{
|
||||
return this.PID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get any know aliases ( name or ip based ) from the database
|
||||
/// </summary>
|
||||
@ -159,7 +148,7 @@ namespace SharedLibrary
|
||||
/// <returns>Matching player if found</returns>
|
||||
public Player GetClientByName(String pName)
|
||||
{
|
||||
return Players.FirstOrDefault(p => p.Name.ToLower() == pName.ToLower());
|
||||
return Players.FirstOrDefault(p => p != null && p.Name.ToLower() == pName.ToLower());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -209,7 +198,7 @@ namespace SharedLibrary
|
||||
public async Task Broadcast(String Message)
|
||||
{
|
||||
#if DEBUG
|
||||
// return;
|
||||
return;
|
||||
#endif
|
||||
await this.ExecuteCommandAsync($"sayraw {Message}");
|
||||
}
|
||||
@ -222,8 +211,8 @@ namespace SharedLibrary
|
||||
public async Task Tell(String Message, Player Target)
|
||||
{
|
||||
#if DEBUG
|
||||
//if (!Target.lastEvent.Remote)
|
||||
// return;
|
||||
if (!Target.lastEvent.Remote)
|
||||
return;
|
||||
#endif
|
||||
if (Target.ClientID > -1 && Message.Length > 0 && Target.Level != Player.Permission.Console && !Target.lastEvent.Remote)
|
||||
await this.ExecuteCommandAsync($"tellraw {Target.ClientID} {Message}^7");
|
||||
@ -308,13 +297,11 @@ namespace SharedLibrary
|
||||
if ((requestTime - lastWebChat).TotalSeconds > 1)
|
||||
{
|
||||
Broadcast("^1[WEBCHAT] ^5" + P.Name + "^7 - " + Message);
|
||||
while (chatHistory.Count > Math.Ceiling((double)ClientNum / 2))
|
||||
chatHistory.RemoveAt(0);
|
||||
|
||||
if (Message.Length > 50)
|
||||
Message = Message.Substring(0, 50) + "...";
|
||||
|
||||
chatHistory.Add(new Chat(P.Name, Utilities.StripColors(Message), DateTime.Now));
|
||||
ChatHistory.Add(new Chat(P.Name, Utilities.StripColors(Message), DateTime.Now));
|
||||
lastWebChat = DateTime.Now;
|
||||
}
|
||||
}
|
||||
@ -432,7 +419,7 @@ namespace SharedLibrary
|
||||
public String Gametype;
|
||||
public int totalKills = 0;
|
||||
public List<Report> Reports;
|
||||
public List<Chat> chatHistory;
|
||||
public List<Chat> ChatHistory;
|
||||
public Queue<PlayerHistory> playerHistory { get; private set; }
|
||||
|
||||
//Info
|
||||
@ -452,8 +439,6 @@ namespace SharedLibrary
|
||||
|
||||
protected DateTime lastWebChat;
|
||||
public string Password { get; private set; }
|
||||
public int Handle { get; private set; }
|
||||
protected int PID;
|
||||
protected IFile logFile;
|
||||
|
||||
// Log stuff
|
||||
|
Reference in New Issue
Block a user