mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fixed Player List Logger and added config section for it.
This commit is contained in:
parent
8809ad41d8
commit
697025040f
3 changed files with 35 additions and 12 deletions
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MinecraftClient.ChatBots
|
||||
{
|
||||
|
|
@ -34,19 +35,26 @@ namespace MinecraftClient.ChatBots
|
|||
count++;
|
||||
if (count == timeping)
|
||||
{
|
||||
SendText("/list");
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
string[] playerList = GetOnlinePlayers();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < playerList.Length; i++)
|
||||
{
|
||||
sb.Append(playerList[i]);
|
||||
|
||||
// Do not add a comma after the last username
|
||||
if (i != playerList.Length - 1)
|
||||
sb.Append(", ");
|
||||
}
|
||||
|
||||
LogDebugToConsole("Saving Player List");
|
||||
|
||||
public override void GetText(string text)
|
||||
{
|
||||
if (text.Contains("Joueurs en ligne") || text.Contains("Connected:") || text.Contains("online:"))
|
||||
{
|
||||
LogToConsole("Saving Player List");
|
||||
DateTime now = DateTime.Now;
|
||||
string TimeStamp = "[" + now.Year + '/' + now.Month + '/' + now.Day + ' ' + now.Hour + ':' + now.Minute + ']';
|
||||
System.IO.File.AppendAllText(file, TimeStamp + "\n" + GetVerbatim(text) + "\n\n");
|
||||
System.IO.File.AppendAllText(file, TimeStamp + "\n" + sb.ToString() + "\n\n");
|
||||
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue